ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
13.96k stars 3.41k forks source link

[Doc Update][Collections] No use of organization parameter with inventory_source module #14329

Open nikhjain14 opened 1 year ago

nikhjain14 commented 1 year ago

Please confirm the following

Bug Summary

While creating the inventory source under created inventory using "inventory_soruce" module, we don't require to mention the organization as the organization field is not present while creating the inventory source.

Link: https://docs.ansible.com/ansible/latest/collections/awx/awx/inventory_source_module.html#ansible-collections-awx-awx-inventory-source-module

Examples

AWX version

4.4

Select the relevant components

Installation method

N/A

Modifications

no

Ansible version

No response

Operating system

No response

Web browser

No response

Steps to reproduce

We used the below playbooks to create an inventory source under created inventory.

Non-working:

---
- hosts: localhost
   connection: local
   tasks:
     - name: Add an inventory source
        inventory_source:
          name: Inventory Sources Name
          description:
          organization: OrganizationName
          inventory: Inventory Plugin
          credential: Demo Credential
          source: scm
          source_project: Requirements Proyect
          source_path: inventory.yml
          state: present
          overwrite: true
          update_on_launch: true
          overwrite_vars: true

Working:

---
- hosts: localhost
   connection: local
   tasks:
     - name: Add an inventory source
        inventory_source:
          name: Inventory Sources Name
          description:
          inventory: Inventory Plugin
          credential: Demo Credential
          source: scm
          source_project: Requirements Proyect
          source_path: inventory.yml
          state: present
          overwrite: true
          update_on_launch: true
          overwrite_vars: true

Expected results

Playbook should be able to create the inventory source properly under existing inventory.

Actual results

Playbook was unable to create the inventory source and gave us the below error.

fatal: [localhost]: FAILED! => {"changed": false, "msg": "The specified source project, {'organization': 6}, was not found."}

Additional information

No response

IanSJones commented 11 months ago

I am finding that the error message may be mentioning organization but my error appears to stem from the source_project not being found:

Fails with: TASK [Ensure that the inventory source is using CMDB_Inventory project] **** fatal: [localhost]: FAILED! => {"changed": false, "msg": "The specified source project, {'organization': 16}, was not found."}

I have tried "CMDB_Inventory" and 843 (the project's id) as well as the api link as shown above but I consistently get this organization error which, like I mention, I think is a red herring. If I omit the organization name the the error is: TASK [Ensure that the inventory source is using CMDB_Inventory project] **** fatal: [localhost]: FAILED! => {"changed": false, "msg": "The specified source project, {}, was not found."}