I'm trying to write a playbook that would invoke other playbooks (to use
for bulk playbook launches):
roles/tower_job
I'm trying to write a playbook that would invoke other playbooks (to use
for bulk playbook launches):
roles/tower_job
Not sure I understand “bulk playbook launches”, but does/should workflows be used for this?
Are you running into authentication issues or something else?
(throwing out ideas - I’ve never done this)
Not sure I understand "bulk playbook launches", but does/should
workflows be used for this?
Workflows don't seem to allow flexibility I seek. I need to:
* collect from user which jobs are to be fired off (pre-populated
multiple choice list)
* launch all selected jobs
Are you running into authentication issues or something else?
I think those are auth issues, and I would like to know what is the
purpose of "Ansible Tower" credentials if not for covering something
like described above...
(throwing out ideas - I've never done this)
yeah, neither have I
I have something similar with my customer where we have metadata that defines roles and then we have a job that will apply roles from the metadata to selected inventory.
For calling back to Tower you should be able to use the Ansible Tower credential type with the tower_ modules so it looks like it should work.
What are you getting in the log of a run? Can you see the job launches in Tower?
Note this module is just kicking off the job, not waiting for it to complete, you would also need to include a call to tower_job_wait to get the results back in your ansible code.
-John
This is what I'm getting:
Traceback (most recent call last):
File
"/home/ansible/.ansible/tmp/ansible-tmp-1551887155.09-262196206232843/AnsiballZ_tower_job_launch.py",
line 113, in <module>
_ansiballz_main()
File
"/home/ansible/.ansible/tmp/ansible-tmp-1551887155.09-262196206232843/AnsiballZ_tower_job_launch.py",
line 105, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File
"/home/ansible/.ansible/tmp/ansible-tmp-1551887155.09-262196206232843/AnsiballZ_tower_job_launch.py",
line 48, in invoke_module
imp.load_module('__main__', mod, module, MOD_DESC)
File "/tmp/ansible_tower_job_launch_payload_e2rKQ3/__main__.py", line
145, in <module>
File "/tmp/ansible_tower_job_launch_payload_e2rKQ3/__main__.py", line
129, in main
File "/usr/lib/python2.7/site-packages/tower_cli/models/base.py", line
499, in get
response = self.read(pk=pk, fail_on_no_results=True,
fail_on_multiple_results=True, **kwargs)
File "/usr/lib/python2.7/site-packages/tower_cli/models/base.py", line
301, in read
r = client.get(url, params=params)
File "/usr/lib/python2.7/site-packages/requests/sessions.py", line
521, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python2.7/site-packages/tower_cli/api.py", line 268, in
request
raise exc.AuthError('Invalid Tower authentication credentials (HTTP
401).')
tower_cli.exceptions.AuthError: Invalid Tower authentication credentials
(HTTP 401).
so it sounds like it can't authenticate, but I am using same credentials
from one of the CI jobs I'm running (outside of Tower) successfully.
So to recap: I've got Ansible Tower Credentials set up, Job template is
configured to use those credentials and playbook is using tower_*
commands... did I miss something along the way?
I find it much easier to orchestrate Ansible Tower jobs using something like Jenkins to call the API.
For orchestration we’ve found it’s better to use Jenkins or some such to call the API. We are using Tower so we are behind a few versions, maybe the interface has improved.