How to Create a Directory using Ansible
If you need to create a directory using Ansible, then you can do the following:
Create a Directory in Ansible
You will need the file
module, then to create a directory you simply specify the option state=directory
:
Note that with state=directory
, all the immediate subdirectories will be created if they don’t already exist.
Extending the file
module
Create the Directories Recursively
This is similar to the recursive
argument used with mkdir -p