roles: bootstrap-os: Use 'hostname' command on Tumbleweed
openSUSE Tumbleweed is having the same problems with CoreOS when it comes to using the hostname ansible module (#1588, #1600) so we need to apply a similar workaround. Co-authored-by: Markos Chandras <mchandras@suse.de> Link: http://bugzilla.opensuse.org/show_bug.cgi?id=997614
This commit is contained in:
parent
dca4777347
commit
4ba25326ed
1 changed files with 13 additions and 6 deletions
|
@ -29,18 +29,25 @@
|
|||
gather_subset: '!all'
|
||||
filter: ansible_*
|
||||
|
||||
- name: Assign inventory name to unconfigured hostnames (non-CoreOS)
|
||||
- name: Assign inventory name to unconfigured hostnames (non-CoreOS and Tumbleweed)
|
||||
hostname:
|
||||
name: "{{inventory_hostname}}"
|
||||
when: ansible_os_family not in ['CoreOS', 'Container Linux by CoreOS'] and override_system_hostname
|
||||
when:
|
||||
- override_system_hostname
|
||||
- ansible_distribution not in ['openSUSE Tumbleweed']
|
||||
- ansible_os_family not in ['CoreOS', 'Container Linux by CoreOS']
|
||||
|
||||
- name: Assign inventory name to unconfigured hostnames (CoreOS only)
|
||||
- name: Assign inventory name to unconfigured hostnames (CoreOS and Tumbleweed only)
|
||||
command: "hostnamectl set-hostname {{inventory_hostname}}"
|
||||
register: hostname_changed
|
||||
when: ansible_hostname == 'localhost' and ansible_os_family in ['CoreOS', 'Container Linux by CoreOS'] and override_system_hostname
|
||||
when:
|
||||
- ansible_hostname == 'localhost'
|
||||
- ansible_distribution in ['openSUSE Tumbleweed'] or ansible_os_family in ['CoreOS', 'Container Linux by CoreOS']
|
||||
- override_system_hostname
|
||||
|
||||
- name: Update hostname fact (CoreOS only)
|
||||
- name: Update hostname fact (CoreOS and Tumbleweed only)
|
||||
setup:
|
||||
gather_subset: '!all'
|
||||
filter: ansible_hostname
|
||||
when: ansible_os_family in ['CoreOS', 'Container Linux by CoreOS'] and hostname_changed.changed
|
||||
when:
|
||||
- hostname_changed.changed
|
||||
|
|
Loading…
Reference in a new issue