add management of /etc/hosts and hostname
This commit is contained in:
22
tasks/hostname.yml
Normal file
22
tasks/hostname.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
- name: set hostname
|
||||
hostname:
|
||||
name: "{{ inventory_hostname_short }}"
|
||||
|
||||
- name: /etc/hostname
|
||||
copy:
|
||||
dest: /etc/hostname
|
||||
content: "{{ inventory_hostname_short }}\n"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
backup: yes
|
||||
state: file
|
||||
|
||||
- name: /etc/hosts
|
||||
template:
|
||||
dest: /etc/hosts
|
||||
src: hosts.j2
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
@@ -1,6 +1,11 @@
|
||||
---
|
||||
|
||||
- include: resolvconf.yml
|
||||
|
||||
- include: hostname.yml
|
||||
when: common_hostname
|
||||
tags: ['common', 'hostname']
|
||||
|
||||
- include: apt.yml
|
||||
|
||||
- include: locales.yml
|
||||
|
||||
Reference in New Issue
Block a user