How to trace/debug Ansible EC2 ?

314 views
Skip to first unread message

Tzach Livyatan

unread,
Mar 16, 2016, 3:13:17 AM3/16/16
to Ansible Project
Hello
I have a problem with a simple Ansible playbook which launch an EC2 instance.
The instance configuration is slightly different (different block-device-mapping) when I launch the same AMI from EC2 dashboard.
To debug, I would like to see the exact AWS command Ansible/Boto runs.
ansible-playbook -vvv option does not provide it, how can I go deeper into the code and traces?

Thanks
Tzach

James Cammarata

unread,
Mar 16, 2016, 9:57:38 AM3/16/16
to ansible...@googlegroups.com
Since the ec2 modules use boto, which doesn't really execute commands, your best bet is to run your playbook with the environment variable ANSIBLE_KEEP_REMOTE_FILES=1 set, and with -vvv. This will allow you to examine the modules left on the target system (most likely localhost) and run them directly with your Python debugging method of choice (epdb, etc.).

James Cammarata

Ansible Lead/Sr. Principal Software Engineer
Ansible by Red Hat
twitter: @thejimic, github: jimi-c

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8b3563dd-5325-464f-be7b-21e9c16ad257%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tzach Livyatan

unread,
Mar 16, 2016, 11:09:18 AM3/16/16
to ansible...@googlegroups.com
On Wed, Mar 16, 2016 at 3:57 PM, James Cammarata <jcamm...@ansible.com> wrote:
Since the ec2 modules use boto, which doesn't really execute commands, your best bet is to run your playbook with the environment variable ANSIBLE_KEEP_REMOTE_FILES=1 set, and with -vvv. This will allow you to examine the modules left on the target system (most likely localhost) and run them directly with your Python debugging method of choice (epdb, etc.).
Thanks I will try
Was not aware of ANSIBLE_KEEP_REMOTE_FILES=1


 

James Cammarata

Ansible Lead/Sr. Principal Software Engineer
Ansible by Red Hat
twitter: @thejimic, github: jimi-c

On Wed, Mar 16, 2016 at 3:13 AM, Tzach Livyatan <tz...@cloudius-systems.com> wrote:
Hello
I have a problem with a simple Ansible playbook which launch an EC2 instance.
The instance configuration is slightly different (different block-device-mapping) when I launch the same AMI from EC2 dashboard.
To debug, I would like to see the exact AWS command Ansible/Boto runs.
ansible-playbook -vvv option does not provide it, how can I go deeper into the code and traces?

Thanks
Tzach

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/8b3563dd-5325-464f-be7b-21e9c16ad257%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/L-QByuAkm5I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.

To post to this group, send email to ansible...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages