
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 1,193 Views
I just did motd lab by using jinja2 template.
the template is like
-------------
this is the system {{ ansible_facts['fqdn'] }}.
blashblashblash like first line there are more ansible_facts variables.
-------------
the playbook is like
--------------------
(for serverA)
name: ~~~
template:
src: motd.j2
dest: /etc/motd
owner: root
------------------
I understand the template should display ansible_facts variables.
However, I don't get how this template displayed when I logged in to serverA by SSH.
Is template module is not like file or copy module?
I was expecting motd.j2 will be copied at /etc/motd on serverA, but it actually displayed the context of template when I logged-in, which was impressive!
Can someone please explain this?
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 1,126 Views
@spurs The message of the day (MOTD ) is used to communicate information to end users, the contents of /etc/motd are displayed after a successful login but just before it executes the login shell.
So, when you configured the motd in servera and logs in via ssh - it showed you the motd before giving you a login shell

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 1,127 Views
@spurs The message of the day (MOTD ) is used to communicate information to end users, the contents of /etc/motd are displayed after a successful login but just before it executes the login shell.
So, when you configured the motd in servera and logs in via ssh - it showed you the motd before giving you a login shell