Can we Run Command in Jinja2 Template

14 views
Skip to first unread message

Bishwajit Samanta

unread,
Jul 10, 2019, 4:35:49 PM7/10/19
to Ansible Project
Hi Team,

I was curious can we run command in jinja2 template say example


{{pwd}} === here pwd is a shell command.

Kai Stian Olstad

unread,
Jul 10, 2019, 4:47:34 PM7/10/19
to ansible...@googlegroups.com
Template only run on localhost aka Ansible controller.
So if the command you wanna run is against localhost you can use lookup plugin with pipe
https://docs.ansible.com/ansible/latest/plugins/lookup/pipe.html


--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages