What's the easy way to auto create non existing dir in ansible
Right now, this is the only way
- name: Ensures {{project_root}}/conf dir exists
file: path={{project_root}}/conf state=directory
- name: Copy file
template:
src: code.conf.j2
dest: "{{project_root}}/conf/code.conf"
To ensure success with a full path use recurse=yes
- name: ensure custom facts directory exists
file: >
path=/etc/ansible/facts.d
recurse=yes
state=directory