## ansible.cfg
[student@workstation jinja2-lab]$ cat ansible.cfg
[defaults]
inventory = inventory
ansible_managed = Ansible managed: modified on %Y-%m-%d %H:%M:%S
[student@workstation jinja2-lab]$ cat inventory
[servers]
serverb.lab.example.com
## motd.j2
[student@workstation jinja2-lab]$ cat motd.j2
This system's total memory is: {{ ansible_memtotal_mb }} MBs.
The current free memory is: {{ ansible_memfree_mb }} MBs.
## motd.yml
[student@workstation jinja2-lab]$ cat motd.yml
---
- hosts: all
user: devops
become: true
tasks:
- template:
src: motd.j2
dest: /etc/motd
owner: root
group: root
mode: 0644
[student@workstation jinja2-lab]$ ssh devops@serverb.lab.example.com
Last login: Wed Feb 13 15:31:20 2019 from workstation.lab.example.com
This system's total memory is: 488 MBs.
The current free memory is: 235 MBs.
Overview
Content Tools