我已经在 /etc/ansible/ansible.cfg
中设置了 sudo_user
。
在我的剧本中,我设置了remote_user
,sudo_user
和sudo:yes
(也尝试了sudo:True
),与hosts:
相同的水平然后,我使用一个角色:
shell:cp -f src/usr/local/bin/dest
sudo:是
并获得
stderr:cp:无法创建常规文件`/usr/local/bin/dest':拒绝的权限
正确设置了AWX中的凭据 - 我能够在远程计算机上手动登录为所需的用户,并使用sudo cp复制文件。我不知道我在做什么错。
您的sudo用户是什么?您的基本剧本应该看起来像这样:
# Base System: this is my base playbook
- name: Base Playbook
hosts: all
user: myuser
sudo: True