--- - name: Consul User user: name: consul comment: "Consul User" shell: /bin/bash state: present - name: Ensure Consul Download Dir exists file: path: "{{cloud_consul_download_dir}}" mode: 0755 state: directory tags: - install - name: Consul Download get_url: url: "https://releases.hashicorp.com/consul/{{cloud_consul_version}}/consul_{{cloud_consul_version}}_linux_amd64.zip" dest: "{{cloud_consul_download_dir}}/{{cloud_consul_version}}_linux_amd64.zip" tags: - install - name: Consul UI Download get_url: url: "https://releases.hashicorp.com/consul/{{cloud_consul_version}}/consul_{{cloud_consul_version}}_web_ui.zip" dest: "{{cloud_consul_download_dir}}/{{cloud_consul_version}}_web_ui.zip" tags: - install when: cloud_consul_version | version_compare('1.2', '<') - name: Ensure Consul Install Dir exists file: path: "{{cloud_consul_install_dir}}" mode: 0755 state: directory tags: - install - name: Ensure Consul App Dirs exist file: > path="{{cloud_consul_install_dir}}/{{item}}" owner=consul group=consul mode=0755 state=directory with_items: - etc - data - bin - log - ui tags: - install - name: Unzip Consul unarchive: src: "{{cloud_consul_download_dir}}/{{cloud_consul_version}}_linux_amd64.zip" dest: "{{cloud_consul_install_dir}}/bin" remote_src: True tags: - install - name: Unzip Consul UI unarchive: src: "{{cloud_consul_download_dir}}/{{cloud_consul_version}}_web_ui.zip" dest: "{{cloud_consul_install_dir}}/ui" remote_src: True tags: - install when: cloud_consul_version | version_compare('1.2', '<') - name: ensures consul command has the right permissions file: path: "{{cloud_consul_install_dir}}/bin/consul" owner: root group: root mode: 0755 state: file