October 2017
Intermediate to advanced
326 pages
7h 20m
English
Variables and templates are an important part of Ansible. They allow us to override values in our configuration (servers and playbooks) so that we can write generic playbooks that can be reused across different configurations with minor tweaks. With templates, we can render configuration files from our host so we could potentially use Ansible to manage the configuration of remote servers with little to no effort. It also can be used to generate and install SSL certificates for different hosts transparently to the user.
Both of them (variables and templates) use a template engine called Jinja2, which allows logic and interpolation to be embedded in our configurations.
In general, there are several ...