formula-traefik/traefik/install.sls

68 lines
1.6 KiB
Text
Raw Normal View History

2018-05-17 22:52:46 -04:00
{%- from slspath + '/map.jinja' import traefik with context -%}
traefik-bin-dir:
file.directory:
- name: /usr/local/bin
- makedirs: True
# Create traefik user
traefik-group:
group.present:
- name: {{ traefik.group }}
traefik-user:
user.present:
- name: {{ traefik.user }}
- groups:
- {{ traefik.group }}
- home: /etc/traefik
- createhome: False
- system: True
- require:
- group: traefik-group
# Create directories
traefik-config-dir:
file.directory:
- name: /etc/traefik
- user: {{ traefik.user }}
- group: {{ traefik.group }}
- mode: 0750
# Install agent
traefik-download:
file.managed:
- name: /tmp/traefik-{{ traefik.version }}
2018-05-17 23:04:59 -04:00
- source: https://{{ traefik.download_host }}/containous/traefik/releases/download/v{{ traefik.version }}/traefik_linux-{{ traefik.arch }}
2018-05-17 23:03:51 -04:00
- skip_verify: True
2018-05-17 22:52:46 -04:00
- mode: 0755
- unless: test -f /usr/local/bin/traefik-{{ traefik.version }}
traefik-install:
file.rename:
- name: /usr/local/bin/traefik-{{ traefik.version }}
- source: /tmp/traefik-{{ traefik.version }}
- require:
- file: /usr/local/bin
- watch:
- file: traefik-download
traefik-clean:
file.absent:
- name: /tmp/traefik-{{ traefik.version }}
- watch:
- file: traefik-install
traefik-link:
file.symlink:
- target: traefik-{{ traefik.version }}
- name: /usr/local/bin/traefik
- watch:
- file: traefik-install
traefik-setcap:
cmd.run:
- name: "setcap cap_net_bind_service=+ep /usr/local/bin/traefik-{{ traefik.version }}"
- onchanges:
- file: traefik-install