Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add_maps #127

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst
* `haproxy_listen.{n}.default_server_params`: [optional]: Default server params applied for each server for this particular listen entry.
* `haproxy_listen.{n}.raw_options`: [default: `[]`]: Additional arbitrary lines to insert in the section

* `haproxy_map.{n}.name|value`: [optional]: Add map in /etc/haproxy/{n}.map

* `haproxy_frontend`: [default: `[]`]: Front-end declarations
* `haproxy_frontend.{n}.name`: [required]: The name of the section (e.g. `https`)
* `haproxy_frontend.{n}.description`: [optional]: A description of the section (e.g. `Front-end for all HTTPS traffic`)
Expand Down
12 changes: 12 additions & 0 deletions tasks/configuration.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# tasks file
---
- name: Generate map files from templates
template:
src: "etc/haproxy/map.map.j2"
dest: "/etc/haproxy/{{ item.key }}.map"
with_items: "{{ haproxy_map | dict2items }}"
when: haproxy_map is defined
notify:
- restart haproxy
tags:
- haproxy-configuration-update-file


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that I would prefer something like I did for the ACL's. Does that make sense?

This way you could put ACL's in an acl directory

- name: configuration | update file
template:
src: "{{ haproxy_conf_template }}"
Expand Down
3 changes: 3 additions & 0 deletions templates/etc/haproxy/map.map.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% for value in item.value %}
{{ value.name }} {{ value.value }}
{% endfor %}