Skip to content

Commit

Permalink
Merge pull request #74 from asosso/master
Browse files Browse the repository at this point in the history
Overriding configuration template
  • Loading branch information
tersmitten authored Mar 7, 2018
2 parents 2015fc1 + f9fe343 commit 9c39efe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,16 @@ None
- backup
```
## Overriding configuration template
If you can't customize via variables because an option isn't exposed, you can override the template used to generate the haproxy configuration file.
```yaml
haproxy_conf_template: "etc/haproxy/haproxy.cfg.j2"
```
You can either copy and modify the provided template, or extend it with [Jinja2 template inheritance](http://jinja.pocoo.org/docs/2.9/templates/#template-inheritance) and override the specific template block you need to change.
#### License
MIT
Expand Down
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ haproxy_dependencies:
state: latest
haproxy_install: []

haproxy_conf_template: "etc/haproxy/haproxy.cfg.j2"

# global section
haproxy_global_log:
- address: /dev/log
Expand Down
2 changes: 1 addition & 1 deletion tasks/configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
---
- name: configuration | update file
template:
src: etc/haproxy/haproxy.cfg.j2
src: "{{ haproxy_conf_template }}"
dest: /etc/haproxy/haproxy.cfg
owner: root
group: root
Expand Down

0 comments on commit 9c39efe

Please sign in to comment.