From e9255a168a73f0980c0587e15d4e0ea98701dcf7 Mon Sep 17 00:00:00 2001 From: Adrien Waksberg Date: Tue, 25 Jul 2023 15:25:57 +0200 Subject: [PATCH] test: fix syntax --- defaults/main.yml | 18 +++++++-------- handlers/main.yml | 4 ++-- meta/main.yml | 4 ++-- tasks/main.yml | 59 ++++++++++++++++++++++------------------------- 4 files changed, 41 insertions(+), 44 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index ba2cbd5..531f311 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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: {} diff --git a/handlers/main.yml b/handlers/main.yml index 3393e45..ed85842 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,5 +1,5 @@ --- -- name: reload haproxy - service: +- name: Reload haproxy + ansible.builtin.service: name: haproxy state: reloaded diff --git a/meta/main.yml b/meta/main.yml index ad5450d..2c065db 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -12,8 +12,8 @@ galaxy_info: platforms: - name: Debian versions: - - Bullseye - - Bookworm + - bullseye + - bookworm galaxy_tags: - haproxy diff --git a/tasks/main.yml b/tasks/main.yml index 94caebd..e3f5d69 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -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