Add HashiCorp deployment
This commit is contained in:
@@ -0,0 +1,58 @@
|
|||||||
|
---
|
||||||
|
# Deploy Consul + Nomad cluster
|
||||||
|
# Run: ansible-playbook -i inventory/hosts.yml playbooks/deploy-hashicorp.yml
|
||||||
|
|
||||||
|
- name: Deploy Consul cluster
|
||||||
|
hosts: hashicorp
|
||||||
|
become: yes
|
||||||
|
roles:
|
||||||
|
- consul
|
||||||
|
tags:
|
||||||
|
- consul
|
||||||
|
|
||||||
|
- name: Deploy Nomad cluster
|
||||||
|
hosts: hashicorp
|
||||||
|
become: yes
|
||||||
|
roles:
|
||||||
|
- nomad
|
||||||
|
tags:
|
||||||
|
- nomad
|
||||||
|
|
||||||
|
- name: Display cluster status
|
||||||
|
hosts: consul_servers
|
||||||
|
become: yes
|
||||||
|
tasks:
|
||||||
|
- name: Check Consul members
|
||||||
|
command: consul members
|
||||||
|
register: consul_members
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Check Nomad server members
|
||||||
|
command: nomad server members
|
||||||
|
register: nomad_members
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Check Nomad node status
|
||||||
|
command: nomad node status
|
||||||
|
register: nomad_nodes
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Display Consul cluster status
|
||||||
|
debug:
|
||||||
|
msg: "{{ consul_members.stdout_lines }}"
|
||||||
|
|
||||||
|
- name: Display Nomad server status
|
||||||
|
debug:
|
||||||
|
msg: "{{ nomad_members.stdout_lines }}"
|
||||||
|
|
||||||
|
- name: Display Nomad node status
|
||||||
|
debug:
|
||||||
|
msg: "{{ nomad_nodes.stdout_lines }}"
|
||||||
|
|
||||||
|
- name: Display access URLs
|
||||||
|
debug:
|
||||||
|
msg:
|
||||||
|
- "Consul UI: http://{{ ansible_host }}:8500"
|
||||||
|
- "Nomad UI: http://{{ ansible_host }}:4646"
|
||||||
|
tags:
|
||||||
|
- status
|
||||||
Reference in New Issue
Block a user