Replace deprecated _haproxy_service_configs_simplified variable
with haproxy_service_configs Change-Id: I9e593be60df21af88433262fad5e03ec3ede5146 Signed-off-by: Dmitriy Chubinidze <dcu995@gmail.com>
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
The legacy ``service:`` wrapper in ``haproxy_service_configs`` is no longer
|
||||
supported. Only the flat service definition format is accepted. Ensure all
|
||||
service entries are updated before upgrading.
|
||||
@@ -13,17 +13,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# NOTE(damiandabrowski): Deprecated haproxy_service_configs format
|
||||
# conversion will be removed in 2024.1.
|
||||
- name: Define blank _haproxy_service_configs_simplified variable
|
||||
ansible.builtin.set_fact:
|
||||
_haproxy_service_configs_simplified: []
|
||||
|
||||
- name: Append services to _haproxy_service_configs_simplified list
|
||||
ansible.builtin.set_fact:
|
||||
_haproxy_service_configs_simplified: "{{ _haproxy_service_configs_simplified + [(item.service is defined) | ternary(item.service, item)] }}"
|
||||
loop: "{{ haproxy_service_configs }}"
|
||||
|
||||
###########################################################################
|
||||
# Service frontends and backends assembled from fragments into haproxy.conf
|
||||
###########################################################################
|
||||
@@ -35,9 +24,7 @@
|
||||
owner: root
|
||||
group: haproxy
|
||||
mode: "0640"
|
||||
# NOTE(damiandabrowski): _haproxy_service_configs_simplified should be replaced
|
||||
# with haproxy_service_configs in 2024.1.
|
||||
loop: "{{ _haproxy_service_configs_simplified }}"
|
||||
loop: "{{ haproxy_service_configs }}"
|
||||
loop_control:
|
||||
loop_var: service
|
||||
when:
|
||||
@@ -55,9 +42,7 @@
|
||||
path: "/etc/haproxy/conf.d/{{ service.haproxy_service_name }}"
|
||||
state: absent
|
||||
notify: Regenerate haproxy configuration
|
||||
# NOTE(damiandabrowski): _haproxy_service_configs_simplified should be replaced
|
||||
# with haproxy_service_configs in 2024.1.
|
||||
loop: "{{ _haproxy_service_configs_simplified }}"
|
||||
loop: "{{ haproxy_service_configs }}"
|
||||
loop_control:
|
||||
loop_var: service
|
||||
when:
|
||||
@@ -74,11 +59,9 @@
|
||||
owner: root
|
||||
group: haproxy
|
||||
mode: "0750"
|
||||
# NOTE(damiandabrowski): _haproxy_service_configs_simplified should be replaced
|
||||
# with haproxy_service_configs in 2024.1.
|
||||
loop: >-
|
||||
{{
|
||||
_haproxy_service_configs_simplified | selectattr('haproxy_map_entries', 'defined') | map(attribute='haproxy_map_entries') | flatten |
|
||||
haproxy_service_configs | selectattr('haproxy_map_entries', 'defined') | map(attribute='haproxy_map_entries') | flatten |
|
||||
map(attribute='name') | unique
|
||||
}}
|
||||
|
||||
@@ -92,10 +75,8 @@
|
||||
owner: root
|
||||
group: haproxy
|
||||
mode: "0640"
|
||||
# NOTE(damiandabrowski): _haproxy_service_configs_simplified should be replaced
|
||||
# with haproxy_service_configs in 2024.1.
|
||||
with_subelements:
|
||||
- "{{ _haproxy_service_configs_simplified | selectattr('haproxy_map_entries', 'defined') }}"
|
||||
- "{{ haproxy_service_configs | selectattr('haproxy_map_entries', 'defined') }}"
|
||||
- haproxy_map_entries
|
||||
when:
|
||||
- (item.0.haproxy_service_enabled | default(True)) | bool
|
||||
@@ -112,10 +93,8 @@
|
||||
- (item.0.haproxy_service_enabled | default('True')) | bool is falsy or
|
||||
(item.0.state is defined and item.0.state == 'absent') or
|
||||
(item.1.state | default('present') == 'absent')
|
||||
# NOTE(damiandabrowski): _haproxy_service_configs_simplified should be replaced
|
||||
# with haproxy_service_configs in 2024.1.
|
||||
with_subelements:
|
||||
- "{{ _haproxy_service_configs_simplified | selectattr('haproxy_map_entries', 'defined') }}"
|
||||
- "{{ haproxy_service_configs | selectattr('haproxy_map_entries', 'defined') }}"
|
||||
- haproxy_map_entries
|
||||
notify: Regenerate maps
|
||||
register: map_delete
|
||||
|
||||
@@ -3,40 +3,36 @@ external_lb_vip_address: 127.0.0.1
|
||||
internal_lb_vip_address: 127.0.0.1
|
||||
haproxy_pki_setup_host: "{{ inventory_hostname }}"
|
||||
haproxy_service_configs:
|
||||
- service:
|
||||
haproxy_service_name: test_group
|
||||
haproxy_backend_nodes: "{{ groups['haproxy_all'] | default([]) }}"
|
||||
haproxy_port: 8180
|
||||
haproxy_backend_port: 22
|
||||
haproxy_ssl: False
|
||||
haproxy_balance_type: tcp
|
||||
haproxy_backend_options:
|
||||
- tcp-check
|
||||
- service:
|
||||
haproxy_service_name: test_list
|
||||
haproxy_backend_nodes:
|
||||
- name: "localhost"
|
||||
ip_addr: "127.0.0.1"
|
||||
haproxy_port: 8181
|
||||
haproxy_backend_port: 22
|
||||
haproxy_ssl: False
|
||||
haproxy_balance_type: tcp
|
||||
haproxy_backend_options:
|
||||
- tcp-check
|
||||
- service:
|
||||
haproxy_service_name: test_backend_ssl
|
||||
haproxy_backend_nodes: "{{ groups['haproxy_all'] | default([]) }}"
|
||||
haproxy_port: 8180
|
||||
haproxy_backend_port: 443
|
||||
haproxy_backend_ssl: True
|
||||
haproxy_backend_ca: False
|
||||
haproxy_ssl: False
|
||||
haproxy_balance_type: http
|
||||
- service:
|
||||
haproxy_service_name: test_absent_service
|
||||
haproxy_backend_nodes:
|
||||
- name: "localhost"
|
||||
ip_addr: "127.0.0.1"
|
||||
haproxy_port: 65535
|
||||
haproxy_balance_type: tcp
|
||||
state: present
|
||||
- haproxy_service_name: test_group
|
||||
haproxy_backend_nodes: "{{ groups['haproxy_all'] | default([]) }}"
|
||||
haproxy_port: 8180
|
||||
haproxy_backend_port: 22
|
||||
haproxy_ssl: False
|
||||
haproxy_balance_type: tcp
|
||||
haproxy_backend_options:
|
||||
- tcp-check
|
||||
- haproxy_service_name: test_list
|
||||
haproxy_backend_nodes:
|
||||
- name: "localhost"
|
||||
ip_addr: "127.0.0.1"
|
||||
haproxy_port: 8181
|
||||
haproxy_backend_port: 22
|
||||
haproxy_ssl: False
|
||||
haproxy_balance_type: tcp
|
||||
haproxy_backend_options:
|
||||
- tcp-check
|
||||
- haproxy_service_name: test_backend_ssl
|
||||
haproxy_backend_nodes: "{{ groups['haproxy_all'] | default([]) }}"
|
||||
haproxy_port: 8180
|
||||
haproxy_backend_port: 443
|
||||
haproxy_backend_ssl: True
|
||||
haproxy_backend_ca: False
|
||||
haproxy_ssl: False
|
||||
haproxy_balance_type: http
|
||||
- haproxy_service_name: test_absent_service
|
||||
haproxy_backend_nodes:
|
||||
- name: "localhost"
|
||||
ip_addr: "127.0.0.1"
|
||||
haproxy_port: 65535
|
||||
haproxy_balance_type: tcp
|
||||
state: present
|
||||
|
||||
Reference in New Issue
Block a user