Skip to content

Commit

Permalink
Merge pull request #22 from kibatic/traefik_update
Browse files Browse the repository at this point in the history
Allow to update traefik binary
  • Loading branch information
eliecharra authored Jun 30, 2017
2 parents 9084536 + f874a10 commit 7819aa2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ Add role to your playbook.
- { role: kibatic.traefik, tags: traefik }
```

Update Traefik
--------------

You have to change `traefik_binary_url` or update this role. Then run your playbook
with following **extra vars** :

```bash
$ ansible-playbook playbook.yml -t traefik --extra-vars "traefik_update=yes"
```

Use same command if you want to downgrade.

License
-------

Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ traefik_config_file: /etc/traefik.toml
traefik_template: traefik.toml
traefik_systemd_unit_template: traefik.service
traefik_systemd_unit_dest: /etc/systemd/system/traefik.service
traefik_update: no
28 changes: 18 additions & 10 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,35 @@
with_items:
- "{{ traefik_install_dir }}"

- name: Copy traefik config file
template:
src: "{{ traefik_template }}.j2"
dest: "{{ traefik_config_file }}"
owner: root
group: root
mode: 0744
notify:
- Restart traefik

- name: Ensure traefik service is stopped before traefik update
service:
name: traefik
state: stopped
enabled: yes
when: traefik_update == "yes"

- name: Download Traefik binary
get_url:
url: "{{ item.url }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: 0755
force: "{{ traefik_update }}"
with_items:
- url: "{{ traefik_binary_url }}"
dest: "{{ traefik_bin_path }}"

- name: Copy traefik config file
template:
src: "{{ traefik_template }}.j2"
dest: "{{ traefik_config_file }}"
owner: root
group: root
mode: 0744
notify:
- Restart traefik

- name: Ensure traefik service is enabled and running
service:
name: traefik
Expand Down

0 comments on commit 7819aa2

Please sign in to comment.