Skip to content

Commit

Permalink
fix path and make ubuntu 14.04 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
ahelal authored Aug 16, 2017
1 parent 460a32a commit 52be9eb
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 23 deletions.
30 changes: 19 additions & 11 deletions tasks/install/consul-agent.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
---

- name: install | consul agent | Check target file
stat:
path="{{ consul_bin_dir }}/consul"
register: consul_agent_target_link

- name: install | consul agent | Remove target file (if not symlink)
file:
path="{{ consul_bin_dir }}/consul"
state="absent"
when: not consul_agent_target_link.stat.islnk is defined or not consul_agent_target_link.stat.islnk

- name: install | consul agent | Check agent binary
stat:
path="{{ consul_bin_dir }}/consul-{{consul_agent_version}}"
Expand All @@ -28,14 +17,33 @@
dest="{{ consul_tmp_dir }}/consul-{{ consul_agent_version }}/"
copy=false
owner="{{ consul_user }}"
register: agent_download
ignore_errors: true
when: not consul_agent_version_binary.stat.exists

- name: install | consul agent | Download and unpack consul archive (if needed with curl)
shell: |
curl {{ consul_agent_download_url }} -o {{ consul_tmp_dir }}/consul-{{ consul_agent_version }}/consul.zip
unzip {{ consul_tmp_dir }}/consul-{{ consul_agent_version }}/consul.zip -d {{ consul_tmp_dir }}/consul-{{ consul_agent_version }}/
when: agent_download | failed

- name: install | consul agent | link binary (if needed)
command: mv {{ consul_tmp_dir }}/consul-{{ consul_agent_version }}/consul {{ consul_bin_dir }}/consul-{{consul_agent_version}}
when: not consul_agent_version_binary.stat.exists
notify:
- restart consul service

- name: install | consul agent | Check target file
stat:
path="{{ consul_bin_dir }}/consul"
register: consul_agent_target_link

- name: install | consul agent | Remove target file (if not symlink)
file:
path="{{ consul_bin_dir }}/consul"
state="absent"
when: not consul_agent_target_link.stat.islnk is defined or not consul_agent_target_link.stat.islnk

- name: install | consul agent | Consul link binary
file:
src="{{ consul_bin_dir }}/consul-{{consul_agent_version}}"
Expand Down
32 changes: 20 additions & 12 deletions tasks/install/consul-template.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
---

- name: install | consul template | Check target file
stat:
path="{{ consul_bin_dir }}/consul-template"
register: consul_template_target_link

- name: install | consul template | Remove target file (if not symlink)
file:
path="{{ consul_bin_dir }}/consul-template"
state="absent"
when: not consul_template_target_link.stat.islnk is defined or not consul_template_target_link.stat.islnk

- name: install | consul template | Check template binary
stat:
path="{{ consul_tmp_dir }}/consul-template-{{ consul_template_version }}"
path="{{ consul_bin_dir }}/consul-template-{{ consul_template_version }}"
register: consul_template_version_binary

- name: install | consul template | Ensure download directory exists
Expand All @@ -28,14 +17,33 @@
dest="{{ consul_tmp_dir }}/consul-template-{{ consul_template_version }}"
copy=false
owner="{{ consul_user }}"
register: template_download
ignore_errors: true
when: not consul_template_version_binary.stat.exists

- name: install | consul template | Download and unpack consul archive (if needed with curl)
shell: |
curl -s {{ consul_template_download_url }} -o {{ consul_tmp_dir }}/consul-template-{{ consul_template_version }}/consul-template.zip
unzip {{ consul_tmp_dir }}/consul-template-{{ consul_template_version }}/consul-template.zip -d {{ consul_tmp_dir }}/consul-template-{{ consul_template_version }}/
when: template_download | failed

- name: install | consul template | link binary (if needed)
command: mv {{ consul_tmp_dir }}/consul-template-{{ consul_template_version }}/consul-template {{ consul_bin_dir }}/consul-template-{{consul_template_version}}
when: not consul_template_version_binary.stat.exists
notify:
- restart consul service

- name: install | consul template | Check target file
stat:
path="{{ consul_bin_dir }}/consul-template"
register: consul_template_target_link

- name: install | consul template | Remove target file (if not symlink)
file:
path="{{ consul_bin_dir }}/consul-template"
state="absent"
when: not consul_template_target_link.stat.islnk is defined or not consul_template_target_link.stat.islnk

- name: install | consul template | Consul template link binary
file:
src="{{ consul_bin_dir }}/consul-template-{{ consul_template_version }}"
Expand Down

0 comments on commit 52be9eb

Please sign in to comment.