ansible inventory name: "{{ inventory_hostname }}"

50 views
Skip to first unread message

Robert Recchia

unread,
Apr 12, 2017, 3:16:23 PM4/12/17
to Ansible Project
Something weird is happening.  I am creating a playbook that I would like to run when new hosts are built - they are standard centos 7 vms minimal install.

when this part of the playbook is completed

  - name: Ensure hostname is same as ansible inventory
            hostname:
                    name: "{{ inventory_hostname }}"


the prompt on the server changes from this [root@ansible-testing ~]#

to 

[root@10 ~]#


Nothing changes in /etc/bashrc /etc/profile ~/.bashrc - how is this getting changed. 



Duncan Hutty

unread,
Apr 12, 2017, 5:21:00 PM4/12/17
to ansible...@googlegroups.com


On 4/12/17 3:16 PM, Robert Recchia wrote:
> Something weird is happening. I am creating a playbook that I would like
> to run when new hosts are built - they are standard centos 7 vms minimal
> install.
>
> when this part of the playbook is completed
>
> - name: Ensure hostname is same as ansible inventory
> hostname:
> name: "{{ inventory_hostname }}"
>
>
> the prompt on the server changes from this [root@ansible-testing ~]#
>
> to
>
> [root@10 ~]#

Troubleshooting hints:
1) What is the output from ansible-playbook -v when it executes that task?
2) What does `hostname --fqdn` (assuming linux) return after the fact?

--
Duncan Hutty
http://www.allgoodbits.org
Reply all
Reply to author
Forward
0 new messages