question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ansible+Mitogen ignores interpreter_python global variable

See original GitHub issue

Hello,

I’m running the Git version of Mitogen as of commit a60c6c14a2473c895162a1b58a81bad0e63d1718. It seems that after the changes in #658, Ansible+Mitogen respects the ansible_interpreter_python variable, but not the [defaults]/interpreter_python of ansible.cfg, as described in https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html#interpreter-discovery. Although this can be easily worked around, I do find the current behaviour a bit confusing.


I’m running ansible 2.9.9+dfsg-1 from Debian unstable on my host:

$ ansible --version
ansible 2.9.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/james/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.8.5 (default, Aug  2 2020, 15:09:07) [GCC 10.2.0]

The target machines run Debian 10 with Python 2.7.16 and 3.7.3 installed.

Expected behaviour (strategy=linear)

$ ansible staging -m setup -a 'filter=ansible_python_version'
redacted.hostname | SUCCESS => {
    "ansible_facts": {
        "ansible_python_version": "3.7.3"
    },
    "changed": false
}
redacted.hostname | SUCCESS => {
    "ansible_facts": {
        "ansible_python_version": "3.7.3"
    },
    "changed": false
}

Behaviour with strategy=mitogen_linear:

$ ansible staging -m setup -a 'filter=ansible_python_version'
[WARNING]: Platform linux on host redacted.hostname is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.
redacted.hostname | SUCCESS => {
    "ansible_facts": {
        "ansible_python_version": "2.7.16",
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false
}
[WARNING]: Platform linux on host redacted.hostname is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.
redacted.hostname | SUCCESS => {
    "ansible_facts": {
        "ansible_python_version": "2.7.16",
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false
}

Editted by @moreati: clarify variable vs config distinction.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:9

github_iconTop GitHub Comments

4reactions
s1113950commented, Aug 31, 2020

😱 oh no, I missed interpreter_python support when adding in #658 . Definitely a bug, not sure when I’ll be able to get to this but it’ll be fixed up at some point 👍 thanks for filing.

2reactions
yoonsikpcommented, Nov 21, 2020

Best solution is to make a group_vars/all.yml for each of your inventories, with:

ansible_python_interpreter: /usr/bin/python3

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ansible+Mitogen ignores interpreter_python global variable
Hello,. I'm running the Git version of Mitogen as of commit a60c6c1. It seems that after the changes in #658, Ansible+Mitogen respects the ......
Read more >
Mitogen for Ansible
Mitogen for Ansible is a completely redesigned UNIX connection layer and module runtime for Ansible. Requiring minimal configuration changes, it updates ...
Read more >
Ansible ignoring ansible_python_interpreter as command line ...
as you can see from the code snippet below, ansible's executable seems to be ignoring the ansible_python_interpreter variable.
Read more >
subject:"\[ansible\-project\] Re - The Mail Archive
[for Open SUSE] > > Do I need the python module virtualenv? ... If it's ignoring tags, > whatever solution you tried to...
Read more >
Ansible Contributor Summit 2021.09 - HackMD
This is your opportunity to meet with many members of the Ansible ... modules and reuse python interpreter instances (ala mitogen) on target ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found