# turn on boto debugging in Ansible (~/.boto)

**URL:** <https://forum.ansible.com/t/turn-on-boto-debugging-in-ansible-boto/21562>\
**Category:** Ansible Project\
**Created:** [May 25, 2016, 11:59am UTC](https://forum.ansible.com/t/turn-on-boto-debugging-in-ansible-boto/21562 "2016-05-25T11:59:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cosbug](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@cosbug](https://forum.ansible.com/u/cosbug)\
**Post date:** [May 25, 2016, 11:59am UTC](https://forum.ansible.com/t/turn-on-boto-debugging-in-ansible-boto/21562/1 "2016-05-25T11:59:57Z")

</div>

Hi All,

Is there any way to turn on boto debugging for Ansible playbooks?

In user home directory I created .boto file with contents:

`[Boto] debug = 2`

But Ansible doesn’t pick it up though the python script which invokes boto prints the debug messages fine.

Any ideas?

Regards,  
Constantin

---

<div class="post-metadata">

**Author:** ![MB1](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@MB1](https://forum.ansible.com/u/MB1)\
**Post date:** [March 8, 2018, 8:41am UTC](https://forum.ansible.com/t/turn-on-boto-debugging-in-ansible-boto/21562/2 "2018-03-08T08:41:30Z")

</div>

Had the same issue.

Here’s what I did to get Boto debug working. Maybe some of these steps are not needed, I didn’t take the time to investigate more.

1. Created a ~/.boto.cfg file as you did, with the following content (I put my AWS credentials here on purpose):

`  
[Boto]  
debug = 2

[Credentials]  
aws\_access\_key\_id = …  
aws\_secret\_access\_key = …

`

1. Made sure to **delete** ~/.aws/credentials so that Ansible picks up the previous Boto config file

2. and the most ugly part, monkey-patched the Ansible module I wanted to test (ec2\_elb) to redirect Boto logs to a file, since I could never get the console/stdout output to work.  
On my system, the module I wanted Boto debug for was located in /Library/Python/2.7/site-packages/ansible/modules/cloud/amazon/ec2\_elb.py.

Just after the various import boto, import boto.ec2… lines, I added

`  
boto.set\_file\_logger(‘boto’, ‘boto.log’, level=2)

`

This creates the “boto.log” log file in the current directory from where you’ll run your ansible-playbook comand.

---

<div class="post-metadata">

**Author:** ![james\_dupont](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@james\_dupont](https://forum.ansible.com/u/james_dupont)\
**Post date:** [January 23, 2020, 12:52pm UTC](https://forum.ansible.com/t/turn-on-boto-debugging-in-ansible-boto/21562/3 "2020-01-23T12:52:44Z")

</div>

Hi all,  
using strace on the ansiballz

strace -o st -s 9999 -e openat,open,readlink,stat,lstat -f python3.7 /home/mdupont/.ansible/tmp/ansible-tmp-1579783694.3938165-128929969192073/AnsiballZ\_sqs\_queue.py

Shows

7150 openat(AT\_FDCWD, “/etc/boto.cfg”, O\_RDONLY|O\_CLOEXEC) = -1 ENOENT (No such file or directory)  
7150 openat(AT\_FDCWD, “/home/mdupont/.boto”, O\_RDONLY|O\_CLOEXEC) = -1 ENOENT (No such file or directory)  
7150 openat(AT\_FDCWD, “/etc/boto.cfg”, O\_RDONLY|O\_CLOEXEC) = -1 ENOENT (No such file or directory)  
7150 openat(AT\_FDCWD, “/home/mdupont/.boto”, O\_RDONLY|O\_CLOEXEC) = -1 ENOENT (No such file or directory)

Copying ~/.boto.cfg to ~/.boto does the trick!

hope this helps someone,

mike
