Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
412 commits
Select commit Hold shift + click to select a range
b3fbe1f
Update main.yml
AnithaAnnem Mar 10, 2026
ef015cc
Update rbac.yml
AnithaAnnem Mar 10, 2026
5cb31db
Update acl.yml
AnithaAnnem Mar 10, 2026
6a0489c
Update acl_policies.yml
AnithaAnnem Mar 10, 2026
cb1af43
Update acl_tokens.yml
AnithaAnnem Mar 10, 2026
9e8dc38
Update acl.yml
AnithaAnnem Mar 10, 2026
db8d88a
Update acl_policies.yml
AnithaAnnem Mar 10, 2026
49c8104
Update acl_tokens.yml
AnithaAnnem Mar 10, 2026
8813fcf
Update rbac.yml
AnithaAnnem Mar 10, 2026
61f9b26
Update server.hcl.j2
AnithaAnnem Mar 10, 2026
d27f876
Update server.hcl.j2
AnithaAnnem Mar 10, 2026
c7ce2ee
Update server.hcl.j2
AnithaAnnem Mar 10, 2026
a0f178b
Update acl.yml
AnithaAnnem Mar 10, 2026
c17397b
Update server.hcl.j2
AnithaAnnem Mar 10, 2026
81e6185
Update acl.yml
AnithaAnnem Mar 10, 2026
25a212e
Update acl_policies.yml
AnithaAnnem Mar 10, 2026
b53f066
Update acl_tokens.yml
AnithaAnnem Mar 10, 2026
ed1f50b
Update rbac.yml
AnithaAnnem Mar 10, 2026
f2194cf
Update main.yml
AnithaAnnem Mar 10, 2026
7e52d2b
Update server.hcl.j2
AnithaAnnem Mar 10, 2026
185f068
Update server.hcl.j2
AnithaAnnem Mar 10, 2026
5ff4caa
Update server.hcl.j2
AnithaAnnem Mar 10, 2026
258a045
Update acl.yml
AnithaAnnem Mar 10, 2026
bf48dd6
Update acl_policies.yml
AnithaAnnem Mar 10, 2026
5f05250
Update acl_tokens.yml
AnithaAnnem Mar 10, 2026
47cf278
Update rbac.yml
AnithaAnnem Mar 10, 2026
08aa190
Update server.hcl.j2
AnithaAnnem Mar 11, 2026
2949b4f
Update acl.yml
AnithaAnnem Mar 11, 2026
2833680
Update acl_policies.yml
AnithaAnnem Mar 11, 2026
043f37e
Update acl_tokens.yml
AnithaAnnem Mar 11, 2026
fa5e162
Update rbac.yml
AnithaAnnem Mar 11, 2026
97c4d4d
Update and rename tls.crt to consul-agent-ca.pem
AnithaAnnem Mar 11, 2026
e5e9dc1
Update and rename tls.key to dc1-server-consul-0.pem
AnithaAnnem Mar 11, 2026
73b4a4f
Create dc1-server-consul-0-key.pem
AnithaAnnem Mar 11, 2026
a32eb13
Update config.yml
AnithaAnnem Mar 11, 2026
8c420a4
Update server.hcl.j2
AnithaAnnem Mar 11, 2026
60cf490
Update acl.yml
AnithaAnnem Mar 11, 2026
90077be
Update acl_policies.yml
AnithaAnnem Mar 11, 2026
85782e5
Update rbac.yml
AnithaAnnem Mar 11, 2026
d1c5978
Update acl_policies.yml
AnithaAnnem Mar 11, 2026
731b41a
Update consul-agent-ca.pem
AnithaAnnem Mar 11, 2026
984356d
Update dc1-server-consul-0-key.pem
AnithaAnnem Mar 11, 2026
1676465
Update dc1-server-consul-0.pem
AnithaAnnem Mar 11, 2026
eca8c16
Delete consul-role/files/consul-agent-ca.pem
AnithaAnnem Mar 11, 2026
9ded9e0
Delete consul-role/files/dc1-server-consul-0-key.pem
AnithaAnnem Mar 11, 2026
2701f0b
Delete consul-role/files/dc1-server-consul-0.pem
AnithaAnnem Mar 11, 2026
c460b4c
Create tls.crt
AnithaAnnem Mar 11, 2026
0c6e209
Create tls.key
AnithaAnnem Mar 11, 2026
6b6f268
Update acl.yml
AnithaAnnem Mar 11, 2026
5afac80
Update acl_policies.yml
AnithaAnnem Mar 11, 2026
fa3abe4
Update acl_tokens.yml
AnithaAnnem Mar 11, 2026
0af6e1c
Update config.yml
AnithaAnnem Mar 11, 2026
590668e
Update rbac.yml
AnithaAnnem Mar 11, 2026
f18841a
Update server.hcl.j2
AnithaAnnem Mar 11, 2026
f76d0ee
Update server.hcl.j2
AnithaAnnem Mar 11, 2026
99a4bcc
Update read-policy.hcl
AnithaAnnem Mar 11, 2026
42e6f96
Update main.yml
AnithaAnnem Mar 11, 2026
998fbc5
Update read-policy.hcl
AnithaAnnem Mar 12, 2026
b593bb5
Update main.yml
AnithaAnnem Mar 13, 2026
8387744
Update server.hcl.j2
AnithaAnnem Mar 13, 2026
1db7e12
Create monitoring-policy.hcl.j2
AnithaAnnem Mar 13, 2026
96071b8
Update acl_policies.yml
AnithaAnnem Mar 13, 2026
3c3009d
Update acl_tokens.yml
AnithaAnnem Mar 13, 2026
2eb1869
Update acl_policies.yml
AnithaAnnem Mar 13, 2026
b753817
Update acl_tokens.yml
AnithaAnnem Mar 13, 2026
bc19e91
Update acl_tokens.yml
AnithaAnnem Mar 13, 2026
fe81b1b
Create prometheus-consul.yml.j2
AnithaAnnem Mar 13, 2026
098bc8a
Update acl_tokens.yml
AnithaAnnem Mar 13, 2026
d44ee3b
Update acl_tokens.yml
AnithaAnnem Mar 13, 2026
3156d4a
Update acl_tokens.yml
AnithaAnnem Mar 13, 2026
1076834
Update main.yml
AnithaAnnem Mar 13, 2026
f9942f0
Create keycloak-service.json.j2
AnithaAnnem Mar 13, 2026
42b7c83
Update config.yml
AnithaAnnem Mar 13, 2026
ef53ef9
Update keycloak-service.json.j2
AnithaAnnem Mar 13, 2026
e90feda
Update config.yml
AnithaAnnem Mar 13, 2026
2ee4ac9
Update keycloak-service.json.j2
AnithaAnnem Mar 13, 2026
6801ff6
Update keycloak-service.json.j2
AnithaAnnem Mar 13, 2026
744e856
Update keycloak-service.json.j2
AnithaAnnem Mar 16, 2026
10fc05c
Update keycloak-service.json.j2
AnithaAnnem Mar 17, 2026
630defe
Update main.yml
AnithaAnnem Mar 17, 2026
28ab8c9
Update config.yml
AnithaAnnem Mar 19, 2026
fd1ecda
Update acl_policies.yml
AnithaAnnem Mar 19, 2026
5f9560c
Update acl_tokens.yml
AnithaAnnem Mar 19, 2026
e0375e3
Update server.hcl.j2
AnithaAnnem Mar 19, 2026
6f37d27
Update server.hcl.j2
AnithaAnnem Mar 19, 2026
aa8c5ee
Update server.hcl.j2
AnithaAnnem Mar 19, 2026
d34412e
Update acl.yml
AnithaAnnem Mar 19, 2026
93cd30d
Update acl_policies.yml
AnithaAnnem Mar 19, 2026
7e2134f
Update acl_tokens.yml
AnithaAnnem Mar 19, 2026
c2ae456
Update rbac.yml
AnithaAnnem Mar 19, 2026
e68e8c1
Update acl.yml
AnithaAnnem Mar 19, 2026
ea001c9
Update acl_policies.yml
AnithaAnnem Mar 19, 2026
c976cca
Update rbac.yml
AnithaAnnem Mar 19, 2026
dd95ba8
Update acl_tokens.yml
AnithaAnnem Mar 19, 2026
b181031
Update acl.yml
AnithaAnnem Mar 19, 2026
8923765
Delete consul-role/templates/keycloak-service.json.j2
AnithaAnnem Mar 19, 2026
8c4e263
Update main.yml
AnithaAnnem Mar 19, 2026
6065d42
Update config.yml
AnithaAnnem Mar 19, 2026
97178d1
Update acl.yml
AnithaAnnem Mar 19, 2026
3712ab4
Update acl_policies.yml
AnithaAnnem Mar 19, 2026
24a56ff
Update acl_tokens.yml
AnithaAnnem Mar 19, 2026
ab1b9b6
Update rbac.yml
AnithaAnnem Mar 19, 2026
ce24736
Update acl.yml
AnithaAnnem Mar 19, 2026
441adcc
Update acl.yml
AnithaAnnem Mar 19, 2026
ba8fb08
Update acl_policies.yml
AnithaAnnem Mar 19, 2026
fbcde4c
Update acl_tokens.yml
AnithaAnnem Mar 19, 2026
6b3c217
Update rbac.yml
AnithaAnnem Mar 19, 2026
ceb4955
Update acl.yml
AnithaAnnem Mar 19, 2026
016610b
Update acl_policies.yml
AnithaAnnem Mar 19, 2026
c63ee43
Update acl_tokens.yml
AnithaAnnem Mar 19, 2026
8a9479f
Update rbac.yml
AnithaAnnem Mar 19, 2026
3e8b3bf
Update server.hcl.j2
AnithaAnnem Mar 19, 2026
3e45dbd
Update acl_policies.yml
AnithaAnnem Mar 19, 2026
00b3cf6
Update acl.yml
AnithaAnnem Mar 19, 2026
a61def9
Update acl_tokens.yml
AnithaAnnem Mar 19, 2026
034bddd
Update rbac.yml
AnithaAnnem Mar 19, 2026
f6cbca6
Update acl_policies.yml
AnithaAnnem Mar 19, 2026
8a39a83
Update acl_policies.yml
AnithaAnnem Mar 19, 2026
ed3789a
Update acl_tokens.yml
AnithaAnnem Mar 19, 2026
7e33c80
Update rbac.yml
AnithaAnnem Mar 19, 2026
7fef5d3
Update rbac.yml
AnithaAnnem Mar 19, 2026
f340a20
Update acl.yml
AnithaAnnem Mar 19, 2026
0811bd2
Update acl_policies.yml
AnithaAnnem Mar 19, 2026
c2a6357
Update acl_tokens.yml
AnithaAnnem Mar 19, 2026
6d0b1a0
Delete consul-role/files/tls.key
AnithaAnnem Mar 19, 2026
de3d7d4
Delete consul-role/files/tls.crt
AnithaAnnem Mar 19, 2026
9851cad
Update acl_policies.yml
AnithaAnnem Mar 19, 2026
c1eb7ee
Update acl_tokens.yml
AnithaAnnem Mar 19, 2026
5c3b26d
Update rbac.yml
AnithaAnnem Mar 19, 2026
e5c46e7
Update server.hcl.j2
AnithaAnnem Mar 19, 2026
8e0a4fd
Update config.yml
AnithaAnnem Mar 19, 2026
c825db2
Update server.hcl.j2
AnithaAnnem Mar 19, 2026
4bca5c5
Update server.hcl.j2
AnithaAnnem Mar 19, 2026
18f613c
Update acl_policies.yml
AnithaAnnem Mar 19, 2026
d7351e5
Update acl_policies.yml
AnithaAnnem Mar 19, 2026
0d64548
Update acl_policies.yml
AnithaAnnem Mar 19, 2026
1e20fa8
Update acl_tokens.yml
AnithaAnnem Mar 19, 2026
c67d980
Update rbac.yml
AnithaAnnem Mar 19, 2026
4006ff2
Update acl_policies.yml
AnithaAnnem Mar 19, 2026
54fe8af
Update acl_tokens.yml
AnithaAnnem Mar 19, 2026
92a16af
Update rbac.yml
AnithaAnnem Mar 19, 2026
988e4dc
Update server.hcl.j2
AnithaAnnem Mar 19, 2026
5ee44ec
Update install.yml
AnithaAnnem Mar 19, 2026
66a174a
Update config.yml
AnithaAnnem Mar 19, 2026
1bf70a0
Update config.yml
AnithaAnnem Mar 19, 2026
7caceea
Update main.yml
AnithaAnnem Mar 19, 2026
2411124
Update acl.yml
AnithaAnnem Mar 19, 2026
97221cb
Update acl.yml
AnithaAnnem Mar 19, 2026
15e01d4
Update acl_policies.yml
AnithaAnnem Mar 19, 2026
1bc2fd0
Update acl_tokens.yml
AnithaAnnem Mar 19, 2026
16bffc6
Update rbac.yml
AnithaAnnem Mar 19, 2026
e102ba2
Update main.yml
AnithaAnnem Mar 19, 2026
24ecdc8
Update main.yml
AnithaAnnem Mar 19, 2026
a365bba
Update acl_tokens.yml
AnithaAnnem Mar 19, 2026
addc389
moving all the files out from the consul-role directory
AnnemAnitha7989 Mar 19, 2026
8913df8
deleting the consul-role
AnnemAnitha7989 Mar 19, 2026
bb70e41
Create consul-readme.md
AnithaAnnem Mar 19, 2026
a9f2977
Update consul-readme.md
AnithaAnnem Mar 19, 2026
61ce8c9
Update consul-readme.md
AnithaAnnem Mar 19, 2026
d59011a
Update main.yml
AnithaAnnem Mar 20, 2026
7b09b6f
Update main.yml
AnithaAnnem Mar 20, 2026
c8d7cb7
Delete tasks/directories.yml
AnithaAnnem Mar 20, 2026
d60bead
Update service.yml
AnithaAnnem Mar 20, 2026
ab02cb5
Update acl.yml
AnithaAnnem Mar 20, 2026
257b2ec
Update rbac.yml
AnithaAnnem Mar 20, 2026
f85c92b
Update server.hcl.j2
AnithaAnnem Mar 20, 2026
12219a1
Update consul-readme.md
AnithaAnnem Mar 20, 2026
2723bcd
Update rbac.yml
AnithaAnnem Mar 20, 2026
b74d31e
Update rbac.yml
AnithaAnnem Mar 20, 2026
38ad655
Update server.hcl.j2
AnithaAnnem Mar 20, 2026
463d425
Rename consul-readme.md to Readme.md
AnithaAnnem Mar 23, 2026
45fba5e
Update main.yml
AnithaAnnem Mar 24, 2026
4dd9078
Update acl_tokens.yml
AnithaAnnem Mar 24, 2026
bf19715
Create backup.yml
AnithaAnnem Apr 7, 2026
38dc798
Update main.yml
AnithaAnnem Apr 7, 2026
84fa78d
Update main.yml
AnithaAnnem Apr 7, 2026
2028602
Update backup.yml
AnithaAnnem Apr 8, 2026
10a81e2
Update backup.yml
AnithaAnnem Apr 8, 2026
886d9c2
Update main.yml
AnithaAnnem Apr 9, 2026
fe66150
Update backup.yml
AnithaAnnem Apr 9, 2026
8f4f8f5
Create consul-backup-config.yml.j2
AnithaAnnem Apr 9, 2026
8fb7520
Update backup.yml
AnithaAnnem Apr 9, 2026
3707dd7
Update consul-backup-config.yml.j2
AnithaAnnem Apr 9, 2026
e452dd1
Delete templates/consul-backup-config.yml.j2
AnithaAnnem Apr 9, 2026
adcf8ba
Update backup.yml
AnithaAnnem Apr 9, 2026
6b81786
Update backup.yml
AnithaAnnem Apr 9, 2026
2ff2fd9
Update backup.yml
AnithaAnnem Apr 9, 2026
d1b78e9
Update backup.yml
AnithaAnnem Apr 9, 2026
86134b3
Update backup.yml
AnithaAnnem Apr 9, 2026
ca916af
Update backup.yml
AnithaAnnem Apr 9, 2026
a8b6d6b
Update main.yml
AnithaAnnem Apr 9, 2026
6548b60
Update main.yml
AnithaAnnem Apr 9, 2026
f8d211b
Update main.yml
AnithaAnnem Apr 9, 2026
f97f569
Update main.yml
AnithaAnnem Apr 9, 2026
899a529
Update backup.yml
AnithaAnnem Apr 9, 2026
fee2997
Update main.yml
AnithaAnnem Apr 9, 2026
b2d3cd4
Update backup.yml
AnithaAnnem Apr 9, 2026
6b91d27
Update backup.yml
AnithaAnnem Apr 9, 2026
810ea8b
Update main.yml
AnithaAnnem Apr 9, 2026
56f9c80
Update backup.yml
AnithaAnnem Apr 9, 2026
0748de7
Update main.yml
AnithaAnnem Apr 9, 2026
bd32edd
Update backup.yml
AnithaAnnem Apr 9, 2026
dec580d
Update main.yml
AnithaAnnem Apr 11, 2026
b7d0ceb
Update main.yml
AnithaAnnem Apr 29, 2026
b7f5128
Update main.yml
AnithaAnnem Apr 29, 2026
bc2ffc7
Update server.hcl.j2
AnithaAnnem Apr 29, 2026
4f64c8f
Create oidc.yml
AnithaAnnem Apr 29, 2026
1a74a3e
Update main.yml
AnithaAnnem Apr 29, 2026
e813129
Update oidc.yml
AnithaAnnem Apr 29, 2026
058c96d
Update oidc.yml
AnithaAnnem Apr 29, 2026
4f02f02
Update oidc.yml
AnithaAnnem Apr 29, 2026
d90db28
Update oidc.yml
AnithaAnnem Apr 29, 2026
fdbcb37
Update main.yml
AnithaAnnem Apr 29, 2026
3e188f0
Update main.yml
AnithaAnnem Apr 29, 2026
173ce96
Update oidc.yml
AnithaAnnem Apr 29, 2026
c34bd6c
Update oidc.yml
AnithaAnnem Apr 30, 2026
7c6da86
Update oidc.yml
AnithaAnnem Apr 30, 2026
e3c58d3
Update main.yml
AnithaAnnem Apr 30, 2026
afd63a0
Update main.yml
AnithaAnnem Apr 30, 2026
7b169db
Update main.yml
AnithaAnnem Apr 30, 2026
adb9598
Update oidc.yml
AnithaAnnem Apr 30, 2026
5eb89bb
Update main.yml
AnithaAnnem Apr 30, 2026
5bc9d62
Update oidc.yml
AnithaAnnem Apr 30, 2026
23a4aa5
Update oidc.yml
AnithaAnnem Apr 30, 2026
8f6c619
Update main.yml
AnithaAnnem Apr 30, 2026
b66f63a
Update main.yml
AnithaAnnem Apr 30, 2026
2a51997
Update main.yml
AnithaAnnem Apr 30, 2026
bb64cdb
Update oidc.yml
AnithaAnnem Apr 30, 2026
4138694
Update oidc.yml
AnithaAnnem Apr 30, 2026
7a6c67e
Update oidc.yml
AnithaAnnem Apr 30, 2026
85bb84a
Update oidc.yml
AnithaAnnem Apr 30, 2026
540118d
Update oidc.yml
AnithaAnnem Apr 30, 2026
07f63ff
Update oidc.yml
AnithaAnnem Apr 30, 2026
354189f
Update main.yml
AnithaAnnem Apr 30, 2026
201e606
Update main.yml
AnithaAnnem Apr 30, 2026
9abb709
Update oidc.yml
AnithaAnnem Apr 30, 2026
bce53f9
Update oidc.yml
AnithaAnnem Apr 30, 2026
d4ea5c6
Update oidc.yml
AnithaAnnem Apr 30, 2026
68eccde
Update oidc.yml
AnithaAnnem Apr 30, 2026
5245ff7
Update oidc.yml
AnithaAnnem Apr 30, 2026
7b0a663
Update oidc.yml
AnithaAnnem Apr 30, 2026
08ffd3b
Update oidc.yml
AnithaAnnem Apr 30, 2026
4c00e3e
Update oidc.yml
AnithaAnnem Apr 30, 2026
5e77c61
Update oidc.yml
AnithaAnnem Apr 30, 2026
7db952f
Update oidc.yml
AnithaAnnem Apr 30, 2026
efb83b6
Update oidc.yml
AnithaAnnem Apr 30, 2026
de4e2df
Update oidc.yml
AnithaAnnem Apr 30, 2026
3607974
Update oidc.yml
AnithaAnnem Apr 30, 2026
6b93973
Update oidc.yml
AnithaAnnem Apr 30, 2026
e719725
Update main.yml
AnithaAnnem Apr 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
357 changes: 357 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,357 @@

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File name should be Readme.md instead of consul-readme.md

# Consul Ansible Role

<img width="413" height="122" alt="image" src="https://github.com/user-attachments/assets/c650148d-68c8-46cf-899c-f5966bafdfa3" />


## Table of Contents

1. [Overview](#1-overview)
2. [Supported Operating Systems](#2-supported-operating-systems)
3. [Prerequisites & Known Limitations](#3-prerequisites--known-limitations)
4. [Architecture & Core Components](#4-architecture--core-components)
5. [Configuration Overview](#5-configuration-overview)
6. [Installation Flow](#6-installation-flow)
7. [Running Consul](#7-running-consul)
8. [Validation & Testing](#8-validation--testing)
9. [Best Practices Followed](#9-best-practices-followed)
10. [Troubleshooting](#10-troubleshooting)
11. [Conclusion](#11-conclusion)
12. [References](#12-references)
13. [Author](#13-author)

## 1. Overview

**HashiCorp Consul** is a service networking platform that enables:

- Service Discovery
- Service Mesh
- Health Checking
- Key-Value Storage
- Secure Service-to-Service Communication

It is widely used in distributed systems and microservices architectures to provide dynamic infrastructure management.

### Problems Consul Solves

- How do services find each other?
- How do we secure service communication?
- How do we monitor service health?
- How do we manage configuration centrally?

### Supported Environments

Consul works across:

- Virtual Machines
- Kubernetes
- Hybrid environments
- Multi-cloud deployments

---

## 2. Supported Operating Systems

Consul supports multiple operating systems:

### Linux
- Ubuntu
- Debian
- RHEL
- CentOS
- Amazon Linux

### Other Platforms
- Windows
- macOS
- Kubernetes environments
- Cloud platforms:
- AWS
- Azure
- GCP

> Consul is written in **Go** and distributed as a single binary.

---

## 3. Prerequisites & Known Limitations

### Prerequisites

- Network connectivity between cluster nodes
- Minimum **3 nodes** for production cluster (recommended)
- Proper firewall configuration (ports **8300–8600**)
- Stable DNS or IP addressing
- TLS certificates (for secure production environments)

### Known Limitations

- Requires quorum for leader election
- Performance depends on cluster size and network latency
- Misconfigured ACLs can block cluster operations
- Not a replacement for full configuration management tools

---

## 4. Architecture & Core Components

Consul architecture consists of the following components:

### 4.1 Servers

- Maintain cluster state
- Participate in **Raft consensus**
- Handle leader election

### 4.2 Clients (Agents)

- Run on application nodes
- Register services
- Perform health checks

### 4.3 Datacenter

- Logical grouping of nodes in a specific environment

### 4.4 Gossip Protocol

- Used for node membership
- Handles failure detection

### 4.5 Raft Consensus

- Provides strong consistency
- Manages leader election among servers

### 4.6 Key-Value Store

- Stores configuration data centrally
- Used for dynamic application configuration

### 4.7 Service Mesh (Connect)

- Provides secure service-to-service communication
- Uses **mTLS (Mutual TLS)**
- Enables zero-trust networking between services

---



## Role Structure
```
.
├── inventory.ini
├── site.yml
└── roles/
└── consul/
├── defaults/
│ └── main.yml
├── files/
│ └── read-policy.hcl
├── handlers/
│ └── main.yml
├── meta/
│ └── main.yml
├── tasks/
│ ├── acl.yml
│ ├── acl_policies.yml
│ ├── acl_tokens.yml
│ ├── config.yml
│ ├── directories.yml
│ ├── install.yml
│ ├── main.yml
│ ├── rbac.yml
│ └── service.yml
├── templates/
│ ├── consul.service.j2
│ ├── prometheus-consul.yml.j2
│ ├── server.hcl.j2
│ └── policies/
│ ├── agent-policy.hcl.j2
│ ├── monitoring-policy.hcl.j2
│ ├── readonly-policy.hcl.j2
│ └── service-policy.hcl.j2
├── tests/
│ └── test.yml
└── vars/
└── main.yml
```

## 5. Configuration Overview

Consul can be configured using:

- HCL files
- JSON configuration files
- Command-line flags
- Environment variables

### Important Configuration Parameters

| Parameter | Description |
|-------------------|------------|
| `node_name` | Unique node identifier |
| `bind_addr` | Address to bind Consul to |
| `data_dir` | Directory for Consul data |
| `server` | Defines server or client mode (`true/false`) |
| `bootstrap_expect` | Number of servers expected for cluster formation |
| `retry_join` | List of nodes to join cluster |
| `acl` | Enables Access Control Lists |
| `ui_config` | UI configuration settings |

### ACL Configuration Includes

- Enable/Disable ACLs
- Default policies
- Token management
- Token persistence

---

## 6. Installation Flow
### Step 1: Download Binary
```
wget https://releases.hashicorp.com/consul/1.17.0/consul_1.17.0_linux_amd64.zip
```

### Step 2: Unzip
```
unzip consul_1.17.0_linux_amd64.zip
```

### Step 3: Move Binary
```
sudo mv consul /usr/local/bin/
```

### Step 4: Verify Installation
```
consul --version
```

## 7. Running the Playbook
```
ansible-playbook -i inventory.ini site.yml
```

## 8. Validation & Testing
## Check Cluster Members
```
consul members
```
## Check Leader
```
consul operator raft list-peers
```
## Check Services
```
consul catalog services
```
## Access UI

Default UI URL:

```
http://<server-ip>:8500
```

## Vault Usage (IMPORTANT)

Sensitive values like:

- consul_master_token

- consul_gossip_key

are stored using Ansible Vault.

### To Run Playbook:
```
ansible-playbook -i inventory.ini site.yml --ask-vault-pass
```

### OR using password file:
```
ansible-playbook -i inventory.ini site.yml --vault-password-file vault_pass.txt
```

## 9. Best Practices Followed

- Always use minimum 3 server nodes

- Enable ACLs in production

- Use TLS encryption

- Avoid running in -dev mode in production

- Monitor health checks continuously

- Secure gossip communication

- Use proper token management

# 10. Troubleshooting
## Consul Not Starting

- Check systemd logs

```
journalctl -u consul
```
## No Leader Elected

- Ensure minimum quorum

- Verify bootstrap_expect value

- Check network connectivity

## ACL Errors

- Verify bootstrap token

- Ensure token persistence is enabled

- Check default policy

## Node Not Joining

- Verify retry_join

- Check firewall ports

- Validate bind address

# 11. Conclusion

HashiCorp Consul is a powerful service networking solution designed for modern distributed systems.

It provides:

- Reliable service discovery

- Secure service communication

- Centralized configuration

- High availability clustering

Consul simplifies infrastructure complexity and enables scalable microservices architecture.

# 12. References


| Purpose | Link |
|---------|------|
| Consul Official Documentation | https://developer.hashicorp.com/consul/docs |
| Consul Installation Guide | https://developer.hashicorp.com/consul/docs/install |
| Consul ACL Documentation | https://developer.hashicorp.com/consul/docs/security/acl |
| Consul Service Mesh Guide | https://developer.hashicorp.com/consul/docs/connect |

# 13. Author

**Author**: Annem Anitha
**Last Updated:** 25-Feb-2026

Loading