Ansible未能取消归档bz2文件

时间:2017-07-30 16:18:55

标签: ubuntu ansible

我无法使用Ansible .bz2模块提取unarchive文件,尽管它存在:

 - name: unpack Android NDK
   unarchive: copy=no src="{{ ansible_cache_dir }}"/"{{ android_ndk_zipfile }}" dest=/opt/android creates=/opt/android/"{{ android_ndk_folder }}"

收到此错误消息:

fatal: [default]: FAILED! => {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "attributes": null, 
            "backup": null, 
            "content": null, 
            "copy": false, 
            "creates": "/opt/android/\"crystax-ndk-10.2.1\"", 
            "delimiter": null, 
            "dest": "/opt/android", 
            "directory_mode": null, 
            "exclude": [], 
            "extra_opts": [], 
            "follow": false, 
            "force": null, 
            "group": null, 
            "keep_newer": false, 
            "list_files": false, 
            "mode": null, 
            "original_basename": "\"crystax-ndk-10.2.1-linux-x86_64.tar.bz2", 
            "owner": null, 
            "regexp": null, 
            "remote_src": false, 
            "selevel": null, 
            "serole": null, 
            "setype": null, 
            "seuser": null, 
            "src": "/opt/ansible_cache\"/\"crystax-ndk-10.2.1-linux-x86_64.tar.bz2", 
            "unsafe_writes": null, 
            "validate_certs": true
        }
    }, 
    "msg": "Source '/opt/ansible_cache\"/\"crystax-ndk-10.2.1-linux-x86_64.tar.bz2' does not exist"
}

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

错误告诉您Ansible无法找到原始存档。我认为这是因为你的参数中的双引号语法。尝试引用整个参数而不仅仅是变量。

- name: unpack Android NDK
  unarchive:
    copy: no
    src: "{{ ansible_cache_dir }}/{{ android_ndk_zipfile }}" 
    dest: /opt/android
    creates: "/opt/android/{{ android_ndk_folder }}"