ansible-labs/50.Template/50.Template.md

26 lines
941 B
Markdown
Raw Normal View History

2018-08-01 15:16:22 +02:00
# 50 - 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`