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

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

On Tue, Dec 22, 2015 at 11:27 AM, Jakub x <[email protected]> wrote:

> 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"}}
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f0b724db-b057-4475-847f-be3d38ed1010%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/f0b724db-b057-4475-847f-be3d38ed1010%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v8wnhBd8pzzAmtLZJU6eaP9Gx_j72cF0dkLn%2BN_HAbRdA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to