ansible-labs/050.Template/050.Template.md

942 B

5 - Template

This playbook makes you use Jinja templating to deploy custom motd.

Template and Playbook Creation

First write a Jinja template file following the given specs:

  • Contains the following content:
/-----------------------------
Welcome to the ansible managed host: <hostname>

Please use Ansible playbooks instead of doing manual modifications on the system.
-----------------------------/
  • Ensure that you use the correct Jinja mechanism to allow replacement of <hostname by the corresponding value from the inventory (IP address is OK, depending of your host file).

Then write a playbook following the given specs:

  • Run on host group lab
  • Deploys the instantiated Jinja template file previously created to /etc/motd

Validation

Run the playbook and then try to connect to each host to validate you see the customized banner on ssh connection.

There is a working playbook in solution/solution.yml