Module to get directory from path?

431 views
Skip to first unread message

Steven Ringo

unread,
Aug 6, 2014, 8:28:25 PM8/6/14
to ansible...@googlegroups.com
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


Matt Martz

unread,
Aug 6, 2014, 9:31:13 PM8/6/14
to ansible...@googlegroups.com
Ansible includes a |dirname filter that will do this for you.
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/281a861d-0aa1-493c-b6ee-94bab0dd35f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Matt Martz
ma...@sivel.net
http://sivel.net/

Steven Ringo

unread,
Aug 6, 2014, 9:34:14 PM8/6/14
to ansible...@googlegroups.com
Hi,

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

Steve


You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/E1xUNT4un2I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.

To post to this group, send email to ansible...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages