--- - name: check linux version debug: var: ansible_os_family - name: create dirs file: path={{ item }} state=directory loop: "{{ dest_dirs }}" - name: copy consul .service copy: src=consul.service dest=/etc/systemd/system/consul.service notify: - restart consul - name: copy consul exec copy: src=consul dest=/usr/local/bin/ mode=0755 notify: - restart consul - name: generate consul config template: src=config_server.j2 dest=/etc/consul.d/config.json notify: - restart consul - name: enable and start consul service: name=consul state=started enabled=yes