test.yml
---
- hosts: webservers
remote_user: username
tasks:
- name: Execute the script
command: sh /home/username/top.sh
top.sh
#!/bin/bash
top > system.txt
I run test.yml in local machine, it will run the shell script in remote machine and save the command in system.txt file.
location of top.sh: remote, location of system.txt: remote
But I am looking for
location of top.sh: local (but I need to run this command in remote), location of system.txt: local
How to achieve this?