gpt4 book ai didi

Ansible 无法设置临时权限

转载 作者:行者123 更新时间:2023-12-04 17:31:09 24 4
gpt4 key购买 nike

我正在使用 ansible 为多个 RHEL6 和 RHEL7 服务器上的用户替换 ssh key 。我正在运行的任务是:

- name: private key   
copy:
src: /Users/me/Documents/keys/id_rsa
dest: ~/.ssh/
owner: unpriv
group: unpriv
mode: 0600
backup: yes

我尝试更新的两个主机出现以下错误:

fatal: [host1]: FAILED! => {"failed": true, "msg": "Failed to set permissions on the temporary files Ansible needs to create when becoming an unprivileged user (rc: 1, err: chown: changing ownership of /tmp/ansible-tmp-19/': Operation not permitted\nchown: changing
ownership of
/tmp/ansible-tmp-19/stat.py': Operation not permitted\n). For information on working around this, see https://docs.ansible.com/ansible/become.html#becoming-an-unprivileged-user"}



问题是这两个得到错误的是一些更新得很好的克隆。我比较了 sudoers 和 sshd 设置,以及/tmp 目录上的权限和挂载选项。它们在问题主机和工作主机之间都是相同的。关于下一步我可以检查什么的任何想法?

如果有帮助,我正在 Mac OS Sierra 上运行 ansible 2.3.1.0。

更新:

@techraf

我不知道为什么这对除两个主机之外的所有主机都有效。这是原始剧本:
- name: ssh_keys
hosts: my_hosts
remote_user: my_user
tasks:
- include: ./roles/common/tasks/keys.yml
become: yes
become_method: sudo

和原始keys.yml:
- name: public key
copy:
src: /Users/me/Documents/keys/id_rsab
dest: ~/.ssh/
owner: unpriv
group: unpriv
mode: 060
backup: yes

我将剧本更改为:
- name: ssh_keys
hosts: my_hosts
remote_user: my_user
tasks:
- include: ./roles/common/tasks/keys.yml
become: yes
become_method: sudo
become_user: root

keys.yml到:
- name: public key
copy:
src: /Users/me/Documents/keys/id_rsab
dest: /home/unpriv/.ssh/
owner: unpriv
group: unpriv
mode: 0600
backup: yes

它适用于所有主机。

最佳答案

尝试在远程主机上安装 ACL,然后执行 ansible 脚本

sudo apt-get install acl

关于Ansible 无法设置临时权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46352173/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com