Description of problem: The tripleo-ansible-inventory script generates an invalid ansible inventory when it's executed without an overcloud. It will generate following inventory: Undercloud: hosts: undercloud: {} vars: ansible_connection: local ansible_host: localhost ansible_python_interpreter: /usr/bin/python3 ansible_remote_tmp: /tmp/ansible-${USER} auth_url: https://10.100.72.4:13000 cacert: /etc/pki/ca-trust/source/anchors/cm-local-ca.pem os_auth_token: XXXXX plan: overcloud plans: [overcloud] project_name: admin undercloud_service_list: [tripleo_nova_compute, tripleo_heat_engine, tripleo_ironic_conductor, tripleo_swift_container_server, tripleo_swift_object_server, tripleo_mistral_engine] undercloud_swift_url: https://10.100.72.4:13808/v1/AUTH_747d0549df934531807060de7d6079b9 username: admin overcloud: children: overcloud: {} However this causes an error when running some ansible ad hoc tasks which causes the inventory parsing to fail and only the localhost to be added to the inventory (see below). It looks like ansible doesn't like that the overcloud group tries to add itself as children: overcloud: children: overcloud: {} [[dev]stack@uc environments]$ ansible -m ping -i ~/ansible_inventory.yaml all [WARNING]: * Failed to parse /home/stack/ansible_inventory.yaml with auto plugin: no root 'plugin' key found, '/home/stack/ansible_inventory.yaml' is not a valid YAML inventory plugin config file [WARNING]: * Failed to parse /home/stack/ansible_inventory.yaml with yaml plugin: can't add group to itself [WARNING]: * Failed to parse /home/stack/ansible_inventory.yaml with ini plugin: Invalid host pattern 'Undercloud:' supplied, ending in ':' is not allowed, this character is reserved to provide a port. [WARNING]: Unable to parse /home/stack/ansible_inventory.yaml as an inventory source [WARNING]: No inventory was parsed, only implicit localhost is available [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' This will affect the pre-deployment and pre-introspection validation playbooks because they also generate this inventory file and then any tasks that are supposed to be run on the "all" host group are skipped/not executed. Version-Release number of selected component (if applicable): OSP16.1 How reproducible: Steps to Reproduce: 1. Install director 2. Run tripleo-ansible-inventory --os-cloud=undercloud --static-yaml-inventory ~/ansible_inventory.yaml 3. Run ad hoc tasks: ansible -i ~/ansible_inventory.yaml -m ping all 4. or run any tripleo validation: openstack tripleo validator run --group pre-deployment Actual results: Invalid ansible inventory and only implicit localhost in inventory Expected results: Valid ansible inventory with an empty overcloud group and the Undercloud group Additional info: If "overcloud: {}" is removed from the overcloud group's children section, ansible will be able to parse the inventory
Hi, CU hitting the same error while running validation: ~~~ (undercloud) [stack@director ~]$ openstack tripleo validator run --validation undercloud-neutron-sanity-check [WARNING]: * Failed to parse /home/stack/tripleo-ansible-inventory.yaml with auto plugin: no root 'plugin' key found, '/home/stack/tripleo-ansible-inventory.yaml' is not a valid YAML inventory plugin config file [WARNING]: * Failed to parse /home/stack/tripleo-ansible-inventory.yaml with yaml plugin: can't add group to itself [WARNING]: * Failed to parse /home/stack/tripleo-ansible-inventory.yaml with ini plugin: Invalid host pattern 'Undercloud:' supplied, ending in ':' is not allowed, this character is reserved to provide a port. [WARNING]: Unable to parse /home/stack/tripleo-ansible-inventory.yaml as an inventory source [WARNING]: No inventory was parsed, only implicit localhost is available [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' Monday 16 November 2020 12:49:33 -0500 (0:00:00.037) 0:00:00.037 ******* Monday 16 November 2020 12:49:33 -0500 (0:00:00.106) 0:00:00.144 ******* Monday 16 November 2020 12:49:33 -0500 (0:00:00.507) 0:00:00.652 ******* Monday 16 November 2020 12:49:34 -0500 (0:00:00.357) 0:00:01.010 ******* Monday 16 November 2020 12:49:34 -0500 (0:00:00.056) 0:00:01.066 ******* Monday 16 November 2020 12:49:34 -0500 (0:00:00.408) 0:00:01.474 ******* Monday 16 November 2020 12:49:36 -0500 (0:00:01.863) 0:00:03.338 ******* Monday 16 November 2020 12:49:36 -0500 (0:00:00.055) 0:00:03.394 ******* Monday 16 November 2020 12:49:36 -0500 (0:00:00.055) 0:00:03.449 ******* Monday 16 November 2020 12:49:36 -0500 (0:00:00.056) 0:00:03.505 ******* Monday 16 November 2020 12:49:36 -0500 (0:00:00.056) 0:00:03.561 ******* Monday 16 November 2020 12:49:37 -0500 (0:00:00.163) 0:00:03.725 ******* =============================================================================== neutron_sanity_check : Run neutron-sanity-check ------------------------- 1.86s neutron_sanity_check : Get the path of tripleo undercloud config file --- 0.51s neutron_sanity_check : Check if wanted container exists ----------------- 0.41s neutron_sanity_check : Get the Container CLI from the undercloud.conf file --- 0.36s neutron_sanity_check : Fail --------------------------------------------- 0.16s neutron_sanity_check : Set oc_container_cli and container_name for the Controller --- 0.11s neutron_sanity_check : Set uc_container_cli and container_name for the Undercloud --- 0.06s neutron_sanity_check : Create output ------------------------------------ 0.06s neutron_sanity_check : Output warning ----------------------------------- 0.06s neutron_sanity_check : Detect errors ------------------------------------ 0.06s neutron_sanity_check : Detect warnings ---------------------------------- 0.06s /usr/lib/python3.6/site-packages/validations_libs/ansible.py:374: ResourceWarning: unclosed file <_io.BufferedWriter name='/var/log/validations/artifacts//d900bc2a-8183-4469-a360-72c78d008d83_undercloud-neutron-sanity-check.yaml_2020-11-16T17:49:32.583801Z/artifacts/stdout'> status, rc = runner.run() +--------------------------------------+---------------------------------+--------+------------+----------------+-------------------+-------------+ | UUID | Validations | Status | Host_Group | Status_by_Host | Unreachable_Hosts | Duration | +--------------------------------------+---------------------------------+--------+------------+----------------+-------------------+-------------+ | d900bc2a-8183-4469-a360-72c78d008d83 | undercloud-neutron-sanity-check | FAILED | undercloud | undercloud | | 0:00:03.589 | +--------------------------------------+---------------------------------+--------+------------+----------------+-------------------+-------------+ sys:1: ResourceWarning: unclosed <ssl.SSLSocket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('10.49.20.4', 49722), raddr=('10.49.20.4', 13000)> ~~~
*** This bug has been marked as a duplicate of bug 1887444 ***