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
14.11k stars 3.43k forks source link

awx.awx.import returns Ok with no changes made. #15391

Open itinneed2022 opened 4 months ago

itinneed2022 commented 4 months ago

Please confirm the following

Bug Summary

When running awx.awx.import, play returns "Ok" with no changes made but the inventory contained changes.

AWX version

24.6.1

Select the relevant components

Installation method

N/A

Modifications

no

Ansible version

ansible-galaxy [core 2.15.12]

Operating system

Mac OSX

Web browser

No response

Steps to reproduce

Run this playbook:

# ansible-playbook /Users/me/Documents/Ansible/AnsibleAutomation_platform/import_workflow.yaml -vvv
---
- name: Import Workflow
  hosts: localhost
  connection: local
  gather_facts: false
  collections:
    - awx.awx
  environment:
     CONTROLLER_HOST: https://my.company.com/
     CONTROLLER_USERNAME: api_user
     CONTROLLER_PASSWORD: redacted
     CONTROLLER_VERIFY_SSL: False
  tasks:
  - debug:
      msg: "Starting Import"
  - name: Import workflow job template
    awx.awx.import:
      assets: "{{ lookup('file', 'workflow.yaml') | from_yaml }}"
    register: import_results
  - debug:
      msg: "{{ import_results }}"

Expected results

localhost : ok=0 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

Actual results

TASK [debug] ********************************************************************************************************************************************************************
task path: /Users/me/Documents/Ansible/AnsibleAutomation_platform/import_workflow.yaml:21
ok: [localhost] => {
    "msg": {
        "changed": false,
        "failed": false
    }
}

PLAY RECAP **********************************************************************************************************************************************************************
localhost                  : ok=3    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

Additional information

I created the inventory using the awx.awx.export module. Here is that playbook:

# ansible-playbook /Users/me/Documents/Ansible/AnsibleAutomation_platform/export_workflow.yaml -vvv
---
- name: Export Workflow
  hosts: localhost
  connection: local
  gather_facts: false
  collections:
    - awx.awx
  environment:
     CONTROLLER_HOST: https://my.company.com/
     CONTROLLER_USERNAME: api_user
     CONTROLLER_PASSWORD: redacted
     CONTROLLER_VERIFY_SSL: False
  tasks:
  - debug:
      msg: "Starting Export"
  - name: Export workflow job template
    awx.awx.export:
      workflow_job_templates: 'all'
    register: export_results
  - debug:
      var: export_results
  - name: Export workflow job template to file
    copy:
      content: "{{ export_results | to_nice_yaml( width=50, explicit_start=True, explicit_end=True) }}"
      dest: workflow.yaml

The change I made to the workflow.yaml file was a very simple one. Just changing a name and adding a description to one of the workflow templates. It should return as Changed but instead its just "Ok"

djyasin commented 4 months ago

Hello @itinneed2022 the particular error you are encountering: "msg": { "changed": false, "failed": false }

usually points to a configuration issue within the given playbook. Would you mind asking this on the Ansible Community Forum? A member of our community should be better able to assist you with this there.

Thank you for your time!