We have installed Ansible Tower and have the CLI tools implemented. We can launch jobs in the CLI using the following -
tower-cli job launch -J 5
This returns the output like so -
Resource changed.
=== ============ ======================== ======= =======
id job_template created status elapsed
=== ============ ======================== ======= =======
119 5 2017-12-05T20:26:31.197Z pending 0.0
=== ============ ======================== ======= =======
And then we can monitor the status like this -
tower-cli job monitor 119
.
Is it possible to pass the input of ID into the monitor cli argument in some way (or is it possible to run both at the same time)? Since we have multiple jobs running on the server, we would need to be able to reliably get the job id each time.
I didn't see anything about this when I read over the documentation at http://tower-cli.readthedocs.io/en/latest/cli_ref/index.html.
Thanks.
I'm on tower-cli
version Tower CLI 3.3.0
. I ran tower-cli job launch --help
which gave the following, related commands:
--monitor If sent, immediately calls `job monitor` on the
newly launched job rather than exiting with a
success.
--wait Monitor the status of the job, but do not print
while job is in progress.
So I think you can just do the following:
tower-cli job launch -J 5 --monitor
(I add the --wait
command when I'm running this in my CI build, which is why I included it above)