From the course: Red Hat Certified Engineer (EX294) Cert Prep: 3 Managing Systems with Ansible

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Templating with Jinja2

Templating with Jinja2

- [Instructor] As we learned in the ex294 using Ansible playbooks course. Ansible has various language constructs in its playbooks such as variables lists and arrays, dictionaries, loops and conditionals. Jinja2 is used for templating. It also has constructs such as variables, lists and arrays, dictionaries, loops and conditionals. That should sound familiar. You might be wondering why there's such an overlap in the Ansible playbook language engine to two and why does Ansible use both? That is a valid question. So let me explain the language constructs in playbooks are for deciding how to manage a systems configuration. We need variables to hold information about a host. If we have many hosts, we will need a list or array of them. If we need to store specific data about a host, we'll need a list of key value pairs, which is a dictionary. We may also want to loop through items such as package names to install so we don't…

Contents