Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 2182747

Summary: [RHOS-16.2.5] Unable to get equivalent information with ansible-inventory -i /usr/bin/tripleo-ansible-inventory
Product: Red Hat OpenStack Reporter: James Parker <jparker>
Component: openstack-tripleo-commonAssignee: Rabi Mishra <ramishra>
Status: CLOSED MIGRATED QA Contact: David Rosenfeld <drosenfe>
Severity: medium Docs Contact:
Priority: medium    
Version: 16.2 (Train)CC: bshephar, fpiccion, jgrosso, jjoyce, jpodivin, jschluet, jveiraca, mariel, mburns, pweeks, ramishra, slinaber, tvignaud
Target Milestone: asyncKeywords: Reopened, Triaged
Target Release: 16.2 (Train on RHEL 8.4)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-tripleo-common-11.7.1-2.20240812095032.e189622.el8ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-12-20 17:31:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description James Parker 2023-03-29 14:15:30 UTC
Description of problem: Issue started with lastest puddle (RHOS-16.2-RHEL-8-20230322.n.1).  Was originally able to gather deployment information by using ansible-inventory in conjuction with /usr/bin/tripleo-ansible-inventory but I am now seeing warning messages and less information including missing multiple api IP's and hostnames.

(undercloud) [stack@undercloud-0 ~]$ source ~/stackrc && ansible-inventory -i /usr/bin/tripleo-ansible-inventory --graph Controller 
[WARNING]:  * Failed to parse /usr/bin/tripleo-ansible-inventory with script plugin: You defined a group 'overcloud_excluded_overcloud' with bad data for the host list:  {'hosts': {}}
[WARNING]:  * Failed to parse /usr/bin/tripleo-ansible-inventory with yaml plugin: We were unable to read either as JSON nor YAML, these are the errors we got from each: JSON: Expecting value: line 1 column 1 (char 0)  Syntax Error while
loading YAML.   mapping values are not allowed in this context  The error appears to be in '/usr/bin/tripleo-ansible-inventory': line 77, column 20, but may be elsewhere in the file depending on the exact syntax problem.  The offending
line appears to be:   def _parse_config():                    ^ here
[WARNING]:  * Failed to parse /usr/bin/tripleo-ansible-inventory with ini plugin: /usr/bin/tripleo-ansible-inventory:22: Expected key=value host variable assignment, got: __future__
[WARNING]: Unable to parse /usr/bin/tripleo-ansible-inventory as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
@Controller:
  |--@overcloud_Controller:
  |  |--controller-0
(undercloud) [stack@undercloud-0 ~]$ source ~/stackrc && ansible-inventory -i /usr/bin/tripleo-ansible-inventory --host=controller-0
[WARNING]:  * Failed to parse /usr/bin/tripleo-ansible-inventory with script plugin: You defined a group 'overcloud_excluded_overcloud' with bad data for the host list:  {'hosts': {}}
[WARNING]:  * Failed to parse /usr/bin/tripleo-ansible-inventory with yaml plugin: We were unable to read either as JSON nor YAML, these are the errors we got from each: JSON: Expecting value: line 1 column 1 (char 0)  Syntax Error while
loading YAML.   mapping values are not allowed in this context  The error appears to be in '/usr/bin/tripleo-ansible-inventory': line 77, column 20, but may be elsewhere in the file depending on the exact syntax problem.  The offending
line appears to be:   def _parse_config():                    ^ here
[WARNING]:  * Failed to parse /usr/bin/tripleo-ansible-inventory with ini plugin: /usr/bin/tripleo-ansible-inventory:22: Expected key=value host variable assignment, got: __future__
[WARNING]: Unable to parse /usr/bin/tripleo-ansible-inventory as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
{
    "ansible_ssh_user": "tripleo-admin",
    "bootstrap_server_id": "35ef489d-6e89-453f-b9aa-58557e344a70",
    "container_cli": "podman",
    "ctlplane_vip": "192.168.24.42",
    "external_vip": "10.0.0.118",
    "internal_api_vip": "172.17.1.92",
    "redis_vip": "172.17.1.77",
    "serial": "1",
    "storage_mgmt_vip": "172.17.4.36",
    "storage_vip": "172.17.3.90",
    "tripleo_role_name": "Controller",
    "tripleo_role_networks": [
        "ctlplane",
        "external",
        "internal_api",
        "storage",
        "storage_mgmt",
        "tenant"
    ]
}


# Previous working version
(undercloud) [stack@undercloud ~]$ cat core_puddle_version 
RHOS-16.2-RHEL-8-20230301.n.1
[stack@undercloud ~]$ source ~/stackrc && ansible-inventory -i /usr/bin/tripleo-ansible-inventory --graph Controller 
@Controller:
  |--@overcloud_Controller:
  |  |--overcloud-controller-0
  |  |--overcloud-controller-1
  |  |--overcloud-controller-2
(undercloud) [stack@undercloud ~]$ source ~/stackrc && ansible-inventory -i /usr/bin/tripleo-ansible-inventory --graph Controller | sed -ne 's/^[ \t|]\+--\([a-z0-9\-]\+\)$/\1/p' | head -n 1
overcloud-controller-0
(undercloud) [stack@undercloud ~]$ source ~/stackrc && ansible-inventory -i /usr/bin/tripleo-ansible-inventory --host=overcloud-controller-0
{
    "ansible_host": "2620:dead:beef:5::b0e4",
    "ansible_ssh_user": "tripleo-admin",
    "bootstrap_server_id": "18e556fd-cbd7-4dd0-bcd1-d735ec59ebe7",
    "canonical_hostname": "overcloud-controller-0.localdomain",
    "container_cli": "podman",
    "ctlplane_hostname": "overcloud-controller-0.ctlplane.localdomain",
    "ctlplane_ip": "2620:dead:beef:5::b0e4",
    "ctlplane_vip": "2620:dead:beef:5::b150",
    "deploy_server_id": "18e556fd-cbd7-4dd0-bcd1-d735ec59ebe7",
    "external_hostname": "overcloud-controller-0.external.localdomain",
    "external_ip": "2620:52:0:13b8:5054:ff:fe3e:10",
    "external_vip": "2620:52:0:13b8:5054:ff:fe3e:1",
    "internal_api_hostname": "overcloud-controller-0.internalapi.localdomain",
    "internal_api_ip": "fd00:fd00:fd00:1000::2a8",
    "internal_api_vip": "fd00:fd00:fd00:1000::194",
    "redis_vip": "fd00:fd00:fd00:1000::67",
    "serial": "1",
    "storage_hostname": "overcloud-controller-0.storage.localdomain",
    "storage_ip": "fd00:fd00:fd00:2000::389",
    "storage_mgmt_hostname": "overcloud-controller-0.storagemgmt.localdomain",
    "storage_mgmt_ip": "fd00:fd00:fd00:3000::c3",
    "storage_mgmt_vip": "fd00:fd00:fd00:3000::250",
    "storage_vip": "fd00:fd00:fd00:2000::386",
    "tenant_hostname": "overcloud-controller-0.tenant.localdomain",
    "tenant_ip": "172.120.2.138",
    "tripleo_role_name": "Controller",
    "tripleo_role_networks": [
        "ctlplane",
        "external",
        "internal_api",
        "storage",
        "storage_mgmt",
        "tenant"
    ]
}


Version-Release number of selected component (if applicable):
RHOS-16.2-RHEL-8-20230322.n.1

How reproducible:
100%

Steps to Reproduce:
1. Deploy an environment with RHOS-16.2-RHEL-8-20230322.n.1 and attempt to gather plan information with source ~/stackrc && ansible-inventory -i /usr/bin/tripleo-ansible-inventory --graph Controller 
2.
3.

Actual results:
Inventory is not parsed and instead uses implicit local host information about inventory

Expected results:
Full inventory details are available


Additional info: