How to create a folder using File Module
I have created 3 Ubuntu servers with the names:-
Server1 - Installed Ansible
Server2 - Client Node1
Server3- Client Node2
Note:- I installed ansible on Server1.
I have created a file :- vi create-dir-oracle.yml
This will create the directory oracle on the / partition
Now we will run the playbook with the command:- ansible-playbook create-dir-oracle.yml
The above task has been completed successfully.
We can validate the folder creation by checking the / partition of server2 and server3.
Note:- To check the syntax - ansible-playbook --syntax-check create-dir-oracle.yml
We can also run the ansible-playbook in an simulation mode - ansible-playbook -C [Name of the playbook]. This will not execute the desired task mentioned in the playbook.