Module to get directory from path?

Hi,

I wish to pass in a parameter for a file, e.g: /var/log/atlas/service.log

The directory at /var/log/atlas/ must also be created before the application writes to this file.

Is there a way to get the directory from the path, perhaps with a jinja2 filter? Or if anyone knows of a filter than can do this, that would be awesome.

Thanks,

Steve

Ansible includes a |dirname filter that will do this for you.

Hi,

Great, thanks. Clearly I didn’t look hard enough in the documentation: http://docs.ansible.com/playbooks_variables.html#other-useful-filters

Steve