Comment 7 for bug 1960175

Revision history for this message
Dmitriy Rabotyagov (noonedeadpunk) wrote (last edit ):

So while it's indeed a list by default, as you posted "A simple string is still accepted and works as a single pattern."

Based on that I highly doubt that issue is indeed related to the list vs string for setup. I wrote a simple playbook to verify that current way of setup is not broken. I also tested with ansible 2.12.2 and result was exactly the same.

Output:

root@server-0207-1334:~/openstack-ansible# openstack-ansible test.yml
Variable files: "-e @/etc/openstack_deploy/user_ceph_aio.yml -e @/etc/openstack_deploy/user_secrets.yml -e @/etc/openstack_deploy/user_variables.yml -e @/etc/openstack_deploy/user_variables_barbican.yml -e @/etc/openstack_deploy/user_variables_ceph.yml "
[WARNING]: Unable to parse /etc/openstack_deploy/inventory.ini as an inventory source
Operations to perform:
  Apply all migrations: admin, api, auth, contenttypes, db, sessions
Running migrations:
  No migrations to apply.

PLAY [aio1] *******************************************************************************************************************************************************************************************************************************************************************
2022-02-07 19:43:47,625 INFO ansible: PLAY [aio1] *******************************************************************************************************************************************************************************************************************************************************************

TASK [Clean facts] ************************************************************************************************************************************************************************************************************************************************************
2022-02-07 19:43:47,898 INFO ansible: TASK [Clean facts] ************************************************************************************************************************************************************************************************************************************************************
ok: [aio1] => {
    "ansible_all_ipv4_addresses": "VARIABLE IS NOT DEFINED!"
}
2022-02-07 19:43:47,954 INFO ansible: ok: [aio1] => {
    "ansible_all_ipv4_addresses": "VARIABLE IS NOT DEFINED!"
}

TASK [Gather additional facts] ************************************************************************************************************************************************************************************************************************************************
2022-02-07 19:43:48,081 INFO ansible: TASK [Gather additional facts] ************************************************************************************************************************************************************************************************************************************************
ok: [aio1]
2022-02-07 19:43:50,153 INFO ansible: ok: [aio1]

TASK [Gathered facts after setup] *********************************************************************************************************************************************************************************************************************************************
2022-02-07 19:43:50,295 INFO ansible: TASK [Gathered facts after setup] *********************************************************************************************************************************************************************************************************************************************
ok: [aio1] => {
    "ansible_all_ipv4_addresses": [
        "172.29.236.100",
        "172.29.236.101",
        "172.29.228.100",
        "172.17.0.1",
        "172.29.240.100",
        "172.29.252.100",
        "172.29.232.100",
        "172.29.248.1",
        "172.29.248.100",
        "10.1.0.184",
        "172.29.244.100"
    ]
}
2022-02-07 19:43:50,427 INFO ansible: ok: [aio1] => {
    "ansible_all_ipv4_addresses": [
        "172.29.236.100",
        "172.29.236.101",
        "172.29.228.100",
        "172.17.0.1",
        "172.29.240.100",
        "172.29.252.100",
        "172.29.232.100",
        "172.29.248.1",
        "172.29.248.100",
        "10.1.0.184",
        "172.29.244.100"
    ]
}

PLAY RECAP ********************************************************************************************************************************************************************************************************************************************************************
2022-02-07 19:43:50,515 INFO ansible: PLAY RECAP ********************************************************************************************************************************************************************************************************************************************************************
aio1 : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
2022-02-07 19:43:50,515 INFO ansible: aio1 : ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

EXIT NOTICE [Playbook execution success] **************************************
===============================================================================
root@server-0207-1334:~/openstack-ansible# ansible --version
Variable files: "-e @/etc/openstack_deploy/user_ceph_aio.yml -e @/etc/openstack_deploy/user_secrets.yml -e @/etc/openstack_deploy/user_variables.yml -e @/etc/openstack_deploy/user_variables_barbican.yml -e @/etc/openstack_deploy/user_variables_ceph.yml "
ansible [core 2.11.6]
  config file = None
  configured module search path = ['/etc/ansible/roles/ceph-ansible/library']
  ansible python module location = /opt/ansible-runtime/lib/python3.8/site-packages/ansible
  ansible collection location = /etc/ansible
  executable location = /opt/ansible-runtime/bin/ansible
  python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]
  jinja version = 3.0.3
  libyaml = True
root@server-0207-1334:~/openstack-ansible#
root@server-0207-1334:~/openstack-ansible# cat test.yml
- hosts: aio1
  gather_facts: false
  tasks:

    - name: Clean facts
      debug:
        var: ansible_all_ipv4_addresses

    - name: Gather additional facts
      setup:
        gather_subset: "!all,network"
        filter: "ansible_all_ipv[4|6]_addresses"

    - name: Gathered facts after setup
      debug:
        var: ansible_all_ipv4_addresses
root@server-0207-1334:~/openstack-ansible#