0

I'm working with the awx cli (19.1.0) and awx (13.0.0) in an environment with over 100 servers

When (e.g.) querying failed or changed results with:

awx --conf.host https://my.awx --conf.username myuser --conf.password mypass -k -f human --filter 'event_display,event_data,host_name,play,task,stdout' job_events list --job 1234 --event runner_on_ok --changed true > /tmp/tmp

I only get exactly 25 results.
(This fits to the pagination of the awx api?!)
Is there an option to get every result of an awx run?
(ARA would be great alternative to the cli, but it's not applicable for my environment/task)


Update/Hint I wasnt aware that one seem to only get the correct command-line help (--help) if successfully authenticated (see my comment to the answer)

MacMartin
  • 368
  • 1
  • 4
  • 17

1 Answers1

1

To fetch all results, add the flag --all to the query.

usage: awx job_events list [-h] [--all] [-f {json,yaml,jq,human}]
                       [--filter TEXT] [--conf.color BOOLEAN] [-v]
                       [--type {job_event}] [--created CREATED]
                       [--modified MODIFIED] [--job ID]
                       [--event {runner_on_failed,runner_on_start,runner_on_ok,runner_on_error,runner_on_skipped,runner_on_unreachable,runner_on_no_hosts,runner_on_async_poll,runner_on_async_ok,runner_on_async_failed,runner_item_on_ok,runner_item_on_failed,runner_item_on_skipped,runner_retry,runner_on_file_diff,playbook_on_start,playbook_on_notify,playbook_on_include,playbook_on_no_hosts_matched,playbook_on_no_hosts_remaining,playbook_on_task_start,playbook_on_vars_prompt,playbook_on_setup,playbook_on_import_for_host,playbook_on_not_import_for_host,playbook_on_play_start,playbook_on_stats,debug,verbose,deprecated,warning,system_warning,error}]
                       [--counter INTEGER] [--event_data JSON/YAML]
                       [--failed BOOLEAN] [--changed BOOLEAN]
                       [--uuid TEXT] [--parent_uuid TEXT] [--host ID]
                       [--host_name TEXT] [--playbook TEXT] [--play TEXT]
                       [--task TEXT] [--role TEXT] [--stdout TEXT]
                       [--start_line INTEGER] [--end_line INTEGER]
                       [--verbosity INTEGER]

--all

    fetch all pages of content from the API when returning results (instead of just the first page)

Reference: Ansible Tower/AWX CLI v3.8.3 User Guide

DataMinion
  • 126
  • 3
  • wow, at first I was embarrassed of not seeing this, BUT if (on manjaro) I call `awx job_events list --help` these parameters are not listed! Only when I execute an authenticated command like `awx --conf.host https://real.existing.host --conf.username real.existinguser --conf.password myCorrectPassword job_events list --help` I get the full help with all parameters like you have printed... thats very odd – MacMartin May 18 '21 at 07:37
  • No big deal. I miss a ton of stuff in documentation all of the time. Tends to happen when you have 50 tabs open in firefox. lol Glad to have helped. – DataMinion May 24 '21 at 14:41