vn-ansible/roles/debian-host/tasks/hostname.yml

13 lines
382 B
YAML
Raw Normal View History

- name: Set the hostname in /etc/hostname
hostname:
name: "{{ inventory_hostname_short }}"
use: debian
- name: Configure hostname in hosts
blockinfile:
path: /etc/hosts
marker_begin: '--- BEGIN VN ---'
marker_end: '--- END VN ---'
marker: "# {mark}"
block: |
{{ ansible_default_ipv4.address }} {{ ansible_host }} {{ inventory_hostname_short }}