Menu

Close
  • Home
  • About
Subscribe
Ansible Daily Menu

Template as variable

01 October 2016

If you need to use a template without file generation, there is a handy lookup plugin for you: template.

You can use it with lookup function:

- debug: msg="{{ lookup('template', 'mytemplate.j2') }}"

Or with_ statement:

- debug: msg="{{ item }}"
  with_template: mytemplate.j2
Konstantin Suvorov's Picture

Konstantin Suvorov

Read more posts by this author.

Saint-Petersburg, Russia http://berlic.net

Share this post

Twitter Facebook Google+

Avoid Ansible command warning

Sometimes you need to execute a shell command on remote host, but Ansible gives you an annoying warning, for…

Prevent playbook execution without tags

If you have a playbook or a role with extensive tags usage (e.g. install/update/uninstall) and want…

Ansible Daily © 2019
Proudly published with Ghost