Azure playbook-权限错误

Azure playbook-权限错误

我刚刚开始使用 Ansible 和 Azure。我遵循了 Ansible 和 Azure 文档中的指导原则,并创建了 ~/.azure/credentials 文件,如下所示:

[default]
subscription_id=55f6481f-XXXX
client_id=XXXXX
secret=XXXX
tenant=XXXX

我有一个相当简单的剧本:

- name: Create a resource group
  azure_rm_resourcegroup:
    profile: default
    name: "{{ resource_group }}"
    location: "{{ region }}"
    tags:
        Delete: "never"
        Name: "{{ resource_group }}"
        Location: "{{ rg_location }}"

但是,当我执行它时出现以下错误:

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

我看不出有什么问题,因此如果能提供任何帮助我将非常感激。

答案1

我找到了这个问题的解决方案。显然目录 (/usr/lib/python2.7/site-packages/s3transfer-0.1.13.dist-inf) 具有 750 个权限。正确的权限是目录的权限为 755,文件的权限为 644。

相关内容