When running an import, I receive a response of OK, even if I changed the assets from an export.
# ansible-playbook /Users/me/Documents/Ansible/AnsibleAutomation_platform/import_workflow.yaml -vvv
---
- name: Import Workflow
hosts: localhost
connection: local
gather_facts: false
collections:
- ansible.controller
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
ansible.controller.import:
assets: "{{ lookup('file', 'workflow.yaml') | from_yaml }}"
register: import_results
- debug:
msg: "{{ import_results }}"
Result:
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
Here’s what I used to get the values for the workflow.yaml file:
ansible-playbook /Users/me/Documents/Ansible/AnsibleAutomation_platform/export_job_templates.yaml -e "password=CHANGEME job_template=all" -vvv
---
- name: Export Workflow
hosts: localhost
connection: local
gather_facts: false
collections:
- ansible.controller
environment:
CONTROLLER_HOST: https://my.company.com/
CONTROLLER_USERNAME: api_user
CONTROLLER_PASSWORD: "{{ password }}"
CONTROLLER_VERIFY_SSL: False
tasks:
- debug:
msg: "Starting Export"
- name: Export workflow job template
ansible.controller.export:
job_templates: "{{ job_templates }}"
register: export_results
- debug:
var: export_results
- name: Export job template to file
copy:
content: "{{ export_results | to_nice_yaml( width=50, explicit_start=True, explicit_end=True) }}"
dest: "workflow.yaml"
Klaas
(Klaas)
2
I am guessing you need to open a support request with Red Hat or test it against awx and the awx.awx collection
Tried that. Red Hat said to use their collection. Same difference.
awx try:
---
- name: Export Job Templates
hosts: localhost
connection: local
gather_facts: false
collections:
- awx.awx
environment:
CONTROLLER_HOST: https://my.company.com/
CONTROLLER_USERNAME: api_user
CONTROLLER_PASSWORD:
CONTROLLER_VERIFY_SSL: False
tasks:
- debug:
msg: "Starting Export"
- name: Export workflow job template
awx.awx.export:
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: template.yaml
I had tried awx before:
But they said to post here. So since Red Hat’s been quite I thought I’d give this forum a try.