Use hostname module to set hostname, and do it for all Os not only CoreOS
parent
c2c334d22f
commit
61b2d7548a
|
@ -50,11 +50,3 @@
|
|||
name: "{{ item }}"
|
||||
with_items: "{{pip_python_modules}}"
|
||||
|
||||
- name: Check configured hostname
|
||||
shell: hostname
|
||||
register: configured_hostname
|
||||
check_mode: no
|
||||
|
||||
- name: Assign inventory name to unconfigured hostnames
|
||||
shell: sh -c "echo \"{{inventory_hostname}}\" > /etc/hostname; hostname \"{{inventory_hostname}}\""
|
||||
when: (configured_hostname.stdout == 'localhost')
|
||||
|
|
|
@ -16,4 +16,15 @@
|
|||
register: ostree
|
||||
|
||||
- set_fact:
|
||||
is_atomic: "{{ ostree.stat.exists }}"
|
||||
is_atomic: "{{ ostree.stat.exists }}"
|
||||
|
||||
- name: Gather nodes hostnames
|
||||
setup:
|
||||
gather_subset: '!all'
|
||||
filter: ansible_hostname
|
||||
|
||||
- name: Assign inventory name to unconfigured hostnames
|
||||
hostname:
|
||||
name: "{{inventory_hostname}}"
|
||||
when: ansible_hostname == 'localhost'
|
||||
|
||||
|
|
Loading…
Reference in New Issue