我希望在远程服务器中执行的脚本输出保存在远程服务器的文本文档中。我尝试了很多方法,但似乎没有任何结果。
---
- 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