6th exercise: use facts
This commit is contained in:
parent
efb254f2c5
commit
d4525cdb07
3 changed files with 26 additions and 0 deletions
11
60.Facts/60.Facts.md
Normal file
11
60.Facts/60.Facts.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# 60 - Facts
|
||||
|
||||
This exercise makes you use facts to adapt content
|
||||
|
||||
## Playbook modification
|
||||
Improve the playbook you created in the previous step to use the FQDN (*Fully Qualified Domain Name*) gathered as a fact instead of the inventory hostname.
|
||||
|
||||
## 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`
|
10
60.Facts/solution/solution.yml
Normal file
10
60.Facts/solution/solution.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
- hosts: lab
|
||||
gather_facts: true
|
||||
tasks:
|
||||
- name: Deploy MOTD
|
||||
template:
|
||||
src: template/motd.j2
|
||||
dest: /etc/motd
|
||||
become: true
|
||||
|
||||
# vim: set ft=yaml sw=2 et:
|
5
60.Facts/solution/template/motd.j2
Normal file
5
60.Facts/solution/template/motd.j2
Normal file
|
@ -0,0 +1,5 @@
|
|||
/-----------------------------
|
||||
Welcome to the ansible managed host: {{ ansible_fqdn }}
|
||||
|
||||
Please use Ansible playbooks instead of doing manual modifications on the system.
|
||||
-----------------------------/
|
Loading…
Reference in a new issue