Initial IaC setup: Nomad, Consul, Terraform, Ansible

- Ansible roles for Nomad and Consul installation
- Nomad job specs for Traefik and monitoring stack
- Terraform configuration for Nomad job management
- Enterprise naming convention inventory
- HashiCorp stack deployment playbook
This commit is contained in:
2026-02-04 08:52:08 -06:00
commit 3d3c1af237
15 changed files with 998 additions and 0 deletions
+56
View File
@@ -0,0 +1,56 @@
---
# Consul Installation Role
- name: Add HashiCorp GPG key
ansible.builtin.apt_key:
url: https://apt.releases.hashicorp.com/gpg
state: present
- name: Add HashiCorp repository
ansible.builtin.apt_repository:
repo: "deb https://apt.releases.hashicorp.com {{ ansible_distribution_release }} main"
state: present
filename: hashicorp
- name: Install Consul
ansible.builtin.apt:
name: "consul={{ consul_version }}-1"
state: present
update_cache: yes
- name: Create Consul directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: consul
group: consul
mode: '0755'
loop:
- "{{ consul_data_dir }}"
- "{{ consul_data_dir }}/data"
- /etc/consul.d
- name: Configure Consul
ansible.builtin.template:
src: consul.hcl.j2
dest: /etc/consul.d/consul.hcl
owner: consul
group: consul
mode: '0640'
notify: Restart Consul
- name: Configure Consul server (if server)
ansible.builtin.template:
src: server.hcl.j2
dest: /etc/consul.d/server.hcl
owner: consul
group: consul
mode: '0640'
when: consul_server | default(false)
notify: Restart Consul
- name: Enable and start Consul
ansible.builtin.systemd:
name: consul
enabled: yes
state: started