diff --git a/README.md b/README.md index 597d943..ebf4285 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Basic traefik configuration ``` - src: git+git@github.com:smartlogic/ansible-role-traefik name: traefik - version: 0.1.0 + version: 0.2.0 ``` ## Requirements @@ -17,6 +17,7 @@ None ## Role Variables - `traefik_version` - Which version of traefik to download +- `traefik_checksum` - The sha256 checksum of the traefik download - `traefik_config` - The file to use for `config.toml` - Default: `config.toml` diff --git a/defaults/main.yml b/defaults/main.yml index 603f708..4b48cd7 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,3 +1,4 @@ --- -traefik_version: 1.4.1 +traefik_version: 1.5.0 +traefik_checksum: f5bad64d95377a890f7e04640f6356df41c7c196b317a0f8f76a952979dbea50 traefik_config: "config.toml" diff --git a/tasks/main.yml b/tasks/main.yml index 4922db1..cd676ab 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -5,11 +5,19 @@ mode: 0755 become: yes +- name: "Create traefik version folder" + file: + path: "/opt/traefik/{{ traefik_version }}" + state: directory + mode: 0755 + become: yes + - name: "Download traefik" get_url: url: "https://github.com/containous/traefik/releases/download/v{{ traefik_version }}/traefik_linux-amd64" - dest: "/opt/traefik/traefik" + dest: "/opt/traefik/{{ traefik_version }}/traefik" mode: 0755 + checksum: "sha256:{{ traefik_checksum }}" become: yes - name: Copy config.yml diff --git a/templates/traefik.service.j2 b/templates/traefik.service.j2 index e09bcfe..c8a5737 100644 --- a/templates/traefik.service.j2 +++ b/templates/traefik.service.j2 @@ -5,7 +5,7 @@ After=network-online.target [Service] Restart=on-failure WorkingDirectory=/opt/traefik -ExecStart=/opt/traefik/traefik --configfile=/opt/traefik/config.toml +ExecStart=/opt/traefik/{{ traefik_version }}/traefik --configfile=/opt/traefik/config.toml [Install] WantedBy=multi-user.target