Impossible copy of file with sudo after upgrade to 1.9

In a playbook, I copy files using sudo. It worked ... Until we moved to Ansible 1.9 ... Since then, it does not work with the following error message:

"ssh connection closed waiting for sudo password request"

I provide the passwords ssh and sudo (via the Ansible prompt), and all other commands executed through sudo are successful (only a copy of the file and the template failed).

My team:

ansible-playbook -k -ask-get-pass -limit = testhost -C -D playbooks / debug.yml

and playbookd contains:

- hosts: designsync

  gather_facts: yes 

  tasks:
    - name: Make sure the syncmgr home folder exists
       action: file path=/home/syncmgr owner=syncmgr group=syncmgr mode=0755 state=directory
      sudo: yes
      sudo_user: syncmgr

    - name: Copy .cshrc file
      action: copy src=roles/designsync/files/syncmgr.cshrc dest=/home/syncmgr/.cshrc owner=syncmgr group=syncmgr mode=0755
      sudo: yes
      sudo_user: syncmgr

Is this a mistake or am I missing something?

FranΓ§ois.

+4
source share
2 answers

Your game should look like this:

- hosts: designsync

  gather_facts: yes 

  tasks:
    - name: Make sure the syncmgr home folder exists
      sudo: yes
      sudo_user: syncmgr
      file: 
        path: "/home/syncmgr" 
        owner: syncmgr
        group: syncmgr
        mode: 0755 
        state: directory

    - name: Copy .cshrc file
      sudo: yes
      sudo_user: syncmgr
      copy: 
        src: "roles/designsync/files/syncmgr.cshrc" 
        dest: "/home/syncmgr/.cshrc"
        owner: syncmgr 
        group: syncmgr 
        mode: 0755
0
source

Ansible, , sudo_user ( ).

"sudo_user" "remote_user".

0

Source: https://habr.com/ru/post/1589376/


All Articles