-
-
Notifications
You must be signed in to change notification settings - Fork 57
Description
Describe the bug
Unable to run bootstrap role on vanilla alpine (virtual ISO) install due to missing python intepreter.
I am trying to run the bootstrap role on a brand new VM with alpine installed. Using alpine virtual ISO to install with default params.
Given that alpine installs extremely lightweight, there is no default python interpreter in the installation process, yet I was expecting that this bootstrap role would have detected it and installed python.
Running with gather_facts: true fails with the same error message but in the [Gathering Facts] task earlier.
Disabling the bootstrap_wait_for_host, will get the process moving a bit further; however it fails in that it cannot install sudo in the main repository. And the community repository is disabled by default in the alpine installation
alpine-pihole:~# cat /etc/apk/repositories
#/media/cdrom/apks
http://dl-cdn.alpinelinux.org/alpine/v3.21/main
#http://dl-cdn.alpinelinux.org/alpine/v3.21/community
http://dl-cdn.alpinelinux.org/alpine/v3.21/main
#http://dl-cdn.alpinelinux.org/alpine/v3.21/community
Playbook
---
roles:
- name: robertdebock.bootstrap
---
- name: Initial configuration of a server.
hosts: servers
gather_facts: false
roles:
- role: robertdebock.bootstrap
vars:
# Do you want to wait for the host to be available?
bootstrap_wait_for_host: true
# The number of seconds you want to wait during connection test before failing.
bootstrap_timeout: 3
# Tell the role to "become" or not.
bootstrap_become: false
# ansible-playbook -i inventory/hosts.yml alpine-bootstrap.yml --ask-pass -vvv
Output
TASK [robertdebock.bootstrap : Wait for port to be available] ********************************************************************************************************************************************************************************************************************************************************************
task path: /root/.ansible/roles/robertdebock.bootstrap/tasks/main.yml:10
<192.168.2.203> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.2.203> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="root"' -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o 'ControlPath="/root/.ansible/cp/9c535925cf"' 192.168.2.203 '/bin/sh -c '"'"'echo ~root && sleep 0'"'"''
<192.168.2.203> (0, b'/root\n', b'')
<192.168.2.203> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.2.203> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="root"' -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o 'ControlPath="/root/.ansible/cp/9c535925cf"' 192.168.2.203 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1746891147.024705-165-7473552945599 `" && echo ansible-tmp-1746891147.024705-165-7473552945599="` echo /root/.ansible/tmp/ansible-tmp-1746891147.024705-165-7473552945599 `" ) && sleep 0'"'"''
<192.168.2.203> (0, b'ansible-tmp-1746891147.024705-165-7473552945599=/root/.ansible/tmp/ansible-tmp-1746891147.024705-165-7473552945599\n', b'')
<alpine-pihole> Attempting python interpreter discovery
<192.168.2.203> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.2.203> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="root"' -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o 'ControlPath="/root/.ansible/cp/9c535925cf"' 192.168.2.203 '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'python3.11'"'"'"'"'"'"'"'"'; 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 '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
<192.168.2.203> (0, b'PLATFORM\nLinux\nFOUND\nENDFOUND\n', b'')
Using module file /usr/lib/python3.9/site-packages/ansible/modules/wait_for.py
<192.168.2.203> PUT /root/.ansible/tmp/ansible-local-153dugcvwhv/tmpbqqk2bvs TO /root/.ansible/tmp/ansible-tmp-1746891147.024705-165-7473552945599/AnsiballZ_wait_for.py
<192.168.2.203> SSH: EXEC sshpass -d10 sftp -o BatchMode=no -b - -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/root/.ansible/cp/9c535925cf"' '[192.168.2.203]'
<192.168.2.203> (0, b'sftp> put /root/.ansible/tmp/ansible-local-153dugcvwhv/tmpbqqk2bvs /root/.ansible/tmp/ansible-tmp-1746891147.024705-165-7473552945599/AnsiballZ_wait_for.py\n', b'')
<192.168.2.203> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.2.203> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="root"' -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o 'ControlPath="/root/.ansible/cp/9c535925cf"' 192.168.2.203 '/bin/sh -c '"'"'chmod u+x /root/.ansible/tmp/ansible-tmp-1746891147.024705-165-7473552945599/ /root/.ansible/tmp/ansible-tmp-1746891147.024705-165-7473552945599/AnsiballZ_wait_for.py && sleep 0'"'"''
<192.168.2.203> (0, b'', b'')
<192.168.2.203> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.2.203> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="root"' -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o 'ControlPath="/root/.ansible/cp/9c535925cf"' -tt 192.168.2.203 '/bin/sh -c '"'"'/usr/bin/python /root/.ansible/tmp/ansible-tmp-1746891147.024705-165-7473552945599/AnsiballZ_wait_for.py && sleep 0'"'"''
<192.168.2.203> (127, b'/bin/sh: /usr/bin/python: not found\r\n', b'Shared connection to 192.168.2.203 closed.\r\n')
<192.168.2.203> Failed to connect to the host via ssh: Shared connection to 192.168.2.203 closed.
<192.168.2.203> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.2.203> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o 'User="root"' -o ConnectTimeout=10 -o StrictHostKeyChecking=no -o 'ControlPath="/root/.ansible/cp/9c535925cf"' 192.168.2.203 '/bin/sh -c '"'"'rm -f -r /root/.ansible/tmp/ansible-tmp-1746891147.024705-165-7473552945599/ > /dev/null 2>&1 && sleep 0'"'"''
<192.168.2.203> (0, b'', b'')
[WARNING]: No python interpreters found for host alpine-pihole (tried ['python3.11', 'python3.10', 'python3.9', 'python3.8', 'python3.7', 'python3.6', 'python3.5', '/usr/bin/python3', '/usr/libexec/platform-python', 'python2.7', '/usr/bin/python', 'python'])
fatal: [alpine-pihole]: FAILED! => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"module_stderr": "Shared connection to 192.168.2.203 closed.\r\n",
"module_stdout": "/bin/sh: /usr/bin/python: not found\r\n",
"msg": "The module failed to execute correctly, you probably need to set the interpreter.\nSee stdout/stderr for the exact error",
"rc": 127
}
Environment
-
Control node OS: [e.g. Debian 9] (
cat /etc/os-release) -
Control node Ansible version: [e.g. 2.9.1] (
ansible --version)
ansible [core 2.14.17] -
Managed node OS: [e.g. CentOS 7] (
cat /etc/os-release)
alpine-pihole:~# cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.21.3
PRETTY_NAME="Alpine Linux v3.21"
Running the playbook with:
gather_facts: false
bootstrap_wait_for_host: false
the following error is thrown in the installing bootstrap pkgs task:
TASK [robertdebock.bootstrap : gather_facts | Set bootstrap facts (II)] **********************************************************************************************************************************************************************************************************************************************************
task path: /root/.ansible/roles/robertdebock.bootstrap/tasks/gather_facts.yml:21
ok: [alpine-pihole] => (item=Alpine) => {"ansible_facts": {"bootstrap_os_family": "Alpine"}, "ansible_loop_var": "item", "changed": false, "item": {"key": "Alpine", "value": ["Alpine"]}}
skipping: [alpine-pihole] => (item=Archlinux) => {"ansible_loop_var": "item", "changed": false, "item": {"key": "Archlinux", "value": ["Archlinux", "Antergos", "Manjaro"]}, "skip_reason": "Conditional result was False"}
skipping: [alpine-pihole] => (item=Debian) => {"ansible_loop_var": "item", "changed": false, "item": {"key": "Debian", "value": ["Debian", "Ubuntu", "Raspbian", "Neon", "KDE neon", "Linux Mint", "SteamOS", "Devuan", "Kali", "Cumulus Linux", "Pop!_OS", "Parrot", "Pardus GNU/Linux"]}, "skip_reason": "Conditional result was False"}
skipping: [alpine-pihole] => (item=Gentoo) => {"ansible_loop_var": "item", "changed": false, "item": {"key": "Gentoo", "value": ["Gentoo", "Funtoo"]}, "skip_reason": "Conditional result was False"}
skipping: [alpine-pihole] => (item=RedHat) => {"ansible_loop_var": "item", "changed": false, "item": {"key": "RedHat", "value": ["RedHat", "Fedora", "CentOS", "Scientific", "SLC", "Ascendos", "CloudLinux", "PSBM", "Rocky", "OracleLinux", "OVS", "OEL", "Amazon", "Virtuozzo", "XenServer", "Alibaba", "EulerOS", "openEuler", "AlmaLinux"]}, "skip_reason": "Conditional result was False"}
skipping: [alpine-pihole] => (item=Suse) => {"ansible_loop_var": "item", "changed": false, "item": {"key": "Suse", "value": ["SLED", "openSUSE Tumbleweed", "openSUSE Leap", "SLES_SAP", "SUSE_LINUX", "SLES", "openSUSE", "SuSE"]}, "skip_reason": "Conditional result was False"}
TASK [robertdebock.bootstrap : Install bootstrap packages (raw)] *****************************************************************************************************************************************************************************************************************************************************************
task path: /root/.ansible/roles/robertdebock.bootstrap/tasks/main.yml:40
fatal: [alpine-pihole]: FAILED! => {"changed": false, "msg": "non-zero return code", "rc": 1, "stderr": "Shared connection to 192.168.2.203 closed.\r\n", "stderr_lines": ["Shared connection to 192.168.2.203 closed."], "stdout": "fetch http://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz\r\nv3.21.3-452-gee5ce66b724 [http://dl-cdn.alpinelinux.org/alpine/v3.21/main]\r\nOK: 5541 distinct packages available\r\nERROR: unable to select packages:\r\n sudo (no such package):\r\n required by: world[sudo]\r\n", "stdout_lines": ["fetch http://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz", "v3.21.3-452-gee5ce66b724 [http://dl-cdn.alpinelinux.org/alpine/v3.21/main]", "OK: 5541 distinct packages available", "ERROR: unable to select packages:", " sudo (no such package):", " required by: world[sudo]"]}