bootstrap - set hostname

This commit is contained in:
Josh Lay 2019-07-30 21:52:28 -05:00
parent f8cf17f18a
commit 879756c7da

View file

@ -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'