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

interpreter_python set to auto_legacy not working as expected #77840

Open
1 task done
StoneCut opened this issue May 18, 2022 · 15 comments
Open
1 task done

interpreter_python set to auto_legacy not working as expected #77840

StoneCut opened this issue May 18, 2022 · 15 comments
Assignees
Labels
affects_2.12 bug This issue/PR relates to a bug. module This issue/PR relates to a module. P3 Priority 3 - Approved, No Time Limitation support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@StoneCut
Copy link

Summary

After upgrading our Ansible server from Ubuntu 18.04 to 22.04 and reinstalling Ansible via PIP to the latest version we are now experiencing issues when running setup module (gather_facts) on a lot of hosts.

Ansible always attempts to use the discovered /usr/bin/python3 interpreter even if it is too old but the alternative python2 installation on the remote host is sufficient.

Here is an example error (from gather_facts stage):

"discovered_interpreter_python": "/usr/bin/python3"
 "msg": "ansible-core requires a minimum of Python2 version 2.6 or Python3 version 3.5. Current version: 3.4.10 (default, Dec 13 

The following modules failed to execute: ansible.legacy.setup

These are the installed interpreters on a sample remote host that produces the error:

someserver:~ # **which python && python --version**
/usr/bin/python
Python 2.7.13

someserver~ # **which python3 && python3 --version**
/usr/bin/python3
Python 3.4.10

As you can see, the default /usr/bin/python is sufficient (v2.7.13) whereas /usr/bin/python3 is too old (v3.4.10).
I thought that interpreter_python = auto_legacy is supposed to try /usr/bin/python first?

Issue Type

Bug Report

Component Name

setup

Ansible Version

$ ansible --version

ansible [core 2.12.5]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/etc/ansible/library']
  ansible python module location = /usr/local/lib/python3.10/dist-packages/ansible
  ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0]
  jinja version = 3.1.2
  libyaml = True

Configuration

$ ansible-config dump --only-changed -t all

ANSIBLE_NOCOWS(/etc/ansible/ansible.cfg) = True
DEFAULT_BECOME_FLAGS(/etc/ansible/ansible.cfg) = -H -S
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = ['/etc/ansible/inventory.py']
DEFAULT_MODULE_PATH(/etc/ansible/ansible.cfg) = ['/etc/ansible/library']
DEFAULT_REMOTE_USER(/etc/ansible/ansible.cfg) = ansible
DEFAULT_ROLES_PATH(/etc/ansible/ansible.cfg) = ['/etc/ansible/playbooks/roles', '/etc/ansible/XXX_test/roles', '/etc/ansible/edi-playbooks/roles', '/etc/ansible/YYY_test/roles', '/etc/ansible/ZZZ_test/roles']
DEFAULT_STDOUT_CALLBACK(/etc/ansible/ansible.cfg) = debug
DEFAULT_VAULT_PASSWORD_FILE(/etc/ansible/ansible.cfg) = /etc/ansible/.vault_pass
INTERPRETER_PYTHON(/etc/ansible/ansible.cfg) = auto_legacy
PERSISTENT_CONNECT_TIMEOUT(/etc/ansible/ansible.cfg) = 30
RETRY_FILES_ENABLED(/etc/ansible/ansible.cfg) = False

BECOME:
======

runas:
_____
become_flags(/etc/ansible/ansible.cfg) = -H -S

su:
__
become_flags(/etc/ansible/ansible.cfg) = -H -S

sudo:
____
become_flags(/etc/ansible/ansible.cfg) = -H -S

CACHE:
=====

CALLBACK:
========

CLICONF:
=======

CONNECTION:
==========

paramiko_ssh:
____________
remote_user(/etc/ansible/ansible.cfg) = ansible

ssh:
___
control_path(/etc/ansible/ansible.cfg) = %(directory)s/%%h-%%r
remote_user(/etc/ansible/ansible.cfg) = ansible

HTTPAPI:
=======

INVENTORY:
=========

LOOKUP:
======

NETCONF:
=======

SHELL:
=====

VARS:
====

OS / Environment

Target OS:
Many, but for the example above it's SLES 12.5.

Steps to Reproduce

  1. Implement the following playbook:
---
- hosts: someserver.somedomain.net
  # Above is a host that has python 2.7.13 and python 3.4.10 installed
  gather_facts: yes
  tasks:
    - name: Dummy
      debug:
        msg: "This is a dummy task that will not be executed since python3 version is too old and auto_legacy doesn't appear to work."
  1. Then run ANSIBLE_DEBUG=1 ansible-playbook test.yml -vvvvv against a server that has python 2.7.13 (sufficient) and python 3.4.10 (too old) installed.
  2. An error occurs despite setting interpreter_python = auto_legacy in ansible.cfg

Expected Results

Receive facts.

Actual Results

debug1: Reading configuration data /home/ansible/.ssh/config
debug1: /home/ansible/.ssh/config line 1: Applying options for *
debug3: kex names ok: [diffie-hellman-group1-sha1]
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/ansible/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/ansible/.ssh/known_hosts2'
debug1: auto-mux: Trying existing master
debug2: fd 3 setting O_NONBLOCK
debug2: mux_client_hello_exchange: master version 4
debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
debug3: mux_client_request_session: entering
debug3: mux_client_request_alive: entering
debug3: mux_client_request_alive: done pid = 5094
debug3: mux_client_request_session: session request sent
debug1: mux_client_request_session: master session id: 2
debug3: mux_client_read_packet: read header failed: Broken pipe
debug2: Received exit status from master 0
  5090 1652881449.85828: handler run complete
  5090 1652881449.85846: variable 'ansible_facts' from source: unknown
  5090 1652881449.85938: variable 'ansible_facts' from source: unknown
  5090 1652881449.85992: attempt loop complete, returning result
  5090 1652881449.85999: _execute() done
  5090 1652881449.86003: dumping result to json
  5090 1652881449.86008: done dumping result, returning
  5090 1652881449.86015: done running TaskExecutor() for someserver.somedomain.net/TASK: Gathering Facts [6b03a8d6-8e57-6ee7-962c-0000000001da]
  5090 1652881449.86023: sending task result for task 6b03a8d6-8e57-6ee7-962c-0000000001da
  5090 1652881449.86093: done sending task result for task 6b03a8d6-8e57-6ee7-962c-0000000001da
  5090 1652881449.86136: WORKER PROCESS EXITING
  5081 1652881449.86261: marking someserver.somedomain.net as failed
  5081 1652881449.86277: marking host someserver.somedomain.net failed, current state: HOST STATE: block=0, task=0, rescue=0, always=0, run_state=ITERATING_SETUP, fail_state=FAILED_NONE, pending_setup=True, tasks child state? (None), rescue child state? (None), always child state? (None), did rescue? False, did start at task? False
  5081 1652881449.86283: ^ failed state is now: HOST STATE: block=0, task=0, rescue=0, always=0, run_state=ITERATING_COMPLETE, fail_state=FAILED_SETUP, pending_setup=True, tasks child state? (None), rescue child state? (None), always child state? (None), did rescue? False, did start at task? False
  5081 1652881449.86287: getting the next task for host someserver.somedomain.net
  5081 1652881449.86289: host someserver.somedomain.net is done iterating, returning
fatal: [someserver.somedomain.net]: FAILED! => {
    "ansible_facts": {},
    "changed": false,
    "failed_modules": {
        "ansible.legacy.setup": {
            "ansible_facts": {
                "discovered_interpreter_python": "/usr/bin/python3"
            },
            "failed": true,
            "msg": "ansible-core requires a minimum of Python2 version 2.6 or Python3 version 3.5. Current version: 3.4.10 (default, Dec 13 2019, 16:20:47) [GCC]",
            "warnings": [
                "Platform linux on host someserver.somedomain.net is using the discovered Python interpreter at /usr/bin/python3, but future installation of another Python interpreter could change the meaning of that path. See https://docs.ansible.com/ansible-core/2.12/reference_appendices/interpreter_discovery.html for more information."
            ]
        }
    }
}

MSG:

The following modules failed to execute: ansible.legacy.setup

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot
Copy link
Contributor

ansibot commented May 18, 2022

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.12 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels May 18, 2022
@StoneCut
Copy link
Author

StoneCut commented May 18, 2022

Additional info:
As an interim solution we just reverted to a previous snapshot with Ubuntu 18.04 and ansible 2.11.6 and I ran ansible -m setup against the same host as above.

Now the "discovered_interpreter_python" is "/usr/bin/python" and that is even with "auto_silent" or "auto_legacy".

Did something change inbetween these two releases regarding the handling of "discovered_interpreter_python"?

@sivel
Copy link
Member

sivel commented May 18, 2022

Please run your playbook with at least -vvv and provide the full output. Feel free to restrict to just a single host and a single task that replicates the behavior.

I see you ran with ANSIBLE_DEBUG and -vvvv but did not provide enough of the output. Feel free to put it on gist.github.com and link to it here.

@StoneCut
Copy link
Author

StoneCut commented May 19, 2022

You can find the full log (-vvv) here:
https://gist.github.com/StoneCut/195d8b1db852a750096833c032fc56de
(Btw: This is now on Ubuntu 20.04 with Python 3.8.10 and Ansible 2.12.5) - same problem.

@sivel
Copy link
Member

sivel commented May 19, 2022

Relevant Logs...

<server-arc-a07t.somedomain.net> Attempting python interpreter discovery
  9394 1652948516.40136: _low_level_execute_command(): starting
  9394 1652948516.40143: _low_level_execute_command(): executing: /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'python3.10'"'"'; command -v '"'"'python3.9'"'"'; command -v '"'"'python3.8'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'python2.6'"'"'; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && sleep 0'
<server-arc-a07t.somedomain.net> ESTABLISH SSH CONNECTION FOR USER: ansible
<server-arc-a07t.somedomain.net> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=10 -o 'ControlPath="/home/ansible/.ansible/cp/%h-%r"' server-arc-a07t.somedomain.net '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'python3.10'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.9'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.8'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
  9394 1652948516.48635: stdout chunk (state=2):
>>>PLATFORM
<<<
  9394 1652948516.48676: stdout chunk (state=3):
>>>Linux
<<<
  9394 1652948516.48687: stdout chunk (state=3):
>>>FOUND
<<<
  9394 1652948516.48729: stdout chunk (state=3):
>>>/usr/bin/python3
/usr/bin/python2.7
/usr/bin/python
/usr/bin/python
ENDFOUND
<<<
  9394 1652948516.48935: stderr chunk (state=3):
>>><<<
  9394 1652948516.48948: stdout chunk (state=3):
>>><<<
<server-arc-a07t.somedomain.net> (0, b'PLATFORM\nLinux\nFOUND\n/usr/bin/python3\n/usr/bin/python2.7\n/usr/bin/python\n/usr/bin/python\nENDFOUND\n', b'')
  9394 1652948516.49003: _low_level_execute_command() done: rc=0, stdout=PLATFORM
Linux
FOUND
/usr/bin/python3
/usr/bin/python2.7
/usr/bin/python
/usr/bin/python
ENDFOUND
, stderr=
  9394 1652948516.49022 [server-arc-a07t.somedomain.net]: found interpreters: ['/usr/bin/python3', '/usr/bin/python2.7', '/usr/bin/python', '/usr/bin/python']
  9394 1652948516.49153: _low_level_execute_command(): starting
  9394 1652948516.49171: _low_level_execute_command(): executing: /bin/sh -c '/usr/bin/python3 && sleep 0'
<server-arc-a07t.somedomain.net> ESTABLISH SSH CONNECTION FOR USER: ansible
<server-arc-a07t.somedomain.net> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansible"' -o ConnectTimeout=10 -o 'ControlPath="/home/ansible/.ansible/cp/%h-%r"' server-arc-a07t.somedomain.net '/bin/sh -c '"'"'/usr/bin/python3 && sleep 0'"'"''
  9394 1652948516.49779: Sending initial data
  9394 1652948516.49800: Sent initial data (1234 bytes)
  9394 1652948516.56508: stdout chunk (state=3):
>>>{"osrelease_content": "NAME=\"SLES\"\nVERSION=\"12-SP5\"\nVERSION_ID=\"12.5\"\nPRETTY_NAME=\"SUSE Linux Enterprise Server 12 SP5\"\nID=\"sles\"\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:/o:suse:sles:12:sp5\"\n", "platform_dist_result": ["SuSE", "12", "x86_64"]}
<<<
  9394 1652948516.57181: stderr chunk (state=3):
>>><<<
  9394 1652948516.57191: stdout chunk (state=3):
>>><<<
<server-arc-a07t.somedomain.net> (0, b'{"osrelease_content": "NAME=\\"SLES\\"\\nVERSION=\\"12-SP5\\"\\nVERSION_ID=\\"12.5\\"\\nPRETTY_NAME=\\"SUSE Linux Enterprise Server 12 SP5\\"\\nID=\\"sles\\"\\nANSI_COLOR=\\"0;32\\"\\nCPE_NAME=\\"cpe:/o:suse:sles:12:sp5\\"\\n", "platform_dist_result": ["SuSE", "12", "x86_64"]}\n', b'')
  9394 1652948516.57226: _low_level_execute_command() done: rc=0, stdout={"osrelease_content": "NAME=\"SLES\"\nVERSION=\"12-SP5\"\nVERSION_ID=\"12.5\"\nPRETTY_NAME=\"SUSE Linux Enterprise Server 12 SP5\"\nID=\"sles\"\nANSI_COLOR=\"0;32\"\nCPE_NAME=\"cpe:/o:suse:sles:12:sp5\"\n", "platform_dist_result": ["SuSE", "12", "x86_64"]}
, stderr=
<server-arc-a07t.somedomain.net> Python interpreter discovery fallback (unsupported Linux distribution: SuSE)

[...]

  9394 1652948516.70604: _low_level_execute_command(): executing: /bin/sh -c '/usr/bin/python3 /home/ansible/.ansible/tmp/ansible-tmp-1652948516.0398662-9394-90105837501334/AnsiballZ_setup.py && sleep 0'

[...]

fatal: [server-arc-a07t.somedomain.net]: FAILED! => {
    "ansible_facts": {},
    "changed": false,
    "failed_modules": {
        "ansible.legacy.setup": {
            "ansible_facts": {
                "discovered_interpreter_python": "/usr/bin/python3"
            },
            "failed": true,
            "msg": "ansible-core requires a minimum of Python2 version 2.6 or Python3 version 3.5. Current version: 3.4.10 (default, Dec 13 2019, 16:20:47) [GCC]"
        }
    }
}

@sivel
Copy link
Member

sivel commented May 19, 2022

Ok, after a whole lot of testing, I've been able to verify this.

It only happens if the distro is not listed in INTERPRETER_PYTHON_DISTRO_MAP (regardless of version, the distro key must be missing)

Ultimately the change was introduced in fa7482c

Based on what I now see, this seems both partly expected, and partly unexpected.

The reason that /usr/bin/python was ultimately preferred in this case is that it was at the front of the checks, and now it's at the end.

auto_legacy was never responsible for choosing /usr/bin/python for distros not in the map.

I think we may need something like this to resolve the problem:

diff --git a/lib/ansible/executor/interpreter_discovery.py b/lib/ansible/executor/interpreter_discovery.py
index e821b9beec..32961155c2 100644
--- a/lib/ansible/executor/interpreter_discovery.py
+++ b/lib/ansible/executor/interpreter_discovery.py
@@ -112,11 +112,12 @@ def discover_interpreter(action, interpreter_name, discovery_mode, task_vars):
 
         family = OS_FAMILY_LOWER.get(distro.lower().strip())
 
-        version_map = platform_python_map.get(distro.lower().strip()) or platform_python_map.get(family)
-        if not version_map:
-            raise NotImplementedError('unsupported Linux distribution: {0}'.format(distro))
+        version_map = platform_python_map.get(distro.lower().strip()) or platform_python_map.get(family) or {}
 
-        platform_interpreter = to_text(_version_fuzzy_match(version, version_map), errors='surrogate_or_strict')
+        try:
+            platform_interpreter = to_text(_version_fuzzy_match(version, version_map), errors='surrogate_or_strict')
+        except Exception as e:
+            platform_interpreter = None
 
         # provide a transition period for hosts that were using /usr/bin/python previously (but shouldn't have been)
         if is_auto_legacy:

The above diff needs expanded to do a few extra things:

  1. not fire the is missing from bootstrap list warning

  2. Reword the following error message:

    [WARNING]: Distribution opensuse-leap 15.3 on host 192.168.7.160 should use None
    

Perhaps instead of setting platform_interpreter = None we should do platform_interpreter = bootstrap_python_list[0]

@nitzmahone nitzmahone self-assigned this May 19, 2022
@mattclay mattclay added P3 Priority 3 - Approved, No Time Limitation and removed needs_triage Needs a first human triage before being processed. labels May 19, 2022
@StoneCut
Copy link
Author

Thank you for your testing. Looking forward to a solution.

@nbttmbrg
Copy link

Exact same issue on multiple SLES clients

@matya
Copy link

matya commented Sep 20, 2022

Same issue here, SLES clients.

@matya
Copy link

matya commented Sep 20, 2022

I managed to get it working by patching ansible/config/base.yml with this:

     ubuntu:
       '14': /usr/bin/python
       '16': /usr/bin/python3
+    suse:
+      '12': /usr/bin/python2.7
+      '15': /usr/bin/python3
   version_added: "2.8"
   # FUTURE: add inventory override once we're sure it can't be abused by a rogue target
   # FUTURE: add a platform layer to the map so we could use for, eg, freebsd/macos/etc?

As far I see there is no way other than fixing the version by setting interpreter_python globally or patching that file, since INTERPRETER_PYTHON_DISTRO_MAP is not exposed and INTERPRETER_PYTHON_FALLBACK is not honored if a python3 is found, even if it is an old 3.4 one...

I find it slightly unfortunate to not have a way to have this configurable, since there are so many options to influence ansible's use of python, but exactly this is missing, which makes is very hard to deal with the issue.

@bcoca
Copy link
Member

bcoca commented Sep 20, 2022

it is configurable, (as you mention globally, by setting interpreter_python) or per group/host by setting ansible_python_interpreter` as a variable.

@NoLdman
Copy link

NoLdman commented Nov 15, 2022

@boca, I think @sivel already tried to explain it and I can reproduce it as well:

I could reproduce it on a SuSe v42.3 client-server having Python v2.7 and Python v3.4 installed at the same time (from the repositories), whilst running Ansible v2.12.2 on Rocky v9.

I tried following w/o success:

  1. Setting interpreter_python in the [default] section of the ansible-config.
  2. Setting ansible_python_interpreter in group_vars/<GROUPNAME>.yml
  3. Setting ansible_python_interpreter in host_vars/<HOSTNAME>.yml
  4. Setting ansible_python_interpreter on the same line of the host in the inventory-file

In all of the four above mentioned variations I tried auto_legacy as well as the absolute python-path of /usr/bin/python2.7.

The only thing that did the trick, was the bodge of adapting /usr/lib/python<CURRENT_VERSION>/site-packages/ansible/config/base.yml on the Rocky v9 machine as follow:

    ubuntu:
      '14': /usr/bin/python
      '16': /usr/bin/python3
    suse:
      '42': /usr/bin/python # Python2.7 is aliased to 'python` in Suse 42.3

PS: Since I'm not sure, if adapting (fixing) the logic of the check itself may have some weird side-effects: What speaks against appending the INTERPRETER_PYTHON_DISTRO_MAP for SUSE-Linux?

@matya
Copy link

matya commented Nov 16, 2022

@bcoca your argument depends on that you know in advance in your inventory, what server you are managing down to the OS version, at the time you are starting to use ansible.

We for example have a highly complex environment, and I would rather not like to establish a database connection from my ansible host to our central ops DB, just so I can retrieve the OS Version to dynamically generate an inventory entry, just so I can set the interpreter.

I personally worked around it by manually patching the base.yml in our ansible stack, and continuously recommend adding these OS Versions by upstream also to the list.

There is already Ubuntu 14/16 in it, which I assume has a valid reason to it, and exactly because of these issues detailed above, it would be highly appreciated and reasonable to also include the specialized case of well-defined OS versions, where python 3 is in an unsupported / old version, but an usable version with python2.7 still exists...

I personally believe not honoring INTERPRETER_PYTHON_FALLBACK if the found python3 version is not supported is a bug, but YMMV.

@chilicheech
Copy link

I ran into a similar issue with Centos 6. The base.yml has this:

    redhat:
      '6': /usr/bin/python

which I believe is what Centos falls under. The system also has python2.7 in the path, but ansible looks at /usr/bin/python and sees that it's python2.6 and doesn't fallback to using a python from the fallback list. The fallback list has python2.7 in it, so it should use it if the one in the map isn't supported.

@zhangguanzhang
Copy link

zhangguanzhang commented Mar 28, 2023

same issue if remote is suse12

cp /usr/lib/python3/dist-packages/ansible/config/base.yml{,.bak}
sed_num=$(awk '/INTERPRETER_PYTHON_DISTRO_MAP:/,/default:/{a=NR}END{print a+1}'  /usr/lib/python3/dist-packages/ansible/config/base.yml)
sed -ri "${sed_num}i \ \ \ \ suse:\n      '12': /usr/bin/python2.7"  /usr/lib/python3/dist-packages/ansible/config/base.yml
diff /usr/lib/python3/dist-packages/ansible/config/base.yml{,.bak}
1534,1535d1533
<     suse:
<       '12': /usr/bin/python2.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects_2.12 bug This issue/PR relates to a bug. module This issue/PR relates to a module. P3 Priority 3 - Approved, No Time Limitation support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

No branches or pull requests