2022-03-07 20:22:15 +00:00
|
|
|
---
|
2022-03-08 20:07:38 +00:00
|
|
|
- name: Include OS-specific variables
|
|
|
|
include_vars: "{{ item }}"
|
|
|
|
with_first_found:
|
|
|
|
- files:
|
|
|
|
- "{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
|
|
|
|
- "{{ ansible_os_family }}.yml"
|
|
|
|
|
|
|
|
- name: install package
|
|
|
|
package:
|
|
|
|
name: "{{ consul_os_package }}"
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: apply config template
|
|
|
|
block:
|
|
|
|
- name: server template
|
|
|
|
template:
|
|
|
|
src: config.hcl.j2
|
|
|
|
dest: /etc/consul.d/config.hcl
|
|
|
|
owner: consul
|
|
|
|
mode: 644
|
|
|
|
|
|
|
|
- name: ensure service is started
|
|
|
|
systemd:
|
|
|
|
name: "{{ consul_service_name }}"
|
|
|
|
state: started
|
|
|
|
enabled: True
|