0

I want the output of the script that is executed in remote server to be saved in a text document in the remote server. I tried many ways but nothing seems to be work out.

---
- name: Transfer and execute a script.
  hosts: slave
  remote_user: root
  sudo: yes
  tasks:
     - name: Transfer the script
       copy: src=uptime.sh dest=/home/  mode=0777

     - name: Execute the script
       command: sh /home/uptime.sh >> /home/output
Akhil Teej
  • 61
  • 6
  • 1
    Welcome to SO. Please have a look here to learn how to improve your questions (formatting, proofreading, providing code etc.): https://stackoverflow.com/help/how-to-ask – petezurich Apr 20 '18 at 20:11
  • 1
    did you try the `shell` module instead of `command`? e.g. `shell: sh /home/uptime.sh >> /home/output` or `shell: "sh /home/uptime.sh >> /home/output"` – Kashyap Apr 20 '18 at 20:15
  • Thank you so much :) .... it's working – Akhil Teej Apr 21 '18 at 04:29

0 Answers0