NewsBlur/ansible/roles/ansible-consul/tasks/snapshot.yml

53 lines
1.4 KiB
YAML

---
# File: snapshot.yml - Create snapshot service
# template: consul_snapshot.service
# template: consul_snapshot.config /etc/consul/
# set snaps to {{ snap storage location }}
# create snaps folder
# handler: start / enable service
# add entry to tasks/main.yml
# update readme
# update defaults/main.yml
# update my vars file
- name: Create snapshot systemd script
template:
src: consul_systemd_snapshot.service.j2
dest: /lib/systemd/system/consul_snapshot.service
owner: root
group: root
mode: 0644
register: systemd_unit
notify: start snapshot
when:
- ansible_service_mgr == "systemd"
- not ansible_os_family == "FreeBSD"
- not ansible_os_family == "Solaris"
- consul_snapshot | bool
- name: Create snapshot agent config
template:
src: consul_snapshot.json.j2
dest: "{{ consul_config_path }}/consul_snapshot.json"
owner: "{{ consul_user }}"
group: "{{ consul_group }}"
mode: 0644
notify: start snapshot
when:
- ansible_service_mgr == "systemd"
- not ansible_os_family == "FreeBSD"
- not ansible_os_family == "Solaris"
- consul_snapshot | bool
- name: Reload systemd
systemd:
daemon_reload: true
when: systemd_unit | changed
- name: Create snaps storage folder
file:
state: directory
path: "{{ consul_snapshot_storage }}"
owner: "{{ consul_user }}"
group: "{{ consul_group }}"
mode: 0744