|
64 | 64 | signed_by: "https://haproxy.debian.net/bernat.debian.org.gpg" |
65 | 65 | state: "present" |
66 | 66 | enabled: true |
67 | | - register: "deb_repo" |
| 67 | + register: "__deb_repo" |
68 | 68 |
|
69 | 69 | - name: "Add PPA for HAProxy" |
70 | 70 | when: |
|
76 | 76 | state: "present" |
77 | 77 | validate_certs: true |
78 | 78 | mode: "0644" |
79 | | - register: "ppa" |
| 79 | + register: "__ppa" |
80 | 80 |
|
81 | 81 | - name: "Check whether wildcard character is contained in version string." |
82 | 82 | ansible.builtin.set_fact: |
83 | | - version_contains_wildcard: "{{ '*' in haproxy_version }}" |
| 83 | + __version_contains_wildcard: "{{ '*' in haproxy_version }}" |
84 | 84 |
|
85 | 85 | - name: "Check whether HAProxy binary is installed." |
86 | 86 | ansible.builtin.stat: |
87 | 87 | path: "{{ haproxy_executable_path }}" |
88 | | - register: "haproxy_installed" |
| 88 | + register: "__haproxy_binary" |
89 | 89 |
|
90 | 90 | - name: "Check currently installed HAProxy version" |
91 | | - when: "not version_contains_wildcard and haproxy_installed.stat.exists" |
| 91 | + when: |
| 92 | + - "not __version_contains_wildcard" |
| 93 | + - "__haproxy_binary.stat.exists" |
92 | 94 | block: |
93 | 95 | - name: "Get HAProxy version." |
94 | 96 | ansible.builtin.command: |
95 | 97 | cmd: "{{ haproxy_executable_path }} -v" |
96 | | - register: "haproxy_version_installed" |
| 98 | + register: "__haproxy_version_installed" |
97 | 99 | changed_when: false |
98 | 100 | check_mode: false |
99 | 101 |
|
100 | 102 | - name: "Extract installed and target HAProxy versions." |
101 | 103 | ansible.builtin.set_fact: |
102 | | - installed_version: "{{ haproxy_version_installed | |
| 104 | + __installed_version: "{{ __haproxy_version_installed | |
103 | 105 | regex_search('HA-?Proxy version (\\d+\\.\\d+\\.\\d+)', '\\1') | |
104 | 106 | default([None], True) | |
105 | 107 | first }}" |
106 | | - target_version: "{{ haproxy_version | |
| 108 | + __target_version: "{{ haproxy_version | |
107 | 109 | regex_search('^(\\d+\\.\\d+\\.\\d+)', '\\1') | |
108 | 110 | default([None], True) | |
109 | 111 | first }}" |
110 | 112 |
|
111 | 113 | - name: "Determine if errors in check mode can be ignored" |
112 | 114 | ansible.builtin.set_fact: |
113 | | - ignore_errors_in_check_mode: "{{ ansible_check_mode and (ppa.changed or deb_repo.changed) }}" |
| 115 | + __ignore_errors_in_check_mode: "{{ ansible_check_mode and (__ppa.changed or __deb_repo.changed) }}" |
114 | 116 |
|
115 | 117 | - name: "Install and configure HAProxy" |
116 | | - ignore_errors: "{{ ignore_errors_in_check_mode }}" # noqa ignore-errors |
| 118 | + ignore_errors: "{{ __ignore_errors_in_check_mode }}" # noqa ignore-errors |
117 | 119 | block: |
118 | 120 |
|
119 | 121 | - name: "Install or upgrade haproxy package." |
120 | 122 | become: true |
121 | 123 | ansible.builtin.package: |
122 | 124 | name: "{{ haproxy_name }}={{ haproxy_version }}" |
123 | 125 | update_cache: true |
124 | | - when: "version_contains_wildcard or |
125 | | - not haproxy_installed.stat.exists or |
126 | | - installed_version is version(target_version, operator='lt', strict=True)" |
| 126 | + when: >- |
| 127 | + __version_contains_wildcard or |
| 128 | + not __haproxy_binary.stat.exists or |
| 129 | + __installed_version is version(__target_version, operator='lt', strict=True) |
127 | 130 |
|
128 | 131 | - name: "Create HAProxy Configuration Directory." |
129 | 132 | become: true |
|
157 | 160 |
|
158 | 161 | - name: "Generate self-signed TLS certificate" |
159 | 162 | when: "haproxy_create_self_signed_cert | bool" |
160 | | - ignore_errors: "{{ ignore_errors_in_check_mode }}" # noqa ignore-errors |
| 163 | + ignore_errors: "{{ __ignore_errors_in_check_mode }}" # noqa ignore-errors |
161 | 164 | block: |
162 | 165 | - name: "Generate an OpenSSL Private Key (4096 bits)" |
163 | 166 | become: true |
|
227 | 230 | - "Reload HAProxy" |
228 | 231 |
|
229 | 232 | - name: "Generate DH Parameter file" |
230 | | - ignore_errors: "{{ ignore_errors_in_check_mode }}" # noqa ignore-errors |
| 233 | + ignore_errors: "{{ __ignore_errors_in_check_mode }}" # noqa ignore-errors |
231 | 234 | become: true |
232 | 235 | community.crypto.openssl_dhparam: |
233 | 236 | path: "{{ haproxy_ssl_dhparam_file }}" |
|
0 commit comments