Skip to content

/usr/bin/ssh: Permission denied #1449

@anardil

Description

@anardil

Hello,

I have an issue "Permission denied" when I try to perform an SCP in a task template. But if execute the playbook in CLI, I have no problem.

      - name: Copy nat rules
        become: yes
        shell:
          cmd: sshpass -p {{ firewall_password }} scp {{ playbook_dir }}/../fw_commandes/list-nat.nsrpc {{ firewall_username }}@{{ firewall_IP }}:/data/Main/ConfigFiles/Event
        become_user: root
        become_flags: '-s /bin/sh'

I have this error:

 5:23:44 PM
TASK [Copy nat rules] ****************************
5:23:44 PM
task path: /root/snap/semaphore/common/repositories/repository_2_2/playbooks/deploy_netwok.yml:38
5:23:44 PM
ESTABLISH LOCAL CONNECTION FOR USER: root
5:23:44 PM
EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /tmp `"&& mkdir "` echo /tmp/ansible-tmp-1693409024.6943617-9006-71963732050780 `" && echo ansible-tmp-1693409024.6943617-9006-71963732050780="` echo /tmp/ansible-tmp-1693409024.6943617-9006-71963732050780 `" ) && sleep 0'
5:23:44 PM
Using module file /root/snap/semaphore/common/ansible_env/lib/python3.8/site-packages/ansible/modules/command.py
5:23:44 PM
PUT /tmp/ansible-local-8941_ha987m5/tmp6ycgtmj0 TO /tmp/ansible-tmp-1693409024.6943617-9006-71963732050780/AnsiballZ_command.py
5:23:44 PM
EXEC /bin/sh -c 'chmod u+x /tmp/ansible-tmp-1693409024.6943617-9006-71963732050780/ /tmp/ansible-tmp-1693409024.6943617-9006-71963732050780/AnsiballZ_command.py && sleep 0'
5:23:44 PM
EXEC /bin/sh -c '/root/snap/semaphore/common/ansible_env/bin/python3.8 /tmp/ansible-tmp-1693409024.6943617-9006-71963732050780/AnsiballZ_command.py && sleep 0'
5:23:45 PM
EXEC /bin/sh -c 'rm -f -r /tmp/ansible-tmp-1693409024.6943617-9006-71963732050780/ > /dev/null 2>&1 && sleep 0'
5:23:45 PM
fatal: [localhost]: FAILED! => changed=true
5:23:45 PM
cmd: sshpass -p ********* scp /root/snap/semaphore/common/repositories/repository_2_2/playbooks/../fw_commandes/list-nat.nsrpc admin@*******:/data/Main/ConfigFiles/Event
5:23:45 PM
delta: '0:00:00.029287'
5:23:45 PM
end: '2023-08-30 15:23:45.056900'
5:23:45 PM
invocation:
5:23:45 PM
module_args:
5:23:45 PM
_raw_params: sshpass -p ********* scp /root/snap/semaphore/common/repositories/repository_2_2/playbooks/../fw_commandes/list-nat.nsrpc admin@*******:/data/Main/ConfigFiles/Event
5:23:45 PM
_uses_shell: true
5:23:45 PM
argv: null
5:23:45 PM
chdir: null
5:23:45 PM
creates: null
5:23:45 PM
executable: null
5:23:45 PM
removes: null
5:23:45 PM
stdin: null
5:23:45 PM
stdin_add_newline: true
5:23:45 PM
strip_empty_ends: true
5:23:45 PM
warn: false
5:23:45 PM
msg: non-zero return code
5:23:45 PM
rc: 1
5:23:45 PM
start: '2023-08-30 15:23:45.027613'
5:23:45 PM
stderr: |-
5:23:45 PM
/usr/bin/ssh: Permission denied
5:23:45 PM
lost connection
5:23:45 PM
stderr_lines:
5:23:45 PM
stdout: ''
5:23:45 PM
stdout_lines: 

Can someone help me with this? I've been stuck with this issue for 2 days :(.
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions