Added consul playbook and handler

This commit is contained in:
Eric Renfro 2022-03-01 14:52:40 -05:00
parent 62ba932e06
commit df9e133e0a
Signed by: psi-jack
GPG Key ID: 14977F3A50D9A5BF
3 changed files with 38 additions and 1 deletions

View File

@ -26,7 +26,7 @@ description: DebOps HashiCorp Collection
# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only
# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file'
license:
- GPL-2.0-or-later
- GPL-3.0-or-later
# The path to the license file for the collection. This path is relative to the root of the collection. This key is
# mutually exclusive with 'license'

31
playbooks/consul.yml Normal file
View File

@ -0,0 +1,31 @@
---
- name: Manage Consul Servers
hosts: debops_service_consul_servers
tags: ['role::consul', 'role::consul:server', 'skip::consul' ]
serial: 1
become: True
environment: '{{ inventory__environment | d({})
| combine(inventory__group_environment | d({}))
| combine(inventory__host_environment | d({})) }}'
roles:
- role: consul
tags: [ 'role::consul', 'skip::consul' ]
- name: Manage Consul Agents
hosts: [ 'all', '!debops_service_consul_servers' ]
tags: [ 'role::consul', 'role::consul:agent', 'skip::consul' ]
serial:
- 1
- 3
- 5
become: True
environment: '{{ inventory__environment | d({})
| combine(inventory__group_environment | d({}))
| combine(inventory__host_environment | d({})) }}'
roles:
- role: consul
tags: [ 'role::consul', 'skip::consul' ]

View File

@ -0,0 +1,6 @@
---
- name: Restart consul
service:
name: consul
state: restarted
when: manage_consul_service | default(False)