I am using molecule to test ansible playbooks. The image i have has python2 with a symlink of /usr/bin/python -> /usr/bin/python2.7. In my prepare.yml, i have the following
- name: Install python3 package
package:
name:
- python3
- name: Remove python2 symlink
file:
path: /usr/bin/python
state: absent
- name: Add python3 symlink
file:
src: /opt/python3/bin/python3.7
dest: /usr/bin/python
state: link
When I run this, the python3 package is successfully installed, the /usr/bin/python is removed, but it fails to create the symlink. This is presumably because i removed the python interpreter. Any suggestions on how to resolve this?