2018-05-17 17:36:29 -04:00
|
|
|
{%- from slspath + '/map.jinja' import fabio with context -%}
|
|
|
|
|
|
|
|
fabio-bin-dir:
|
|
|
|
file.directory:
|
|
|
|
- name: /usr/local/bin
|
|
|
|
- makedirs: True
|
|
|
|
|
|
|
|
# Create fabio user
|
|
|
|
fabio-group:
|
|
|
|
group.present:
|
|
|
|
- name: {{ fabio.group }}
|
|
|
|
|
|
|
|
fabio-user:
|
|
|
|
user.present:
|
|
|
|
- name: {{ fabio.user }}
|
|
|
|
- groups:
|
|
|
|
- {{ fabio.group }}
|
2018-05-17 21:35:09 -04:00
|
|
|
- home: {{ salt['user.info'](fabio.user)['home']|default(fabio.data_dir) }}
|
2018-05-17 17:36:29 -04:00
|
|
|
- createhome: False
|
|
|
|
- system: True
|
|
|
|
- require:
|
|
|
|
- group: fabio-group
|
|
|
|
|
|
|
|
# Create directories
|
|
|
|
fabio-config-dir:
|
|
|
|
file.directory:
|
|
|
|
- name: /etc/fabio
|
|
|
|
- user: {{ fabio.user }}
|
|
|
|
- group: {{ fabio.group }}
|
|
|
|
- mode: 0750
|
|
|
|
|
|
|
|
fabio-data-dir:
|
|
|
|
file.directory:
|
2018-05-17 21:35:09 -04:00
|
|
|
- name: {{ fabio.data_dir }}
|
2018-05-17 17:36:29 -04:00
|
|
|
- makedirs: True
|
|
|
|
- user: {{ fabio.user }}
|
|
|
|
- group: {{ fabio.group }}
|
|
|
|
- mode: 0750
|
|
|
|
|
|
|
|
# Install agent
|
|
|
|
fabio-download:
|
|
|
|
file.managed:
|
|
|
|
- name: /tmp/fabio-{{ fabio.version }}
|
2018-05-17 18:36:34 -04:00
|
|
|
- source: https://{{ fabio.download_host }}/fabiolb/fabio/releases/download/v{{ fabio.version }}/fabio-{{ fabio.version }}-go{{ fabio.goversion }}-linux_{{ fabio.arch }}
|
2018-05-17 17:36:29 -04:00
|
|
|
- source_hash: https://github.com/fabiolb/fabio/releases/download/v{{ fabio.version }}/fabio-{{ fabio.version }}-go{{ fabio.goversion }}.sha256
|
2018-05-17 19:16:38 -04:00
|
|
|
- mode: 0755
|
2018-05-17 17:36:29 -04:00
|
|
|
- unless: test -f /usr/local/bin/fabio-{{ fabio.version }}
|
|
|
|
|
|
|
|
fabio-install:
|
|
|
|
file.rename:
|
|
|
|
- name: /usr/local/bin/fabio-{{ fabio.version }}
|
|
|
|
- source: /tmp/fabio-{{ fabio.version }}
|
|
|
|
- require:
|
|
|
|
- file: /usr/local/bin
|
|
|
|
- watch:
|
|
|
|
- file: fabio-download
|
2018-05-17 19:16:38 -04:00
|
|
|
|
2018-05-17 17:36:29 -04:00
|
|
|
fabio-clean:
|
|
|
|
file.absent:
|
|
|
|
- name: /tmp/fabio-{{ fabio.version }}
|
|
|
|
- watch:
|
|
|
|
- file: fabio-install
|
|
|
|
|
|
|
|
fabio-link:
|
|
|
|
file.symlink:
|
|
|
|
- target: fabio-{{ fabio.version }}
|
|
|
|
- name: /usr/local/bin/fabio
|
|
|
|
- watch:
|
|
|
|
- file: fabio-install
|
2018-05-17 19:16:38 -04:00
|
|
|
|
|
|
|
fabio-setcap:
|
|
|
|
cmd.run:
|
|
|
|
- name: "setcap cap_net_bind_service=+ep /usr/local/bin/fabio-{{ fabio.version }}"
|
|
|
|
- onchanges:
|
|
|
|
- file: fabio-install
|