当我去时,我克隆了 repo 以使用 Ansible 重现一些示例
ansible-playbook install_dependencies.yml
我有错误
TASK [fetch k3s ansible role from github] ************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "cmd": ["/usr/bin/git", "fetch", "--tags", "origin"], "msg": "Failed to download remote objects and refs: error: cannot open .git/FETCH_HEAD: Permission denied\n"}
我的 .git 文件夹
drwxrwxr-x 8 miki miki 4096 мај 2 07:08 ./
drwxrwxr-x 9 miki miki 4096 мај 2 07:08 ../
drwxrwxr-x 2 miki miki 4096 мај 2 07:08 branches/
-rw-rw-r-- 1 miki miki 269 мај 2 07:08 config
-rw-rw-r-- 1 miki miki 73 мај 2 07:08 description
-rwxr-xr-x 1 miki miki 21 мај 2 07:08 HEAD*
drwxrwxr-x 2 miki miki 4096 мај 2 07:08 hooks/
-rw-rw-r-- 1 miki miki 18715 мај 2 07:08 index
drwxrwxr-x 2 miki miki 4096 мај 2 07:08 info/
drwxrwxr-x 3 miki miki 4096 мај 2 07:08 logs/
drwxrwxr-x 4 miki miki 4096 мај 2 07:08 objects/
-rw-rw-r-- 1 miki miki 112 мај 2 07:08 packed-refs
drwxrwxr-x 5 miki miki 4096 мај 2 07:08 refs/
我的 .ansible 文件夹
~/.ansible$ ll
total 24
drwxrwxr-x 6 miki miki 4096 апр 18 14:12 ./
drwxr-x---+ 49 miki miki 4096 мај 3 11:32 ../
-rw-rw-r-- 1 miki miki 0 апр 17 17:24 ansible.log
drwxrwxr-x 3 miki miki 4096 апр 18 14:12 collections/
drwx------ 2 miki miki 4096 апр 29 10:32 cp/
drwx------ 2 miki miki 4096 апр 18 14:12 galaxy_cache/
-rw------- 1 miki miki 0 апр 11 15:53 galaxy_token
drwx------ 2 miki miki 4096 мај 3 11:39 tmp/
我的剧本
- hosts: localhost
become: no
tasks:
- debug:
msg: "OS release={{ ansible_distribution_release }}, OS version={{ ansible_distribution_version }}"
- name: fetch k3s ansible role from github
delegate_to: localhost
git:
repo: https://github.com/k3s-io/k3s-ansible.git
clone: true
dest: "{{playbook_dir}}/../k3s-ansible"
使用 -vvv 输出
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: miki
<localhost> EXEC /bin/sh -c 'echo ~miki && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/miki/.ansible/tmp `"&& mkdir "` echo /home/miki/.ansible/tmp/ansible-tmp-1683108974.034215-122617-263104769488574 `" && echo ansible-tmp-1683108974.034215-122617-263104769488574="` echo /home/miki/.ansible/tmp/ansible-tmp-1683108974.034215-122617-263104769488574 `" ) && sleep 0'
Using module file /home/miki/.local/lib/python3.10/site-packages/ansible/modules/git.py
<localhost> PUT /home/miki/.ansible/tmp/ansible-local-122450_cjm4srf/tmpek6go9yg TO /home/miki/.ansible/tmp/ansible-tmp-1683108974.034215-122617-263104769488574/AnsiballZ_git.py
<localhost> EXEC /bin/sh -c 'chmod u+x /home/miki/.ansible/tmp/ansible-tmp-1683108974.034215-122617-263104769488574/ /home/miki/.ansible/tmp/ansible-tmp-1683108974.034215-122617-263104769488574/AnsiballZ_git.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python3 /home/miki/.ansible/tmp/ansible-tmp-1683108974.034215-122617-263104769488574/AnsiballZ_git.py && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /home/miki/.ansible/tmp/ansible-tmp-1683108974.034215-122617-263104769488574/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
"changed": false,
"cmd": [
"/usr/bin/git",
"fetch",
"--tags",
"origin"
],
"invocation": {
"module_args": {
"accept_hostkey": false,
"accept_newhostkey": false,
"archive": null,
"archive_prefix": null,
"bare": false,
"clone": true,
"depth": null,
"dest": "/home/miki/prac/k3s-cluster-kvm/../k3s-ansible",
"executable": null,
"force": false,
"gpg_whitelist": [],
"key_file": null,
"recursive": true,
"reference": null,
"refspec": null,
"remote": "origin",
"repo": "https://github.com/k3s-io/k3s-ansible.git",
"separate_git_dir": null,
"single_branch": false,
"ssh_opts": null,
"track_submodules": false,
"umask": null,
"update": true,
"verify_commit": false,
"version": "HEAD"
}
},
"msg": "Failed to download remote objects and refs: error: cannot open .git/FETCH_HEAD: Permission denied\n"
}
我应该如何更改权限?