ansible-consul/tasks/main.yml

34 lines
755 B
YAML
Raw Normal View History

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
2022-03-10 10:33:53 +00:00
- name: encure data dir exist
file:
state: directory
owner: consul
path: "{{ consul_data_dir }}"
2022-03-11 09:56:14 +00:00
mode: 0755
2022-03-10 10:33:53 +00:00
2022-03-08 20:07:38 +00:00
- name: apply config template
block:
- name: server template
template:
src: config.hcl.j2
dest: /etc/consul.d/config.hcl
owner: consul
2022-03-11 09:56:14 +00:00
mode: 0644
2022-03-08 20:07:38 +00:00
- name: ensure service is started
systemd:
name: "{{ consul_service_name }}"
state: started
enabled: True