Merge "Ensure conditionals are proper booleans in roles"

This commit is contained in:
Zuul
2026-02-03 10:56:44 +00:00
committed by Gerrit Code Review
9 changed files with 23 additions and 23 deletions

View File

@@ -20,7 +20,7 @@
vars:
default_network_interface_name: "{{ container_networks[network_address]['bridge'] | default }}"
when:
- is_metal
- is_metal | bool
- (dynamic_address_gather_filter is defined) or (default_network_interface_name | length > 0)
tags:
- common-address

View File

@@ -45,7 +45,7 @@
content: "c /dev/fuse 0600 - - - 10:229"
dest: "/etc/tmpfiles.d/openstack-ansible-glusterfs-server.conf"
mode: "0644"
when: not (is_metal | default(False))
when: not (is_metal | default(False)) | bool
register: _glusterfs_server_tmpfiles
- name: Restart systemd-tmpfiles-setup-dev
@@ -54,7 +54,7 @@
enabled: true
state: restarted
when:
- not (is_metal | default(False))
- not (is_metal | default(False)) | bool
- _glusterfs_server_tmpfiles is changed
- name: Start glusterfs server

View File

@@ -16,7 +16,7 @@
- name: Create gluster peers
gluster.gluster.gluster_peer:
nodes: "{{ glusterfs_server_cluster_members }}"
when: _glusterfs_is_bootstrap_host
when: _glusterfs_is_bootstrap_host | bool
- name: Ensure glusterfs backing directory exists
ansible.builtin.file:
@@ -43,7 +43,7 @@
when:
- _backing_dir_create is changed
- _brick_online_status.rc == 0
- (_brick_online_status.stdout_lines | select('contains', 'Online'))[0] | regex_search('N')
- (_brick_online_status.stdout_lines | select('contains', 'Online'))[0] | regex_search('N') is not none
with_items:
- gluster volume reset-brick {{ glusterfs_server_volume_name }} {{ brick }} start
- gluster volume reset-brick {{ glusterfs_server_volume_name }} {{ brick }} {{ brick }} commit force
@@ -52,4 +52,4 @@
ansible.builtin.include_tasks:
file: glusterfs_post_install_brick.yml
when:
- _glusterfs_is_bootstrap_host
- _glusterfs_is_bootstrap_host | bool

View File

@@ -34,7 +34,7 @@
loop_control:
loop_var: __mq_vhost
when:
- "(_oslomsg_rpc_configure | default(_oslomsg_rpc_transport is defined))"
- "(_oslomsg_rpc_configure | default(_oslomsg_rpc_transport is defined) | bool)"
- "(_oslomsg_rpc_transport is defined) and (_oslomsg_rpc_transport == 'rabbit')"
tags:
- common-rabbitmq
@@ -42,7 +42,7 @@
- name: Setup Notify MQ Service (RabbitMQ)
delegate_to: "{{ _oslomsg_notify_setup_host }}"
when:
- "(_oslomsg_notify_configure | default(_oslomsg_notify_transport is defined))"
- "(_oslomsg_notify_configure | default(_oslomsg_notify_transport is defined) | bool)"
- "(_oslomsg_notify_transport is defined) and (_oslomsg_notify_transport == 'rabbit')"
tags:
- common-rabbitmq
@@ -58,7 +58,7 @@
- (_oslomsg_rpc_vhost is undefined) or
(_oslomsg_notify_vhost != _oslomsg_rpc_vhost) or
(_oslomsg_notify_setup_host != _oslomsg_rpc_setup_host) or
not (_oslomsg_rpc_configure | default(_oslomsg_rpc_transport is defined))
not (_oslomsg_rpc_configure | default(_oslomsg_rpc_transport is defined) | bool)
- name: Setup Notify user
vars:
@@ -73,5 +73,4 @@
- (_oslomsg_rpc_userid is undefined) or
(_oslomsg_notify_userid != _oslomsg_rpc_userid) or
(_oslomsg_notify_setup_host != _oslomsg_rpc_setup_host) or
not (_oslomsg_rpc_configure | default(_oslomsg_rpc_transport is defined))
not (_oslomsg_rpc_configure | default(_oslomsg_rpc_transport is defined) | bool)

View File

@@ -18,8 +18,8 @@
cloud: "{{ openstack_resources_cloud_name }}"
interface: "{{ openstack_resources_interface }}"
when:
- openstack_resources_image['images'] | selectattr('checksum', 'defined')
- not (openstack_resources_image['image_force_upload'] | default(false))
- openstack_resources_image['images'] | selectattr('checksum', 'defined') | length > 0
- not (openstack_resources_image['image_force_upload'] | default(false)) | bool
register: existing_images
- name: Upload images

View File

@@ -31,7 +31,7 @@
- name: Remove outdated images
when:
- "'keep_copies' in image"
- item
- item | length > 0
- not item['is_protected']
- item['visibility'] == image['hide_method']
openstack.cloud.image:

View File

@@ -26,7 +26,8 @@
- name: Downloading image from remote url
vars:
images_for_download: "{{ images | selectattr('url', 'defined') }}"
when: images_for_download
when:
- images_for_download | length > 0
block:
- name: Create temporary dir for the image download
ansible.builtin.tempfile:

View File

@@ -19,7 +19,7 @@
apply:
tags:
- common-service
when: openstack_resources_identity
when: openstack_resources_identity | length > 0
tags:
- common-service
@@ -36,7 +36,7 @@
tags:
- compute-resources
when:
- openstack_resources_compute
- openstack_resources_compute | length > 0
- name: Add network resources
ansible.builtin.include_tasks:
@@ -49,7 +49,7 @@
tags:
- network-resources
when:
- openstack_resources_network
- openstack_resources_network | length > 0
- name: Add image resources
ansible.builtin.include_tasks:
@@ -62,7 +62,7 @@
tags:
- image-resources
when:
- openstack_resources_image
- openstack_resources_image | length > 0
- name: Add coe resources
ansible.builtin.include_tasks:
@@ -75,4 +75,4 @@
tags:
- coe-resources
when:
- openstack_resources_coe
- openstack_resources_coe | length > 0

View File

@@ -18,7 +18,7 @@
file: "{{ ssh_keypairs_method ~ '_keypair.yml' }}"
- name: Create keypairs
when: ssh_keypairs_create_keys
when: ssh_keypairs_create_keys | bool
block:
- name: Create keypair directories
ansible.builtin.file:
@@ -43,9 +43,9 @@
- name: Install ssh server certificate authorities
ansible.builtin.include_tasks: "{{ ssh_keypairs_method }}/install_ssh_ca.yml"
when:
- ssh_keypairs_install_authorities
- ssh_keypairs_install_authorities | bool
- name: Install ssh keys
ansible.builtin.include_tasks: "{{ ssh_keypairs_method }}/install_ssh_key.yml"
when:
- ssh_keypairs_install_keypairs
- ssh_keypairs_install_keypairs | bool