Added configuration handler.
This commit is contained in:
parent
8b2e00a5e2
commit
25ee8ba480
7 changed files with 31 additions and 7 deletions
|
@ -1,5 +1,22 @@
|
|||
{%- from slspath + '/map.jinja' import fabio with context -%}
|
||||
|
||||
fabio-config:
|
||||
file.managed:
|
||||
- name: {{ fabio.config_file }}
|
||||
- source: salt://{{ slspath }}/files/fabio.cfg
|
||||
- context:
|
||||
config: {{ fabio.config }}
|
||||
- template: jinja
|
||||
- user: {{ fabio.user}}
|
||||
- group: {{ fabio.group }}
|
||||
- mode: 0640
|
||||
- require:
|
||||
- user: fabio-user
|
||||
{%- if fabio.service %}
|
||||
- watch_in:
|
||||
- service: fabio
|
||||
{%- endif %}
|
||||
|
||||
{#
|
||||
fabio-config:
|
||||
file.serialize:
|
||||
|
|
|
@ -8,6 +8,9 @@ fabio:
|
|||
user: fabio
|
||||
group: fabio
|
||||
|
||||
config_file: /etc/fabio/fabio.cfg
|
||||
consul_address: localhost:8500
|
||||
data_dir: /var/fabio
|
||||
|
||||
config:
|
||||
consul_address: localhost:8500
|
||||
data_dir: /var/fabio
|
||||
proxy.addr: :80,:9999
|
||||
|
|
3
fabio/files/fabio.cfg
Normal file
3
fabio/files/fabio.cfg
Normal file
|
@ -0,0 +1,3 @@
|
|||
{%- for key, val in config.iteritems() %}
|
||||
{{ key }} = {{ val }}
|
||||
{%- endfor %}
|
|
@ -5,7 +5,7 @@ After=network.target
|
|||
|
||||
[Service]
|
||||
EnvironmentFile=-/etc/{% if grains['os_family'] == 'Debian' %}default{% else %}sysconfig{% endif %}/fabio
|
||||
ExecStart=/usr/local/bin/fabio -registry.consul.addr {{ consul_address }}
|
||||
ExecStart=/usr/local/bin/fabio -cfg {{ config_file }} -registry.consul.addr {{ consul_address }}
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
User={{ user }}
|
||||
Group={{ group }}
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
|
||||
include:
|
||||
- {{ slspath }}.install
|
||||
{# - {{ slspath }}.config #}
|
||||
- {{ slspath }}.config
|
||||
- {{ slspath }}.service
|
||||
|
|
|
@ -15,7 +15,7 @@ fabio-user:
|
|||
- name: {{ fabio.user }}
|
||||
- groups:
|
||||
- {{ fabio.group }}
|
||||
- home: {{ salt['user.info'](fabio.user)['home']|default(fabio.config.data_dir) }}
|
||||
- home: {{ salt['user.info'](fabio.user)['home']|default(fabio.data_dir) }}
|
||||
- createhome: False
|
||||
- system: True
|
||||
- require:
|
||||
|
@ -31,7 +31,7 @@ fabio-config-dir:
|
|||
|
||||
fabio-data-dir:
|
||||
file.directory:
|
||||
- name: {{ fabio.config.data_dir }}
|
||||
- name: {{ fabio.data_dir }}
|
||||
- makedirs: True
|
||||
- user: {{ fabio.user }}
|
||||
- group: {{ fabio.group }}
|
||||
|
|
|
@ -26,7 +26,8 @@ fabio-init-file:
|
|||
- context:
|
||||
user: {{ fabio.user }}
|
||||
group: {{ fabio.group }}
|
||||
consul_address: {{ fabio.config.consul_address }}
|
||||
config_file: {{ fabio.config_file }}
|
||||
consul_address: {{ fabio.consul_address }}
|
||||
- mode: 0644
|
||||
{%- elif salt['test.provider']('service') == 'upstart' %}
|
||||
- source: salt://{{ slspath }}/files/fabio.upstart
|
||||
|
|
Loading…
Reference in a new issue