bootstrap - set hostname
This commit is contained in:
parent
f8cf17f18a
commit
879756c7da
1 changed files with 13 additions and 0 deletions
|
@ -50,6 +50,19 @@
|
||||||
regexp: "^{{ hostvars[item].ip }} "
|
regexp: "^{{ hostvars[item].ip }} "
|
||||||
with_items: "{{ groups.all }}"
|
with_items: "{{ groups.all }}"
|
||||||
|
|
||||||
|
- name: set hostname to match inventory
|
||||||
|
hostname:
|
||||||
|
name: "{{ inventory_hostname }}"
|
||||||
|
register: hostname_change
|
||||||
|
|
||||||
|
- name: restart hostname-change sensitive services
|
||||||
|
service:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: restarted
|
||||||
|
with_items:
|
||||||
|
- rsyslog
|
||||||
|
when: (hostname_change is changed) and (ansible_distribution in ["CentOS", "Red Hat Enterprise Linux", "Fedora"] and not is_atomic)
|
||||||
|
|
||||||
- name: remove requiretty
|
- name: remove requiretty
|
||||||
lineinfile:
|
lineinfile:
|
||||||
regexp: '^\w+\s+requiretty'
|
regexp: '^\w+\s+requiretty'
|
||||||
|
|
Loading…
Reference in a new issue