27 lines
699 B
YAML
27 lines
699 B
YAML
---
|
|
- 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
|
|
|
|
- name: get consul
|
|
unarchive:
|
|
src: /tmp/consul.zip
|
|
dest: /usr/local/bin/
|
|
remote_src: True
|
|
mode: 0755
|
|
owner: root
|
|
group: staff
|
|
when: get_consul.changed
|