2020-08-20 04:02:35 +00:00
|
|
|
---
|
2020-08-20 05:11:33 +00:00
|
|
|
- name: check consul version
|
|
|
|
shell:
|
|
|
|
cmd: "consul --version | head -1 | cut -d'v' -f2"
|
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
|
|
|
changed_when: False
|
|
|
|
failed_when: False
|
|
|
|
register: installed_consul_version
|
|
|
|
|
|
|
|
- name: get consul
|
|
|
|
get_url:
|
|
|
|
url: "https://releases.hashicorp.com/consul/{{ consul_version }}/consul_{{ consul_version }}_freebsd_amd64.zip"
|
|
|
|
dest: /tmp/consul.zip
|
|
|
|
when: ("No such file" not in installed_consul_version.msg) or (installed_consul_version.msg != consul_version)
|
|
|
|
register: get_consul
|
|
|
|
|
2020-08-20 04:02:35 +00:00
|
|
|
- name: get consul
|
|
|
|
unarchive:
|
2020-08-20 05:11:33 +00:00
|
|
|
src: /tmp/consul.zip
|
|
|
|
dest: /usr/local/bin/
|
|
|
|
remote_src: True
|
|
|
|
mode: 0755
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
when: get_consul.changed
|