# show exec command line arguments of ansible-playbook, ansible

**URL:** <https://forum.ansible.com/t/show-exec-command-line-arguments-of-ansible-playbook-ansible/20064>\
**Category:** Ansible Project\
**Created:** [December 22, 2015, 5:27pm UTC](https://forum.ansible.com/t/show-exec-command-line-arguments-of-ansible-playbook-ansible/20064 "2015-12-22T17:27:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jakub\_x](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@Jakub\_x](https://forum.ansible.com/u/Jakub_x)\
**Post date:** [December 22, 2015, 5:27pm UTC](https://forum.ansible.com/t/show-exec-command-line-arguments-of-ansible-playbook-ansible/20064/1 "2015-12-22T17:27:10Z")

</div>

Hi

I’ve been thinking what is the best ways of presenting actual command line “row” of the ansible/ansible-playbook execution.

It could be captured ‘before execution’ with a simple echo, but sometimes the escaping breaks the result (see the example below).  
The easiest what I’ve found is just adding print into ansible-playbook script.  
Before I do pull request, etc. - what do You think about it. Any better, easier, or ready-to-use solution?

Note, that presenting args after being parsed with argparse may destroy the view, I do not also wan’t to see variables form vault that may be parsed along way. Just CLI exec+arguments.

ansible-playbook

def main(args):  
‘’’ run ansible-playbook operations ‘’’  
**print args**  
(…)

Result:

$ ansible-playbook -i ~/ansible/etc/inv/inventory etc/playbooks/playbook.yml -e “system\_version=…/system\_version/prd\_default” -D -e ‘{“some\_key”: {“some\_other\_key”: “x12”}}’  
[‘-i’, ‘/home/useri/ansible/etc/inv/inventory’, ‘etc/playbooks/playbook.yml’, ‘-e’, ‘system\_version=…/system\_version/prd\_default’, ‘-D’, ‘-e’, ‘{“some\_key”: {“some\_other\_key”: “x12”}}’]  
^^ this result is enough 🙂 If we could have the exact CLI (for further copy-paste execution) would be even better

Broken escaping example:  
$ echo ansible-playbook -i ~/ansible/etc/inv/inventory etc/playbooks/playbook.yml -e “system\_version=…/system\_version/prd\_default” -D -e ‘{“some\_key”: {“some\_other\_key”: “x12”}}’

ansible-playbook -i /home/user/ansible/etc/inv/inventory etc/playbooks/playbook.yml -e system\_version=…/system\_version/prd\_default -D -e {“some\_key”: {“some\_other\_key”: “x12”}}

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [December 22, 2015, 5:41pm UTC](https://forum.ansible.com/t/show-exec-command-line-arguments-of-ansible-playbook-ansible/20064/2 "2015-12-22T17:41:39Z")

</div>

You may wish to take a look at the following PR: [https://github.com/ansible/ansible/pull/13412](https://github.com/ansible/ansible/pull/13412)

The above PR adds callback support based on verbosity to print out invocation information.
