我有一个非常简单的任务,fetch和unarchive git for installation,出于某种原因这是我在我的剧本中的错误信息:
FAILED! => {"changed": false, "failed": true, "invocation":
{"module_args":
{"backup": null,
"content": null,
"copy": false,
"creates": null,
"delimiter": null,
"dest": "/root",
"directory_mode": null,
"exclude": [], "extra_opts": [], "follow": false, "force": null,
"group": null, "keep_newer": false, "list_files": false,
"mode": null, "original_basename": "v2.9.0.tar.gz", "owner": null,
"regexp": null, "remote_src": null, "selevel": null, "serole": null,
"setype": null, "seuser": null,
"src": "https://github.com/git/git/archive/v2.9.0.tar.gz"
}
}, "msg": "path /root/git-2.9.0 does not exist",
"path": "/root/git-2.9.0", "state": "absent"
}
所以“路径/root/git-2.9.0不存在”,嗯.... 什么?。我甚至没有要求这条路,也没有创造任何东西......
有人可以解释一下吗?
这是我的任务:
- name: Decompress git archive
unarchive:
src: https://github.com/git/git/archive/v{{ git_version }}.tar.gz
dest: "{{ workspace }}"
copy: no
真的不是火箭科学。在这种情况下,git_version是2.9.0
我尝试了以下工作空间/ root:
- name: Get git source
get_url:
url: "https://github.com/git/git/archive/v{{ git_version }}.tar.gz"
dest: "{{ workspace }}/git-{{ git_version }}.tar.gz"
- name: Decompress git archive
unarchive:
src: "{{ workspace }}/git-{{ git_version }}.tar.gz"
dest: "{{ workspace }}"
creates: "{{ workspace }}/git-{{ git_version }}/README"
copy: no
这是在任务之前:
- name: Create git directory
file: path="{{ workspace }}/git-{{ git_version }}" state=directory
这给我一个 .gitattribute not found 的错误。
有人可以给我一些指示吗?
答案 0 :(得分:1)
我简化了无法归档的部分
- name: Decompress git archive
shell: tar xvf {{ workspace }}/git-{{ git_version }}.tar.gz -C {{ workspace }}
在执行时,我可以进入下一个任务 在目标上我现在有
drwxrwxr-x 22 root root 20480 Jul 13 14:51 git-2.9.1 -rw-r - r-- 1 root root 5904522 Jul 13 14:27 git-2.9.1.tar.gz