0

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"
Serg
  • 824
  • 7
  • 14

1 Answers1

1

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

Khaled
  • 111