From 4d152b4b8d4cf4adb907bf4426f0158cf4dc77fa Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Tue, 30 Nov 2021 10:55:43 +0100 Subject: [PATCH] Cleanup --- .ansible-lint | 1 + .github/workflows/ci.yml | 2 -- README.md | 28 ++++++++++++++------------- templates/etc/haproxy/backend.cfg.j2 | 2 +- templates/etc/haproxy/cache.cfg.j2 | 4 +--- templates/etc/haproxy/frontend.cfg.j2 | 2 +- templates/etc/haproxy/listen.cfg.j2 | 2 +- templates/etc/haproxy/program.cfg.j2 | 4 +--- 8 files changed, 21 insertions(+), 24 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index 148ddda..6b9b391 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,3 +1,4 @@ --- warn_list: - '106' + - ignore-errors diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5f87e89..e41277f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,8 +42,6 @@ jobs: fail-fast: false matrix: include: - - distro: ubuntu1604 - ansible-version: '>=2.8, <2.9' - distro: ubuntu1604 ansible-version: '>=2.9, <2.10' - distro: ubuntu1604 diff --git a/README.md b/README.md index b5cc6f9..4474d94 100644 --- a/README.md +++ b/README.md @@ -118,8 +118,8 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst * `haproxy_listen.{n}.capture.name`: [required]: Name of the header or cookie to capture * `haproxy_listen.{n}.capture.length`: [required]: Maximum number of characters to capture and report in the logs * `haproxy_listen.{n}.filter`: [optional]: Content filters to apply to this section -* `haproxy_listen.{n}.filter.{n}.name`: [required]: The filter to apply -* `haproxy_listen.{n}.filter.{n}.params`: [optional]: Parameters for the filter +* `haproxy_listen.{n}.filter.{n}.name`: [required]: The name of the filter +* `haproxy_listen.{n}.filter.{n}.param`: [default: `[]`]: Parameters for the filter * `haproxy_listen.{n}.http_request`: [optional]: Access control for Layer 7 requests * `haproxy_listen.{n}.http_request.{n}.action`: [required]: The rules action (e.g. `add-header`) * `haproxy_listen.{n}.http_request.{n}.param`: [optional]: The complete line to be added (e.g. `X-Forwarded-Proto https`) @@ -230,8 +230,9 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst * `haproxy_frontend.{n}.capture.type`: [required]: What to capture (`cookie`, `request header`, `response header`) * `haproxy_frontend.{n}.capture.name`: [required]: Name of the header or cookie to capture * `haproxy_frontend.{n}.capture.length`: [required]: Maximum number of characters to capture and report in the logs -* `haproxy_frontend.{n}.filter`: [optional]: Dictionary of content filters to apply to this section -* `haproxy_frontend.{n}.filter.{name}`: [required]: One or more filter `name: param` entries to apply +* `haproxy_frontend.{n}.filter`: [optional]: Content filters to apply to this section +* `haproxy_frontend.{n}.filter.{n}.name`: [required]: The name of the filter +* `haproxy_frontend.{n}.filter.{n}.param`: [default: `[]`]: Parameters for the filter * `haproxy_frontend.{n}.http_request`: [optional]: Access control for Layer 7 requests * `haproxy_frontend.{n}.http_request.{n}.action`: [required]: The rules action (e.g. `add-header`) * `haproxy_frontend.{n}.http_request.{n}.param`: [optional]: The complete line to be added (e.g. `X-Forwarded-Proto https`) @@ -355,8 +356,9 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst * `haproxy_backend.{n}.rspirep.{n}.string`: [required]: The complete line to be added. Any space or known delimiter must be escaped using a backslash (`'\'`) (in version < 1.6) * `haproxy_backend.{n}.rspirep.{n}.cond`: [optional]: Matching condition built from ACLs * `haproxy_backend.{n}.cookie`: [optional]: Enable cookie-based persistence in a backend (e.g. `JSESSIONID prefix nocache`) -* `haproxy_backend.{n}.filter`: [optional]: Dictionary of content filters to apply to this section -* `haproxy_backend.{n}.filter.{name}`: [required]: One or more filter `name: param` entries to apply +* `haproxy_backend.{n}.filter`: [optional]: Content filters to apply to this section +* `haproxy_backend.{n}.filter.{n}.name`: [required]: The name of the filter +* `haproxy_backend.{n}.filter.{n}.param`: [default: `[]`]: Parameters for the filter * `haproxy_backend.{n}.http_request`: [optional]: Access control for Layer 7 requests * `haproxy_backend.{n}.http_request.{n}.action`: [required]: The rules action (e.g. `add-header`) * `haproxy_backend.{n}.http_request.{n}.param`: [optional]: The complete line to be added (e.g. `X-Forwarded-Proto https`) @@ -448,16 +450,16 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst * `haproxy_letsencrypt_ocsp_deploy_job.weekday`: [default: `*`]: Day of the week that the job should run (e.g. `0-6` for Sunday-Saturday, `*`) * `haproxy_cache`: [default: `[]`]: Caching declarations -* `haproxy_cache.{n}.name`: [default: [required]]: The name of the cache -* `haproxy_cache.{n}.total_max_size`: [default: []]: Max size (in MB) of the cache -* `haproxy_cache.{n}.max_object_size`: [default: []]: Max size (in MB) of any single object in the cache -* `haproxy_cache.{n}.max_age`: [default: []]: Max age (in seconds) to hold an item in cache +* `haproxy_cache.{n}.name`: [required]: The name of the cache +* `haproxy_cache.{n}.total_max_size`: [optional]: Max size (in MB) of the cache +* `haproxy_cache.{n}.max_object_size`: [optional]: Max size (in MB) of any single object in the cache +* `haproxy_cache.{n}.max_age`: [optional]: Max age (in seconds) to hold an item in cache * `haproxy_program`: [default: `[]`]: Program declarations -* `haproxy_program.{n}.name`: [default: [required]]: The name of the program -* `haproxy_program.{n}.command`: [default: `[]`]: Command to execute +* `haproxy_program.{n}.name`: [required]: The name of the program +* `haproxy_program.{n}.command`: [optional]: Command to execute * `haproxy_program.{n}.option`: [default: `[]`]: Options to enable -* `haproxy_program.{n}.no_option`: [default: `[]`]: Options to inverse/disable +* `haproxy_program.{n}.no_option`: [default: `[]`]: Options to inverse/disable ## Dependencies diff --git a/templates/etc/haproxy/backend.cfg.j2 b/templates/etc/haproxy/backend.cfg.j2 index bbfa221..e7419a6 100644 --- a/templates/etc/haproxy/backend.cfg.j2 +++ b/templates/etc/haproxy/backend.cfg.j2 @@ -26,7 +26,7 @@ backend {{ backend.name }} cookie {{ backend.cookie }} {% endif %} {% for filter in backend.filter | default([]) %} - filter {{ filter.name }}{{ filter.params is defined | ternary([''] + [filter.params], []) | join(' ') }} + filter {{ filter.name }}{% for param in filter.param | default([]) %} {{ param }}{% endfor %} {% endfor %} {% for acl in backend.acl | default([]) %} acl {{ acl.string }} diff --git a/templates/etc/haproxy/cache.cfg.j2 b/templates/etc/haproxy/cache.cfg.j2 index 769c353..25fa672 100644 --- a/templates/etc/haproxy/cache.cfg.j2 +++ b/templates/etc/haproxy/cache.cfg.j2 @@ -1,5 +1,4 @@ -{% if cache is defined %} -{% for cache in haproxy_cache %} +{% for cache in haproxy_cache | default([]) %} cache {{ cache.name }} {% if cache.total_max_size is defined %} total-max-size {{ cache.total_max_size }} @@ -11,4 +10,3 @@ cache {{ cache.name }} max-age {{ cache.max_age }} {% endif %} {% endfor %} -{% endif %} diff --git a/templates/etc/haproxy/frontend.cfg.j2 b/templates/etc/haproxy/frontend.cfg.j2 index 136383b..cb90870 100644 --- a/templates/etc/haproxy/frontend.cfg.j2 +++ b/templates/etc/haproxy/frontend.cfg.j2 @@ -35,7 +35,7 @@ frontend {{ frontend.name }} timeout {{ timeout.type }} {{ timeout.timeout }} {% endfor %} {% for filter in frontend.filter | default([]) %} - filter {{ filter.name }}{{ filter.params is defined | ternary([''] + [filter.params], []) | join(' ') }} + filter {{ filter.name }}{% for param in filter.param | default([]) %} {{ param }}{% endfor %} {% endfor %} {% for acl in frontend.acl | default([]) %} acl {{ acl.string }} diff --git a/templates/etc/haproxy/listen.cfg.j2 b/templates/etc/haproxy/listen.cfg.j2 index 86857c1..662295b 100644 --- a/templates/etc/haproxy/listen.cfg.j2 +++ b/templates/etc/haproxy/listen.cfg.j2 @@ -53,7 +53,7 @@ listen {{ listen.name }} timeout {{ timeout.type }} {{ timeout.timeout }} {% endfor %} {% for filter in listen.filter | default([]) %} - filter {{ filter.name }}{{ filter.params is defined | ternary([''] + [filter.params], []) | join(' ') }} + filter {{ filter.name }}{% for param in filter.param | default([]) %} {{ param }}{% endfor %} {% endfor %} {% for acl in listen.acl | default([]) %} acl {{ acl.string }} diff --git a/templates/etc/haproxy/program.cfg.j2 b/templates/etc/haproxy/program.cfg.j2 index 19c1ca1..67eb57a 100644 --- a/templates/etc/haproxy/program.cfg.j2 +++ b/templates/etc/haproxy/program.cfg.j2 @@ -1,5 +1,4 @@ -{% if haproxy_program is defined %} -{% for program in haproxy_program %} +{% for program in haproxy_program | default([]) %} program {{ program.name }} {% if program.command is defined %} command {{ program.command }} @@ -11,4 +10,3 @@ program {{ program.name }} no option {{ option }} {% endfor %} {% endfor %} -{% endif %}