Ansible CLI allows to run a custom shell command (done implicitly using the default module "ansible.builtin.command"):

ansible myhost -a "/bin/mycommand" 

Is it possible to do the same via tower-cli aka awx-cli?

EDIT: answers that use the awx CLI tool are acceptable; however, I'd prefer solutions that use tower-cli/awx-cli.

  • Regarding "I'd prefer solutions that use tower-cli/awx-cli" and since the awx command is part of the product AWX, do you mean exactly the commands tower-cli (deprecated) and awx-cli from awxkit (Python library that backs the provided awx command line client.)? I ask because according Red Hat Solution #4971631 is command awx is actually the "awx-cli".
    – U880D
    Jun 3 at 7:16
  • Yes. On my system (CentOS 7.9) these commands are two tiny Python scripts: a single call load_entry_point('ansible-tower-cli==3.3.9', 'console_scripts', 'tower-cli')() for tower-cli. awx-cli is identical except for the third arg of the function, which calls ..., 'awx-cli')().
    – dr_
    Jun 3 at 8:19

1 Answer 1


In short, the answer is yes.

According the Ansible Tower CLI Reference Guide, it is possible to do an awx ad_hoc_commands create resulting into a Job similar as others.

The parameter for --module_name would be shell or command and if configured for

ANSIBLE MODULES ALLOWED FOR AD HOC JOBS List of modules allowed to be used by ad-hoc jobs.

under Settings / Jobs.

The parameter for --module_args whould be your command as usual.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.