Hello there,
I just want to test my script if it creates a simple .txt file into a destination put instead it is creating that same file into the source vm that is where the ansible is installed.
Here is the simple script I'm running.
---
- hosts: Cassandra
remote_user: murtaza
connection: local
sudo: yes
tasks:
- name: Create an empty file with name myfile.txt
shell: touch myfile.txt state=touch
Output :-
[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and
make sure become_method is 'sudo' (default). This feature will be removed in
version 2.6. Deprecation warnings can be disabled by setting
deprecation_warnings=False in ansible.cfg.
PLAY [Cassandra] ***************************************************************
TASK [Gathering Facts] *********************************************************
ok: [10.0.0.243]
TASK [Create an empty file with name myfile.txt] *******************************
[WARNING]: Consider using file module with state=touch rather than running
touch
changed: [10.0.0.243]
PLAY RECAP *********************************************************************
10.0.0.243 : ok=2 changed=1 unreachable=0 failed=0
This shows that it is creating and doing the job all right. But still when I ssh into 10.0.0.243 it doesnt create any .txt file with this name but instead creates the file into the source where the ansilbe is installed.
Please have a look into this issue