You can use the copy module in Ansible to create a file in remote location with specific content.
Below is the sample script.
---
- hosts: webapp
gather_facts: False
tasks:
- name: Copy & Create File.
copy:
dest: /home/justgeek/remote.sh
content: |
On the remote server a file named remote.sh will be created.
with this content.