system-config/playbooks/roles/set_hostname/tasks/main.yml
Monty Taylor 710518f652
Remove cloud-init when we set hostnames
We don't need it for any purpose after first-boot. Make it go away.

Change-Id: I7c2d974a2c301c4de2b8b80fde12b1ca7c941e2d
2017-10-06 12:51:15 -05:00

19 lines
462 B
YAML

---
- name: Remove cloud-init
package:
name: cloud-init
state: absent
# 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] }}"
- name: Set /etc/hosts
template: src=hosts.j2 dest=/etc/hosts mode=0644
- name: Set /etc/mailname
template: src=mailname.j2 dest=/etc/mailname mode=0644