File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ {% from " haproxy/map.jinja" import haproxy with context % }
2+
3+ {% set config_file = salt[' pillar.get' ](' haproxy:config_file_path' , haproxy.config_file) % }
14haproxy.config:
25 file .managed:
3- - name: {{ salt[ ' pillar.get ' ]( ' haproxy:config_file_path ' , ' /etc/haproxy/haproxy.cfg ' ) }}
4- - source: salt:// haproxy/templates/haproxy.jinja
6+ - name: {{ config_file }}
7+ - source: {{ haproxy.config_file_source }}
58 - template: jinja
6- - user: root
7- {% if salt[' grains.get' ](' os_family' ) == ' FreeBSD' %}
8- - group: wheel
9- {% else %}
10- - group: root
11- {% endif %}
9+ - user: {{ haproxy.user }}
10+ - group: {{ haproxy.group }}
1211 - mode: 644
1312 - require_in:
1413 - service: haproxy.service
1514 - watch_in:
1615 - service: haproxy.service
1716 {% if salt[' pillar.get' ](' haproxy:overwrite' , default = True ) == False % }
1817 - unless:
19- - test -e {{ salt[ ' pillar.get ' ]( ' haproxy:config_file_path ' , ' /etc/haproxy/haproxy.cfg ' ) }}
18+ - test - e {{ config_file }}
2019 {% endif % }
Original file line number Diff line number Diff line change 1+ {% from " haproxy/map.jinja" import haproxy with context % }
2+
13haproxy.install:
24 pkg.installed:
3- - name: haproxy
5+ - name: {{ haproxy.package }}
46{% if salt[' pillar.get' ](' haproxy:require' ) % }
57 - require:
68{% for item in salt[' pillar.get' ](' haproxy:require' ) % }
Original file line number Diff line number Diff line change 1+ {% set haproxy = salt ['grains.filter_by' ]({
2+ 'default' : {
3+ 'package' : 'haproxy' ,
4+ 'config_file' : '/etc/haproxy/haproxy.cfg' ,
5+ 'config_file_source' : 'salt://haproxy/templates/haproxy.jinja' ,
6+ 'user' : 'root' ,
7+ 'group' : 'root' ,
8+ 'service' : 'haproxy' ,
9+ },
10+ 'FreeBSD' : {
11+ 'group' : 'wheel' ,
12+ },
13+ }, merge =salt ['pillar.get' ]('haproxy:lookup' ), base ='default' ) %}
14+
Original file line number Diff line number Diff line change 1+ {% from " haproxy/map.jinja" import haproxy with context % }
2+
13haproxy.service:
24{% if salt[' pillar.get' ](' haproxy:enable' , True ) % }
35 service.running:
4- - name: haproxy
6+ - name: {{ haproxy.service }}
57 - enable: True
68 - reload : True
79 - require:
Original file line number Diff line number Diff line change 33#
44
55haproxy:
6+ # use lookup section to override 'map.jinja' values
7+ #lookup:
8+ #user: 'custom-user'
9+ #group: 'custom-group'
10+ # new setting to override configuration file path
11+ #config_file: /etc/haproxy/haproxy.cfg
612 enabled: True
713 overwrite: True # Overwrite an existing config file if present (default behaviour unless set to false)
8- config_file_path: /etc/haproxy/haproxy.cfg
14+ # old setting to override configuration file path, kept for compatibility
15+ #config_file_path: /etc/haproxy/haproxy.cfg
916 global:
1017 log:
1118 - 127.0.0.1 local2
You can’t perform that action at this time.
0 commit comments