How do you create a directory www at /srv on a Debian-based system using an Ansible playbook?
Additional for all answers here, there is lot of situations when you need to create more then one directory so it is a good idea to use loops instead creating separate task for each directory.
- name: Creates directory
file:
path: "{{ item }}"
state: directory
with_items:
- /srv/www
- /dir/foo
- /dir/bar