ansible.cfg
[student@workstation jinja2]$ cat ansible.cfg [defaults] inventory = inventory ansible_managed = Ansible managed: modified on %Y-%m-%d %H:%M:%S
inventory
[student@workstation jinja2]$ cat inventory [webservers] servera.lab.example.com [workstations] workstation.lab.example.com
motd.j2
[student@workstation jinja2]$ cat motd.j2 This is the system {{ ansible_hostname }}. Today's date is: {{ ansible_date_time.date }}. Only use this system with permission. You can ask {{ system_owner }} for access.
motd.yml
[student@workstation jinja2]$ cat motd.yml --- - hosts: all user: devops become: true vars: system_owner: clyde@example.com tasks: - template: src: motd.j2 dest: /etc/motd owner: root group: root mode: 0644
0 Comments