I just started with Ansible and Azure. I followed the guidelines from the Ansible and Azure documentation and I created the ~/.azure/credentials file as:
[default]
subscription_id=55f6481f-XXXX
client_id=XXXXX
secret=XXXX
tenant=XXXX
I have a play which is fairly simple:
- name: Create a resource group
azure_rm_resourcegroup:
profile: default
name: "{{ resource_group }}"
location: "{{ region }}"
tags:
Delete: "never"
Name: "{{ resource_group }}"
Location: "{{ rg_location }}"
However, when I execute it I get the following error:
fatal: [localhost]: FAILED! => {
"changed": false,
"rc": 1
}
MSG:
MODULE FAILURE
See stdout/stderr for the exact error
MODULE_STDERR:
No handlers could be found for logger "msrestazure.azure_active_directory"
Traceback (most recent call last):
File "/home/username/.ansible/tmp/ansible-tmp-1552239339.62-10853560644891/AnsiballZ_azure_rm_resourcegroup.py", line 113, in <module>
_ansiballz_main()
File "/home/username/.ansible/tmp/ansible-tmp-1552239339.62-10853560644891/AnsiballZ_azure_rm_resourcegroup.py", line 105, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/username/.ansible/tmp/ansible-tmp-1552239339.62-10853560644891/AnsiballZ_azure_rm_resourcegroup.py", line 48, in invoke_module
imp.load_module('__main__', mod, module, MOD_DESC)
File "/tmp/ansible_azure_rm_resourcegroup_payload_ts0H20/__main__.py", line 99, in <module>
File "/tmp/ansible_azure_rm_resourcegroup_payload_ts0H20/ansible_azure_rm_resourcegroup_payload.zip/ansible/module_utils/azure_rm_common.py", line 134, in <module>
File "/usr/lib/python2.7/site-packages/azure/__init__.py", line 1, in <module>
__import__('pkg_resources').declare_namespace(__name__)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3095, in <module>
@_call_aside
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3079, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 3108, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 561, in _build_master
ws = cls()
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 554, in __init__
self.add_entry(entry)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 610, in add_entry
for dist in find_distributions(entry, True):
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1958, in find_on_path
for dist in factory(fullpath):
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2020, in distributions_from_metadata
if len(os.listdir(path)) == 0:
OSError: [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/s3transfer-0.1.13.dist-inf
I cannot see anything wrong, so any help would be appreciated.