Skip to content

Commit

Permalink
Merge pull request #55 from InversoGmbH/feature/custom-template
Browse files Browse the repository at this point in the history
Allow to override the default haproxy.cfg.j2 template
  • Loading branch information
geerlingguy authored Jun 5, 2024
2 parents a4044c7 + 947f709 commit bfb9ae1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ HAProxy default timeout configurations.

A list of extra global variables to add to the global configuration section inside `haproxy.cfg`.

## Not happy with the packaged haproxy.cfg.j2 template? Make your own !

The haproxy.cfg.j2 template packaged with this role may not allow you to make all needed configurations.
Allowing to set every posisble haproxy.cfg in there.

If the default template does not suit your needs, you can replace it with yours. What you need to do:
* create a `templates` directory at the same level as your playbook
* create a `templates\haproxy.cfg.j2` file (just choose a different name from the default template)
* in your playbook set the var `haproxy_template: haproxy.cfg.j2`


## Dependencies

None.
Expand Down
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ haproxy_global_vars: []
haproxy_connect_timeout: 5000
haproxy_client_timeout: 50000
haproxy_server_timeout: 50000

haproxy_template: "haproxy.cfg.j2"
2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

- name: Copy HAProxy configuration in place.
template:
src: haproxy.cfg.j2
src: '{{ haproxy_template }}'
dest: /etc/haproxy/haproxy.cfg
mode: 0644
validate: haproxy -f %s -c -q
Expand Down

0 comments on commit bfb9ae1

Please sign in to comment.