infra-ansible/roles/set_hostnames/tasks/main.yml
Timothy Chavez 9e4ea666b5 Remove trailing whitespace
There were a few instances of trailing whitespace.  This patch
removes them.

Change-Id: Ia2f978a23336e9e7b43049812152cd9538a702e9
2015-09-08 21:29:10 -05:00

17 lines
567 B
YAML

---
# Set hostname and /etc/hosts
# Inspired by:
# https://github.com/ansible/ansible/pull/8482)
# https://gist.github.com/rothgar/8793800
- name: Set /etc/hostname
hostname: name="{{ inventory_hostname.split('.', 1)[0] }}"
# " lovely lonely double-quote for fixing vim highlighting
- name: Add all infra hosts to /etc/hosts
lineinfile: dest=/etc/hosts
line='{{ hostvars[item]['openstack']['private_v4'] }} {{ item }} {{ item.split('.', 1)[0] }}'
insertafter='^127\.0\.0\.1'
state=present
with_items: groups['infra']