ansible-role-hostname/tasks/main.yml
2019-09-16 18:09:49 +02:00

21 lines
480 B
YAML

- name: install dbus (needed to set the hostname with systemd)
apt:
pkg: dbus
when: rootpath == ""
- name: set hostname with systemd
hostname:
name: "{{ inventory_hostname_short }}"
when: rootpath == ""
- name: customize vm image hostname
copy:
dest: "{{ rootpath }}/etc/hostname"
content: '{{ inventory_hostname_short }}'
- name: customize vm image hosts file
template:
src: hosts.j2
dest: "{{ rootpath }}/etc/hosts"
when: vm is defined