Reputation: 1003
I'm trying to install Ansible for Azure development on WSL2 (Ubuntu 20.04) but see the following output when trying to install:
> pip3 install 'ansible[azure]'
Looking in indexes
Processing /home/ross/.cache/pip/wheels/73/11/5d/0fd1ddb1a82c6afefa3f475b62f3f35c9224aef05a37d330ed/ansible-2.10.3-py3-none-any.whl
WARNING: ansible 2.10.3 does not provide the extra 'azure'
Requirement already satisfied: ansible-base<2.11,>=2.10.3 in /home/ross/.local/lib/python3.8/site-packages (from ansible[azure]) (2.10.3)
Requirement already satisfied: PyYAML in /usr/lib/python3/dist-packages (from ansible-base<2.11,>=2.10.3->ansible[azure]) (5.3.1)
Requirement already satisfied: jinja2 in /usr/lib/python3/dist-packages (from ansible-base<2.11,>=2.10.3->ansible[azure]) (2.10.1)
Requirement already satisfied: cryptography in /usr/lib/python3/dist-packages (from ansible-base<2.11,>=2.10.3->ansible[azure]) (2.8)
Requirement already satisfied: packaging in /home/ross/.local/lib/python3.8/site-packages (from ansible-base<2.11,>=2.10.3->ansible[azure]) (20.4)
Requirement already satisfied: pyparsing>=2.0.2 in /home/ross/.local/lib/python3.8/site-packages (from packaging->ansible-base<2.11,>=2.10.3->ansible[azure]) (2.4.7)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from packaging->ansible-base<2.11,>=2.10.3->ansible[azure]) (1.14.0)
Installing collected packages: ansible
Successfully installed ansible-2.10.3
As a result, when I try and run a playbook using Azure modules, it fails:
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (ansible[azure] (azure >= 2.0.0)) on mypc's Python /usr/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}
I am using python3 and pip3.
Is there something else I need to do in order to install Azure modules for Ansible?
Upvotes: 4
Views: 4777
Reputation: 44635
Since version 2.10 of ansible, quite a few modules have been moved to external collections and are not part of the core of ansible anymore. You need to install those collections in your local ansible environment if you intend to use them.
Please follow the guide to install azure.azcollection
. Very basically:
curl -O https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements-azure.txt
pip install -r requirements-azure.txt
rm requirements-azure.txt
ansible-galaxy collection install azure.azcollection
Upvotes: 14