diff --git a/60.Facts/60.Facts.md b/60.Facts/60.Facts.md new file mode 100644 index 0000000..f02651d --- /dev/null +++ b/60.Facts/60.Facts.md @@ -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` diff --git a/60.Facts/solution/solution.yml b/60.Facts/solution/solution.yml new file mode 100644 index 0000000..da455c9 --- /dev/null +++ b/60.Facts/solution/solution.yml @@ -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: diff --git a/60.Facts/solution/template/motd.j2 b/60.Facts/solution/template/motd.j2 new file mode 100644 index 0000000..7b5250c --- /dev/null +++ b/60.Facts/solution/template/motd.j2 @@ -0,0 +1,5 @@ +/----------------------------- +Welcome to the ansible managed host: {{ ansible_fqdn }} + +Please use Ansible playbooks instead of doing manual modifications on the system. +-----------------------------/