I have tried this but not working.
Command that I have tried:
sudo -u ec2-user ssh -i {{ sso_key_path }}@{{ sso_ip_address }} "sh sso_file.sh"
I have tried this but not working.
Command that I have tried:
sudo -u ec2-user ssh -i {{ sso_key_path }}@{{ sso_ip_address }} "sh sso_file.sh"
Transfer the file first to the remote host and the execute it there
- hosts: hosts_group
remote_user: ec2-user
become: yes
tasks:
- name: transfer the script
copy:
src: sso_file.sh
dest: /tmp
mode: 0777
- name: execute the script
command: sh /tmp/sso_file.sh
sso_file.sh
local or on the remote machine? The command you give executes it on the remote machine – Barry Carter Jun 10 '22 at 14:18