ansible-for-kubernetes icon indicating copy to clipboard operation
ansible-for-kubernetes copied to clipboard

test-deployment.yml fails as pip is unavailable on remote host

Open Xaeco opened this issue 3 years ago • 2 comments
trafficstars

On page 100 of

Chapter 4 - Building K8s clusters with Ansible

I inserted a pre-task above the Ensure k8s module dependencies are installed. task

    - name: Install pip3.
      apt: name=python3-pip state=present 

Otherwise it fails with:

PLAY [kube1] *********************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************
ok: [kube1]

TASK [Ensure k8s module dependencies are installed.] *****************************************************************
fatal: [kube1]: FAILED! => {"changed": false, "msg": "Unable to find any of pip3 to use.  pip needs to be installed."}

PLAY RECAP ***********************************************************************************************************
kube1                      : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0    

I am using Ansible in WSL2 which should be fine as the command is executing on the remote host. In case its relevant:

ansible-playbook [core 2.12.1]
  config file = /mnt/c/Users/<username>/Documents/afk/cluster-local-vms/ansible.cfg
  configured module search path = ['/home/wsl/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']        
  ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
  ansible collection location = /home/wsl/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0]
  jinja version = 2.10.1
  libyaml = True

Xaeco avatar Dec 21 '21 04:12 Xaeco

I'll have to dig into this one; could be a Python2/Python3 upgrade issue, or I might just need to bump an OS version :)

geerlingguy avatar Dec 21 '21 05:12 geerlingguy

I'm assuming Ansible is just executing the ansible pip module's statement verbatim on the remote host. Now assuming the latest Ansible module is now targeting pip3 and it's not there.

Xaeco avatar Dec 21 '21 05:12 Xaeco