Hi, community,
I am creating a deployment workflow using the Ansible Automation Platform
(AAP) and, right now, the workflow is composed of two job templates. The
first job template creates the actual vms and the the second job template
is used for some post-build configuration tasks. I want to use the
inventory generated in the first job template for the second job template.
Right now, I am having AAP reach back to itself via the AAP API and create
an inventory. I have also used the set_stats module to create an artifact
that the second job template can see.
- name: Set stats to pass inventory
ansible.builtin.set_stats:
data:
target_hosts: "{{ linux_hosts }}"
- name: Get an AAP API Token and store it as new_token
register: new_token
ansible.builtin.uri:
url: "https://<redacted>/api/v2/tokens/"
method: POST
user: admin
password: "{{ survey_controller_passwd }}"
validate_certs: false
force_basic_auth: true
status_code: 201
return_content: true
- name: Azure inventory update
ansible.controller.host:
controller_host: "https://<redacted>/"
controller_password: "{{ survey_controller_passwd }}"
controller_username: 'admin'
controller_oauthtoken: "{{ new_token.json.token }}"
name: "{{ linux_hosts }}"
inventory: "Azure-test"
state: present
enabled: true
The artifact is created and the new inventory on AAP is updated when job
template 1 completes.
{
"target_hosts": [
"rheltest0701c"
]
}
But, the second job template fails as it cannot find the host(s).
*[WARNING]: Could not match supplied host pattern, ignoring: target_hosts*
Any idea, folks?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/aa0fcd58-3f55-4c9a-8ea6-2d0e28fa3495n%40googlegroups.com.