--- - name: Deploy systemd service unit template: src=consul.service.j2 dest=/etc/systemd/system/consul.service register: consul_unit notify: restart consul tags: consul - name: Deploy consul service wrapper template: src=consul.sh.j2 dest={{ consul_root_dir }}/bin/consul mode=755 notify: restart consul tags: consul - name: Install backup hooks template: src={{ item }}-backup.j2 dest=/etc/backup/{{ item }}.d/consul mode=755 loop: - pre - post tags: consul - name: Create tmpfiles fragment copy: content: | d /run/consul 770 root {{ consul_user }} dest: /etc/tmpfiles.d/consul.conf register: consul_tmpfiles tags: consul - name: Create tmpfiles command: systemd-tmpfiles --create when: consul_tmpfiles.changed tags: consul - name: Install vault agent unit file template: src=vault/agent.service.j2 dest=/etc/systemd/system/consul-vault-agent.service register: consul_vault_agent_unit notify: restart consul-vault-agent tags: consul - name: Reload systemd systemd: daemon_reload=True when: consul_unit.changed or consul_vault_agent_unit.changed tags: consul