test: fix syntax

This commit is contained in:
Adrien Waksberg 2023-07-25 15:25:57 +02:00
parent 9b7ee14b13
commit e9255a168a
4 changed files with 41 additions and 44 deletions

View file

@ -1,5 +1,5 @@
---
haproxy_apt_release: '{{ ansible_distribution_release }}'
haproxy_apt_release: "{{ ansible_distribution_release }}"
haproxy_stats_username: admin
haproxy_stats_password: secret
haproxy_global: {}
@ -12,7 +12,7 @@ haproxy_default_global:
group: haproxy
daemon: true
stats: socket /var/lib/haproxy/stats group haproxy mode 660
haproxy_full_global: '{{ haproxy_default_global|combine(haproxy_global) }}'
haproxy_full_global: "{{ haproxy_default_global | combine(haproxy_global) }}"
haproxy_defaults: {}
haproxy_default_defaults:
@ -34,7 +34,7 @@ haproxy_default_defaults:
- http-keep-alive 10s
- check 10s
maxconn: 4096
haproxy_full_defaults: '{{ haproxy_default_defaults|combine(haproxy_defaults) }}'
haproxy_full_defaults: "{{ haproxy_default_defaults | combine(haproxy_defaults) }}"
haproxy_listen_stats: {}
haproxy_default_listen_stats:
@ -49,12 +49,12 @@ haproxy_default_listen_stats:
- connect 30s
- queue 30s
stats:
- 'refresh 5s'
- 'show-node'
- 'realm Haproxy\ Statistics'
- 'auth {{ haproxy_stats_username }}:{{ haproxy_stats_password }}'
- 'uri /haproxy_stats'
haproxy_full_listen_stats: '{{ haproxy_default_listen_stats|combine(haproxy_listen_stats, recursive=True) }}'
- "refresh 5s"
- "show-node"
- "realm Haproxy\ Statistics"
- "auth {{ haproxy_stats_username }}:{{ haproxy_stats_password }}"
- "uri /haproxy_stats"
haproxy_full_listen_stats: "{{ haproxy_default_listen_stats | combine(haproxy_listen_stats, recursive=True) }}"
haproxy_frontends: {}
haproxy_backends: {}

View file

@ -1,5 +1,5 @@
---
- name: reload haproxy
service:
- name: Reload haproxy
ansible.builtin.service:
name: haproxy
state: reloaded

View file

@ -12,8 +12,8 @@ galaxy_info:
platforms:
- name: Debian
versions:
- Bullseye
- Bookworm
- bullseye
- bookworm
galaxy_tags:
- haproxy

View file

@ -1,73 +1,70 @@
---
- name: install package
- name: Install package
ansible.builtin.apt:
name:
- haproxy
default_release: '{{ haproxy_apt_release }}'
retries: 2
register: result
until: result is succeeded
default_release: "{{ haproxy_apt_release }}"
tags: haproxy
- name: copy ssl certificates
- name: Copy ssl certificates
ansible.builtin.copy:
content: '{{ item.value }}'
dest: /etc/haproxy/{{ item.key }}.pem
content: "{{ item.value }}"
dest: "/etc/haproxy/{{ item.key }}.pem"
owner: root
group: root
mode: 0600
loop: '{{ haproxy_ssl_certificates|dict2items }}'
mode: "0600"
loop: "{{ haproxy_ssl_certificates | dict2items }}"
no_log: true
notify: reload haproxy
notify: Reload haproxy
tags: haproxy
- name: copy IPs lists
- name: Copy IPs lists
ansible.builtin.copy:
content: "{{ item.value|join('\n') }}"
dest: '/etc/haproxy/{{ item.key }}.list'
content: "{{ item.value | join('\n') }}"
dest: "/etc/haproxy/{{ item.key }}.list"
owner: root
group: root
mode: 0644
loop: '{{ haproxy_ips_lists|dict2items }}'
mode: "0644"
loop: "{{ haproxy_ips_lists | dict2items }}"
loop_control:
label: '{{ item.key }}'
notify: reload haproxy
label: "{{ item.key }}"
notify: Reload haproxy
tags: haproxy
- name: create http errors directory
- name: Create http errors directory
ansible.builtin.file:
path: '/etc/haproxy/errors'
path: "/etc/haproxy/errors"
owner: root
group: root
mode: 0755
mode: "0755"
state: directory
tags: haproxy
- name: copy http errors file
- name: Copy http errors file
ansible.builtin.copy:
content: '{{ item.value }}'
dest: '/etc/haproxy/errors/{{ item.key }}.http'
content: "{{ item.value }}"
dest: "/etc/haproxy/errors/{{ item.key }}.http"
owner: root
group: root
mode: 0644
loop: '{{ haproxy_http_error_files|dict2items }}'
loop: "{{ haproxy_http_error_files | dict2items }}"
loop_control:
label: '{{ item.key }}'
notify: reload haproxy
label: "{{ item.key }}"
notify: Reload haproxy
tags: haproxy
- name: copy config file
- name: Copy config file
ansible.builtin.template:
src: haproxy.cfg.j2
dest: /etc/haproxy/haproxy.cfg
owner: root
group: root
mode: 0640
mode: "0640"
validate: haproxy -c -f %s
notify: reload haproxy
notify: Reload haproxy
tags: haproxy
- name: enable ans start service
- name: Enable ans start service
ansible.builtin.service:
name: haproxy
enabled: true