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

View file

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

View file

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

View file

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