我正在尝试运行以下提到的剧本,而我只是使用简单的复制模块。源文件的所有者(用户1)与目标路径的所有者(用户2)不同。 user2具有“ sudo su-”特权及其无密码。
---
- hosts: apim
gather_facts: no
remote_user: user1
become: true
become_user: user2
tasks:
- name: Copy ansible inventory file to client
copy:
src: /home/user1/downloads/tej.txt
dest: /apim/anisible_temp/
我正在尝试执行此剧本,并在调试时出现以下错误
<10.X.X.X> SSH:EXEC sshpass -d14 ssh -C -o ControlMaster =自动-o ControlPersist = 60s -o用户= user1 -o ConnectTimeout = 10 -o ControlPath = / home / user1 / .ansible / cp / 45d61ab5bc -tt 10.X.X.X'/ bin / sh -c'“'”'sudo -H -S -n -u user2 / bin / sh -c'“'''''''''''''''''echo BECOME-SUCCESS-rinmuvpmvlkrcmsrqeirofprdrnfujqt; / usr / bin / python /var/tmp/ansible-tmp-1546431365.88-275016686591006/setup.py'“'”'“”“”“”“”“”“ && sleep 0'“'”''<10.X.X.X>(1,'sudo:密码为 必需\ r \ n',“与10.X.X.X的共享连接已关闭。\ r \ n') <10.X.X.X>为用户建立SSH连接:user1 <10.X.X.X> SSH:EXEC sshpass -d15 ssh -C -o ControlMaster =自动-o ControlPersist = 60s -o用户= user1 -o ConnectTimeout = 10 -o ControlPath = / home / user1 / .ansible / cp / 483eb7e448 10.X.X.X'/ bin / sh -c'“'”'rm -f -r /var/tmp/ansible-tmp-1546431365.88-203421370980447/> / dev / null 2>&1 && sleep 0'“'”''<10.XXX>(1, 'sudo:密码是 required \ r \ n','与10.X.X.X的共享连接已关闭。\ r \ n')
尽管user2是无密码的,但需要其抛出密码。 ansible脚本有什么问题吗?