ansible motd changed login prompt

762 views
Skip to first unread message

Robert Recchia

unread,
Apr 5, 2017, 8:08:41 PM4/5/17
to Ansible Project
This is weird and I am not sure of what really caused it all I know is I just wanted to start making motd files bit more useful.  Created this simple playbook

---
- hosts: web
  user: root
  tasks:
          - name: Ensure the MOTD file is present and updated
            template:
                    src: motd
                    dest: /etc/motd
                    owner: root
                    group: root
                    mode: 0644
          - name: Ensure the hostname is the same of the inventory 
            hostname:
                    name: "{{ inventory_hostname }}"

using this template 

This system is managed by Ansible
  Any change done on this system could be overwritten by Ansible
OS: {{ ansible_distribution }} {{ ansible_distribution_version }}
Hostname: {{ inventory_hostname }}
Main Ip address: {{ ansible_default_ipv4.address }}
All connections are monitored and recorded
    Disconnect IMMEDIATELY if you are not an authorized user

I ran this on 2 servers.  The login prompt changed for example to this [root@10 ~]#

 ansible --version 

ansible 2.2.1.0

  config file = /etc/ansible/ansible.cfg

  configured module search path = Default w/o overrides


I have checked ~/.bashrc /etc/bashrc /etc/profile i see nothing that would have changed the prompt.  

Dick Davies

unread,
Apr 6, 2017, 3:24:18 AM4/6/17
to ansible list
That looks like your inventory_hostname was an IP that started
with 10 and the hostname pieces are splitting this like an FQDN.

What does 'hostname' come back with now, I'm guessing '10'?
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/e10c0bab-ae6b-4bce-b318-4c98295d3b8f%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages