You can create a directory with Ansible using the file
module, setting
state
to directory
.
- name: Creates directory
file:
path: /home/user/my/quite/nested/directory
state: directory
This will create the directory and all necessary intermediate ones that didn’t previously exist.
As always with file
you can additionally specify the owner
and group
that own the directory, as well as the octal mode
. Intermediate directories
will be created with the same attributes.
Check the full documentation
for other examples of use of the file
module.