mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
move hostname handling from network role --edited double check after rebase
This commit is contained in:
parent
b81c2c5121
commit
c0590d973e
5 changed files with 30 additions and 47 deletions
|
@ -47,6 +47,15 @@
|
||||||
file: path=/tmp/heart-beat.txt
|
file: path=/tmp/heart-beat.txt
|
||||||
state=absent
|
state=absent
|
||||||
|
|
||||||
|
- name: no prior domain name
|
||||||
|
set_fact:
|
||||||
|
iiab_domain: "{{ iiab_domain }}"
|
||||||
|
iiab_hostname: "{{ iiab_hostname }}"
|
||||||
|
|
||||||
|
# Now check FQDN
|
||||||
|
- include: roles/2-common/tasks/hostname.yml
|
||||||
|
when: not first_run and "iiab_hostname.iiab_domain" != ansible_fqdn
|
||||||
|
|
||||||
# Put all computed vars here so derive properly from any prior var file
|
# Put all computed vars here so derive properly from any prior var file
|
||||||
- name: If the TZ is not set in env, set it to UTC
|
- name: If the TZ is not set in env, set it to UTC
|
||||||
set_fact: local_tz='UTC'
|
set_fact: local_tz='UTC'
|
||||||
|
|
11
roles/2-common/tasks/hostname.yml
Normal file
11
roles/2-common/tasks/hostname.yml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
- name: turn the crank for systemd
|
||||||
|
shell: hostnamectl set-hostname "{{ iiab_hostname }}.{{ iiab_domain }}"
|
||||||
|
when: is_debuntu
|
||||||
|
|
||||||
|
- name: Configure /etc/sysconfig/network
|
||||||
|
template: src=roles/network/templates/network/sysconfig.network.j2
|
||||||
|
dest=/etc/sysconfig/network
|
||||||
|
owner=root
|
||||||
|
group=root
|
||||||
|
mode=0644
|
||||||
|
when: is_redhat
|
|
@ -11,6 +11,13 @@
|
||||||
- include_tasks: xo.yml
|
- include_tasks: xo.yml
|
||||||
when: xo_model != "none" or osbuilder is defined
|
when: xo_model != "none" or osbuilder is defined
|
||||||
|
|
||||||
|
# set FQDN for IIAB
|
||||||
|
- include_tasks: hostname.yml
|
||||||
|
tags:
|
||||||
|
- network
|
||||||
|
- domain
|
||||||
|
- hostname
|
||||||
|
|
||||||
- include_tasks: centos.yml
|
- include_tasks: centos.yml
|
||||||
when: ansible_distribution == "CentOS"
|
when: ansible_distribution == "CentOS"
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,3 @@
|
||||||
- name: Checking iiab_domain_name
|
|
||||||
shell: "cat /etc/sysconfig/iiab_domain_name"
|
|
||||||
register: prior_domain
|
|
||||||
when: not first_run
|
|
||||||
|
|
||||||
# above always registers
|
|
||||||
- name: Checking for prior domain name
|
|
||||||
set_fact:
|
|
||||||
iiab_domain: "{{ prior_domain.stdout }}"
|
|
||||||
when: not first_run and prior_domain.stdout != "lan" and prior_domain.stdout != ""
|
|
||||||
|
|
||||||
- name: iiab_wan_device
|
- name: iiab_wan_device
|
||||||
shell: "cat /etc/sysconfig/iiab_wan_device"
|
shell: "cat /etc/sysconfig/iiab_wan_device"
|
||||||
register: prior_gw
|
register: prior_gw
|
||||||
|
|
|
@ -10,39 +10,6 @@
|
||||||
- network
|
- network
|
||||||
- network-discover
|
- network-discover
|
||||||
|
|
||||||
- name: Set hostname
|
|
||||||
template: dest=/etc/hostname
|
|
||||||
src=network/hostname.j2
|
|
||||||
owner=root
|
|
||||||
mode=0644
|
|
||||||
when: is_debuntu
|
|
||||||
register: hostname_change
|
|
||||||
tags:
|
|
||||||
- network
|
|
||||||
- domain
|
|
||||||
|
|
||||||
- name: Configure /etc/sysconfig/network
|
|
||||||
template: src=network/sysconfig.network.j2
|
|
||||||
dest=/etc/sysconfig/network
|
|
||||||
owner=root
|
|
||||||
group=root
|
|
||||||
mode=0644
|
|
||||||
when: is_redhat
|
|
||||||
register: hostname_change
|
|
||||||
tags:
|
|
||||||
- network
|
|
||||||
- domain
|
|
||||||
|
|
||||||
- name: Create iiab_domain_name flag
|
|
||||||
template: src=network/{{ item }}.j2
|
|
||||||
dest=/etc/sysconfig/{{ item }}
|
|
||||||
mode=0644
|
|
||||||
with_items:
|
|
||||||
- iiab_domain_name
|
|
||||||
tags:
|
|
||||||
- network
|
|
||||||
- domain
|
|
||||||
|
|
||||||
##### Start static ip address info for first run #####
|
##### Start static ip address info for first run #####
|
||||||
#- include_tasks: static.yml
|
#- include_tasks: static.yml
|
||||||
# when: 'iiab_wan_iface != "none" and wan_ip != "dhcp"'
|
# when: 'iiab_wan_iface != "none" and wan_ip != "dhcp"'
|
||||||
|
@ -51,20 +18,20 @@
|
||||||
- include_tasks: hosts.yml
|
- include_tasks: hosts.yml
|
||||||
tags:
|
tags:
|
||||||
- network
|
- network
|
||||||
|
- hostname
|
||||||
- domain
|
- domain
|
||||||
|
|
||||||
- include_tasks: named.yml
|
- include_tasks: named.yml
|
||||||
tags:
|
tags:
|
||||||
- network
|
- network
|
||||||
- named
|
- named
|
||||||
|
- domain
|
||||||
|
|
||||||
- include_tasks: dhcpd.yml
|
- include_tasks: dhcpd.yml
|
||||||
tags:
|
tags:
|
||||||
- dhcpd
|
- dhcpd
|
||||||
- dnsmasq
|
- network
|
||||||
- squid
|
|
||||||
- domain
|
- domain
|
||||||
# when: hostname_change.changed or installing
|
|
||||||
|
|
||||||
- include_tasks: squid.yml
|
- include_tasks: squid.yml
|
||||||
tags:
|
tags:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue