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
 | 
			
		||||
        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
 | 
			
		||||
- name: If the TZ is not set in env, set it to 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
 | 
			
		||||
  when: xo_model != "none" or osbuilder is defined
 | 
			
		||||
 | 
			
		||||
# set FQDN for IIAB
 | 
			
		||||
- include_tasks: hostname.yml
 | 
			
		||||
  tags:
 | 
			
		||||
    - network
 | 
			
		||||
    - domain
 | 
			
		||||
    - hostname
 | 
			
		||||
 | 
			
		||||
- include_tasks: centos.yml
 | 
			
		||||
  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
 | 
			
		||||
  shell: "cat /etc/sysconfig/iiab_wan_device"
 | 
			
		||||
  register: prior_gw
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,39 +10,6 @@
 | 
			
		|||
    - network
 | 
			
		||||
    - 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 #####
 | 
			
		||||
#- include_tasks: static.yml
 | 
			
		||||
#  when: 'iiab_wan_iface != "none" and wan_ip != "dhcp"'
 | 
			
		||||
| 
						 | 
				
			
			@ -51,20 +18,20 @@
 | 
			
		|||
- include_tasks: hosts.yml
 | 
			
		||||
  tags:
 | 
			
		||||
    - network
 | 
			
		||||
    - hostname
 | 
			
		||||
    - domain
 | 
			
		||||
 | 
			
		||||
- include_tasks: named.yml
 | 
			
		||||
  tags:
 | 
			
		||||
    - network
 | 
			
		||||
    - named
 | 
			
		||||
    - domain
 | 
			
		||||
 | 
			
		||||
- include_tasks: dhcpd.yml
 | 
			
		||||
  tags:
 | 
			
		||||
    - dhcpd
 | 
			
		||||
    - dnsmasq
 | 
			
		||||
    - squid
 | 
			
		||||
    - network
 | 
			
		||||
    - domain
 | 
			
		||||
#  when: hostname_change.changed or installing
 | 
			
		||||
 | 
			
		||||
- include_tasks: squid.yml
 | 
			
		||||
  tags:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue