Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Boto3 required for this module" when using delegate_to #511

Closed
knightsg opened this Issue Jan 31, 2019 · 5 comments

Comments

Projects
None yet
2 participants
@knightsg
Copy link

commented Jan 31, 2019

Got another fun one for you :)

First up, info:

Linux 3.13.0-164-generic #214-Ubuntu SMP Wed Dec 5 10:42:33 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

ansible-playbook 2.6.12.post0 (stable-2.6 114d5c0368) last updated 2019/01/31 22:30:45 (GMT +000)
  config file = /var/jenkins/.ansible.cfg
  configured module search path = [u'/var/jenkins/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/ansible/ansible-2.6/lib/ansible
  executable location = /opt/ansible/ansible-2.6/bin/ansible-playbook
  python version = 2.7.6 (default, Nov 13 2018, 12:45:42) [GCC 4.8.4]

I believe I noticed this while I was helping troubleshoot the issue in #499, so it predates the fixes that were committed for that ticket. However, it's still happening for me since I pulled the latest master commits. We run ansible from a bunch of jenkins agents in various AWS VPCs, and when I run ansible on these hosts with mitogen enabled it fails at the following task, with the error message "Boto3 required for this module":

- name: gather ec2 facts for nagios
  become: False
  ec2_instance_facts:
    region: "{{ nagios_rds_region|default('us-east-1') }}"
    filters:
      instance-state-name: running
  delegate_to: 127.0.0.1
  register: nagios_ec2_instances

When I disable mitogen the task runs without error.

@dw

This comment has been minimized.

Copy link
Owner

commented Feb 1, 2019

Iinteresting :) How is boto installed? I think the magic here is "127.0.0.1" -- it is different (believe it or not) from the magic Ansible "localhost". The default transport is used -- so this is running as an SSH connection to the local machine, rather than as a simple subprocess using the inherited Python/virtualenv/whatever environment of the controller.

But in either case, it's a difference and we need to fix it.

Do you know how and where boto is installed on that machine? e.g. Debian package, virtualenv, etc. Also do you know which interpreter it is installed for? Master has subtle changes to python_path which I need to review before 0.2.4 is out -- it could be that Ansible is running with a different interpreter than the one used for '127.0.0.1'

@knightsg

This comment has been minimized.

Copy link
Author

commented Feb 1, 2019

It's installed with pip:

$ pip --version
pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)

$ pip freeze
boto==2.49.0
boto3==1.9.64
botocore==1.12.64

I'll try changing to localhost and see if that works.

@knightsg

This comment has been minimized.

Copy link
Author

commented Feb 1, 2019

I changed 127.0.0.1 to localhost and ran the playbook but it still fails with the same error unfortunately.

@dw dw added user-reported and removed user-reported labels Feb 10, 2019

@dw

This comment has been minimized.

Copy link
Owner

commented Feb 10, 2019

This might related to #476 -- does setting "-e ansible_python_interpreter=python" have any effect? Also try with "/usr/bin/python".

@dw dw closed this in 9040183 Feb 12, 2019

dw added a commit that referenced this issue Feb 12, 2019

Merge remote-tracking branch 'origin/dmw'
* origin/dmw:
  docs: update Changelog; closes #511, closes #536.
  docs: update Changelog release date.
  issue #536: disable transport_config tests on vanilla
  issue #536: restore correct Python interpreter selection behaviour.
  issue #536: connection_delegation/ tests were erroneously broken
  tests: define MITOGEN_INVENTORY_FILE even if -i unspecified.
  issue #536: add tests for each ansible_python_interpreter case.
  issue #536: stop defining explicit localhost in inventory.
  tests: allow running Ansible tests locally without -udmw again.
  stable: fix preamble_size on stable docs.
  issue #481: add test.
@dw

This comment has been minimized.

Copy link
Owner

commented Feb 12, 2019

0.2.5 will include this before the end of the week.

This is now on the master branch and will make it into the next release. To be updated when a new release is made, subscribe to https://www.freelists.org/list/mitogen-announce

Thanks for reporting this!

dw added a commit that referenced this issue Feb 14, 2019

Merge remote-tracking branch 'origin/dmw' into stable
* origin/dmw:
  issue #537: disable just the trivial LinuxPolicyTest on Travis.
  docs: update Changelog; closes #537.
  ansible: refactor affinity class and add abstract tests.
  Bump version for release.
  docs: update Changelog.
  core: serialize calls to _service_stub_main().
  docs: update Changelog; closes #532.
  issue #532: PushFileService race.
  docs: more concise Changelog.
  issue #541: changelog typos.
  ansible: quiesce boto logger; closes #541.
  docs: update Changelog.
  tests/ansible: Spec.port() test & mitogen_via= fix.
  Update copyright year everywhere.
  tests/ansible: Spec.become_pass() test.
  docs: remove top "Table of Contents" link
  docs: remove a little more top margin wastage
  tests/ansible: Spec.become_user() test.
  docs: update Changelog; closes #539.
  issue #539: disable logger propagation.
  ansible: capture stderr stream of async tasks. Closes #540.
  docs: update Changelog.
  issue #536: rework how 2.3-compatible simplejson is served
  .github: add some more questions to issue template
  docs: duplicate word
  docs: update Changelog.
  tests/ansible: Spec.become_method() test & mitogen_via= fix.
  setup.py: include LICENSE; closes #538.
  tests/ansible: Spec.become() test
  tests/ansible: Spec.password() test, document interactive pw limitation.
  tests/ansible: Spec.remote_user() test & mitogen_via= fix.
  tests/ansible: Spec.remote_addr() test & mitogen_via= fix.
  tests/ansible: Spec.transport() test.
  docs: lighter pink
  docs: add 'Fixes' heading
  docs: more margin tweaks for changelog
  docs: tighter <p> margins, even less shouting, red headings
  docs: tidy up footer and GitHub link
  docs: enable fixed_sidebar
  docs: sans-serif fonts, reduce shouty headings
  issue #536: add mitogen_via= tests too.
  ansible: fix a crash on 2.3 when mitogen_via= host is missing.
  tests: for 2.3 compatibility, disable gcloud.py for now
  docs: update Changelog; closes #511, closes #536.
  docs: update Changelog release date.
  issue #536: disable transport_config tests on vanilla
  issue #536: restore correct Python interpreter selection behaviour.
  issue #536: connection_delegation/ tests were erroneously broken
  tests: define MITOGEN_INVENTORY_FILE even if -i unspecified.
  issue #536: add tests for each ansible_python_interpreter case.
  issue #536: stop defining explicit localhost in inventory.
  tests: allow running Ansible tests locally without -udmw again.
  stable: fix preamble_size on stable docs.
  issue #481: add test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.