Update the hostname if update_hostname: yes

This commit is contained in:
Jan Beilicke 2020-04-01 21:30:47 +02:00
parent 66acbf2930
commit 3c2f642820
3 changed files with 9 additions and 0 deletions

View file

@ -12,6 +12,8 @@ Role Variables
Defaults:
```
hostname: {{ inventory_hostname }}
update_hostname: no
locales_gen:
- en_US.UTF-8
- de_DE.UTF-8

View file

@ -1,5 +1,7 @@
---
# defaults file for common
hostname: '{{ inventory_hostname }}'
update_hostname: yes
locales_gen:
- en_US.UTF-8
- de_DE.UTF-8

View file

@ -1,5 +1,10 @@
---
# tasks file for common
- name: Update hostname
become: true
hostname:
name: '{{ hostname }}'
when: hostname and update_hostname == True
- name: Firewall
become: true