From the course: Ansible: From Basics to Guru by Pearson

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Common lookup plugins

Common lookup plugins

In this video we'll have a look at some common lookup plugins. To start with Env and Template. So the Env lookup plugin is used to set a variable that is based on the value of a shell variable on the managed host. And combined with the default filter, this has nice potential to automatically modify content based on local settings. In particular, when combined with the Template Lookup Plugin, it can be very useful. You should know that the Template Lookup Plugin is not the same as the Template Module. The Template Plugin is used to generate text that can be used in modules like COPY. Let's have a look at an example. So here we have setlanguage.yaml. And what is this doing? Well, this is using templates to provide the right language. So we get a variable definition. In the variable definition, we define the variable language, which is set to the lang variable in the managed host environment. And if nothing is set, we assume that the default language should be used, which is English US…

Contents