1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

remove named and dhcpd install options

This commit is contained in:
Jerry Vonau 2022-07-08 01:16:36 -05:00
parent 10ebd9441b
commit a9e92191db
40 changed files with 95 additions and 91 deletions

View file

@ -1,6 +1,6 @@
# NM-debian.yml # NM-debian.yml
- name: Stopping services #- name: Stopping services
include_tasks: down-debian.yml # include_tasks: down-debian.yml
# provide keyfile layout like the XO's used way back. # provide keyfile layout like the XO's used way back.
#- name: Create uuid for NM's keyfile store #- name: Create uuid for NM's keyfile store

View file

@ -22,30 +22,30 @@
- name: No LAN configured - non-dnsmasq - name: No LAN configured - non-dnsmasq
set_fact: set_fact:
named_enabled: True # named_enabled: True
dhcpd_enabled: False # dhcpd_enabled: False
dhcp_service2: "dhcpd disabled" dhcp_service2: "dhcpd disabled"
when: not dnsmasq_enabled and iiab_network_mode == "Appliance" when: not dnsmasq_enabled and iiab_network_mode == "Appliance"
- name: LAN configured - non-dnsmasq - name: LAN configured - non-dnsmasq
set_fact: set_fact:
named_enabled: True # named_enabled: True
dhcpd_enabled: True # dhcpd_enabled: True
dhcp_service2: "dhcpd" dhcp_service2: "dhcpd"
when: not dnsmasq_enabled and iiab_network_mode != "Appliance" when: not dnsmasq_enabled and iiab_network_mode != "Appliance"
- name: LAN configured - dnsmasq - name: LAN configured - dnsmasq
set_fact: set_fact:
named_enabled: False # named_enabled: False
dhcpd_enabled: False # dhcpd_enabled: False
dnsmasq_enabled: True dnsmasq_enabled: True
dhcp_service2: "dnsmasq" dhcp_service2: "dnsmasq"
when: dnsmasq_install and iiab_network_mode != "Appliance" when: dnsmasq_install and iiab_network_mode != "Appliance"
- name: LAN not configured - dnsmasq - name: LAN not configured - dnsmasq
set_fact: set_fact:
named_enabled: False # named_enabled: False
dhcpd_enabled: False # dhcpd_enabled: False
dnsmasq_enabled: True dnsmasq_enabled: True
dhcp_service2: "dnsmasq" dhcp_service2: "dnsmasq"
when: dnsmasq_install and iiab_network_mode == "Appliance" when: dnsmasq_install and iiab_network_mode == "Appliance"
@ -71,12 +71,12 @@
# value: "{{ wondershaper_enabled }}" # value: "{{ wondershaper_enabled }}"
- option: iiab_network_mode_applied - option: iiab_network_mode_applied
value: "{{ iiab_network_mode }}" value: "{{ iiab_network_mode }}"
- option: dhcpd_enabled # - option: dhcpd_enabled
value: "{{ dhcpd_enabled }}" # value: "{{ dhcpd_enabled }}"
- option: dhcp_service2 # - option: dhcp_service2
value: "{{ dhcp_service2 }}" # value: "{{ dhcp_service2 }}"
- option: named_enabled # - option: named_enabled
value: "{{ named_enabled }}" # value: "{{ named_enabled }}"
- option: dnsmasq_enabled - option: dnsmasq_enabled
value: "{{ dnsmasq_enabled }}" value: "{{ dnsmasq_enabled }}"
- option: no_net_restart - option: no_net_restart
@ -89,7 +89,7 @@
value: "{{ host_wifi_mode }}" value: "{{ host_wifi_mode }}"
- option: host_channel - option: host_channel
value: "{{ host_channel }}" value: "{{ host_channel }}"
- name: Add 'network' variable 'current_client_channel' value if defined, to {{ iiab_ini_file }} - name: Add 'network' variable 'current_client_channel' value if defined, to {{ iiab_ini_file }}
ini_file: ini_file:
dest: "{{ iiab_ini_file }}" dest: "{{ iiab_ini_file }}"

View file

@ -62,7 +62,7 @@
regexp: "{{ iiab_wan_iface }}" regexp: "{{ iiab_wan_iface }}"
when: wan_ip != "dhcp" and iiab_wan_iface != "none" and is_debian and not is_debian_8 when: wan_ip != "dhcp" and iiab_wan_iface != "none" and is_debian and not is_debian_8
- include_tasks: down-debian.yml #- include_tasks: down-debian.yml
- name: Reload systemd - name: Reload systemd
systemd: systemd:

View file

@ -1,70 +1,72 @@
- name: Disable dhcpd service #- name: Disable dhcpd service
service: # service:
name: dhcpd # name: dhcpd
enabled: no # enabled: no
when: (dhcpd_install or dhcpd_installed is defined) and not dhcpd_enabled # when: (dhcpd_install or dhcpd_installed is defined) and not dhcpd_enabled
# service is restarted with NM dispatcher.d script # service is restarted with NM dispatcher.d script
- name: Enable dhcpd service #- name: Enable dhcpd service
service: # service:
name: dhcpd # name: dhcpd
enabled: yes # enabled: yes
when: dhcpd_install and dhcpd_enabled # when: dhcpd_install and dhcpd_enabled
- name: Install /etc/sysconfig/dhcpd, /etc/dhcpd-iiab.conf from templates (root:root, 0644 by default) #- name: Install /etc/sysconfig/dhcpd, /etc/dhcpd-iiab.conf from templates (root:root, 0644 by default)
template: # template:
src: "{{ item.src }}" # src: "{{ item.src }}"
dest: "{{ item.dest }}" # dest: "{{ item.dest }}"
# # owner: root
# group: root
# mode: "{{ item.mode }}"
# with_items:
# - { src: 'dhcp/dhcpd-env.j2', dest: '/etc/sysconfig/dhcpd' }
# - { src: 'dhcp/dhcpd-iiab.conf.j2', dest: '/etc/dhcpd-iiab.conf' }
# when: dhcpd_install and dhcpd_enabled
#- name: Install /etc/named-iiab.conf and two *.zone.db files into /var/named-iiab (root:root, 0644 by default)
# template:
# src: "{{ item.src }}"
# dest: "{{ item.dest }}"
# owner: root # owner: root
# group: root # group: root
# mode: "{{ item.mode }}" # mode: "{{ item.mode }}"
with_items: # with_items:
- { src: 'dhcp/dhcpd-env.j2', dest: '/etc/sysconfig/dhcpd' } # - { src: 'named/named-iiab.conf.j2', dest: '/etc/named-iiab.conf' }
- { src: 'dhcp/dhcpd-iiab.conf.j2', dest: '/etc/dhcpd-iiab.conf' } # - { src: 'named/school.local.zone.db.j2', dest: '/var/named-iiab/school.local.zone.db' }
when: dhcpd_install and dhcpd_enabled # - { src: 'named/school.internal.zone.db.j2', dest: '/var/named-iiab/school.internal.zone.db' }
# when: named_install and named_enabled
- name: Install /etc/named-iiab.conf and two *.zone.db files into /var/named-iiab (root:root, 0644 by default) #- name: Enable named service ({{ dns_service }}) if named_enabled
template: # systemd:
src: "{{ item.src }}" # name: "{{ dns_service }}"
dest: "{{ item.dest }}" # enabled: yes
# owner: root # when: named_install and named_enabled
# group: root
# mode: "{{ item.mode }}"
with_items:
- { src: 'named/named-iiab.conf.j2', dest: '/etc/named-iiab.conf' }
- { src: 'named/school.local.zone.db.j2', dest: '/var/named-iiab/school.local.zone.db' }
- { src: 'named/school.internal.zone.db.j2', dest: '/var/named-iiab/school.internal.zone.db' }
when: named_install and named_enabled
- name: Enable named service ({{ dns_service }}) if named_enabled #- name: Disable named service ({{ dns_service }}) if not named_enabled
systemd: # systemd:
name: "{{ dns_service }}" # name: "{{ dns_service }}"
enabled: yes # enabled: no
when: named_install and named_enabled # when: (named_install or named_installed is defined) and not named_enabled
- name: Disable named service ({{ dns_service }}) if not named_enabled
systemd:
name: "{{ dns_service }}"
enabled: no
when: (named_install or named_installed is defined) and not named_enabled
- name: Install /etc/dnsmasq.d/iiab.conf from template, when dnsmasq_enabled and isn't Appliance - name: Install /etc/dnsmasq.d/iiab.conf from template, when dnsmasq_enabled and isn't Appliance
template: template:
src: network/dnsmasq.conf.j2 src: network/dnsmasq.conf.j2
dest: /etc/dnsmasq.d/iiab.conf dest: /etc/dnsmasq.d/iiab.conf
when: dnsmasq_install and dnsmasq_enabled and (iiab_network_mode != "Appliance") when: iiab_network_mode != "Appliance"
# when: dnsmasq_install and dnsmasq_enabled and (iiab_network_mode != "Appliance")
- name: Install /etc/hosts.dnsmasq from template for /etc/dnsmasq.d/iiab.conf (instead of using /etc/hosts) - name: Install /etc/hosts.dnsmasq from template for /etc/dnsmasq.d/iiab.conf (instead of using /etc/hosts)
template: template:
src: network/hosts-dnsmasq.j2 src: network/hosts-dnsmasq.j2
dest: /etc/hosts.dnsmasq dest: /etc/hosts.dnsmasq
when: dnsmasq_install and dnsmasq_enabled and (iiab_network_mode != "Appliance") when: iiab_network_mode != "Appliance"
# when: dnsmasq_install and dnsmasq_enabled and (iiab_network_mode != "Appliance")
- name: Update /etc/dnsmasq.d/dnsmasq-iiab for custom dns setting - name: Update /etc/dnsmasq.d/dnsmasq-iiab for custom dns setting
template: template:
src: network/dnsmasq-iiab src: network/dnsmasq-iiab
dest: /etc/dnsmasq.d/dnsmasq-iiab dest: /etc/dnsmasq.d/dnsmasq-iiab
when: dnsmasq_install # 2020-05-10: Are all these dnsmasq_install conditions really still necessary ? # when: dnsmasq_install # 2020-05-10: Are all these dnsmasq_install conditions really still necessary ?
## Another way to skin the cat ## Another way to skin the cat
##- name: Check if systemd service networkd-dispatcher is enabled ##- name: Check if systemd service networkd-dispatcher is enabled
@ -100,7 +102,8 @@
mode: 0755 mode: 0755
# owner: root # owner: root
# group: root # group: root
when: dnsmasq_install and dnsmasq_enabled and nd_dir.stat.exists and nd_dir.stat.isdir and (iiab_network_mode != "Appliance") when: nd_dir.stat.exists and nd_dir.stat.isdir and (iiab_network_mode != "Appliance")
# when: dnsmasq_install and dnsmasq_enabled and nd_dir.stat.exists and nd_dir.stat.isdir and (iiab_network_mode != "Appliance")
#when: dnsmasq_install and dnsmasq_enabled and nd_enabled is defined and nd_enabled.stdout == "enabled" and nd_dir.stat.exists and nd_dir.stat.isdir and (iiab_network_mode != "Appliance") #when: dnsmasq_install and dnsmasq_enabled and nd_enabled is defined and nd_enabled.stdout == "enabled" and nd_dir.stat.exists and nd_dir.stat.isdir and (iiab_network_mode != "Appliance")
#when: dnsmasq_install and dnsmasq_enabled and systemd_out.status.UnitFileState == "enabled" and networkd_dir.stat.exists and networkd_dir.stat.isdir and (iiab_network_mode != "Appliance") #when: dnsmasq_install and dnsmasq_enabled and systemd_out.status.UnitFileState == "enabled" and networkd_dir.stat.exists and networkd_dir.stat.isdir and (iiab_network_mode != "Appliance")
@ -108,13 +111,13 @@
file: file:
path: /etc/dnsmasq.d/iiab.conf path: /etc/dnsmasq.d/iiab.conf
state: absent state: absent
when: (not dnsmasq_enabled) or (iiab_network_mode == "Appliance") when: iiab_network_mode == "Appliance"
- name: Enable iiab-dnsmasq systemd service, if dnsmasq_enabled - name: Enable iiab-dnsmasq systemd service, if dnsmasq_enabled
systemd: systemd:
name: iiab-dnsmasq name: iiab-dnsmasq
enabled: yes enabled: yes
when: dnsmasq_install and dnsmasq_enabled # when: dnsmasq_install and dnsmasq_enabled
- name: Disable iiab-dnsmasq, if not dnsmasq_enabled - name: Disable iiab-dnsmasq, if not dnsmasq_enabled
systemd: systemd:

View file

@ -62,14 +62,14 @@
# UNMAINTAINED # UNMAINTAINED
- name: Install named / BIND #- name: Install named / BIND
include_tasks: roles/network/tasks/named.yml # include_tasks: roles/network/tasks/named.yml
when: named_install is defined and named_install # when: named_install is defined and named_install
# UNMAINTAINED # UNMAINTAINED
- name: Install dhcpd #- name: Install dhcpd
include_tasks: roles/network/tasks/dhcpd.yml # include_tasks: roles/network/tasks/dhcpd.yml
when: dhcpd_install is defined and dhcpd_install # when: dhcpd_install is defined and dhcpd_install
# LESS MAINTAINED # LESS MAINTAINED
- name: Install Squid - name: Install Squid

View file

@ -47,17 +47,17 @@
# include_tasks: wondershaper.yml # include_tasks: wondershaper.yml
# when: wondershaper_install or wondershaper_installed is defined # when: wondershaper_install or wondershaper_installed is defined
- name: (Re)Install named # - name: (Re)Install named
include_tasks: named.yml # include_tasks: named.yml
when: named_install and FQDN_changed and iiab_stage|int == 9 # when: named_install and FQDN_changed and iiab_stage|int == 9
- name: (Re)Install dhcpd # - name: (Re)Install dhcpd
include_tasks: dhcpd.yml # include_tasks: dhcpd.yml
when: dhcpd_install and FQDN_changed and iiab_stage|int == 9 # when: dhcpd_install and FQDN_changed and iiab_stage|int == 9
- name: (Re)Install Squid # - name: (Re)Install Squid
include_tasks: squid.yml # include_tasks: squid.yml
when: squid_install and FQDN_changed and iiab_stage|int == 9 # when: squid_install and FQDN_changed and iiab_stage|int == 9
#preprep for backends #preprep for backends
- name: Netplan in use on Ubuntu 18.04+ - name: Netplan in use on Ubuntu 18.04+

View file

@ -29,11 +29,11 @@
shell: netplan apply shell: netplan apply
when: wifi_up_down and is_ubuntu and netplan.stdout.find("yaml") != -1 when: wifi_up_down and is_ubuntu and netplan.stdout.find("yaml") != -1
- name: Start named service #- name: Start named service
systemd: # systemd:
name: "{{ dns_service }}" # name: "{{ dns_service }}"
state: restarted # state: restarted
when: named_enabled and named_install # when: named_enabled and named_install
- name: Stop Squid service - name: Stop Squid service
systemd: systemd:
@ -98,7 +98,8 @@
#both interfaces.d and systemd-networkd should have br0 available and Appliance lacks br0 #both interfaces.d and systemd-networkd should have br0 available and Appliance lacks br0
#keep an eye on legacy wifi installs where br0 is present but not 'online' with an ip address #keep an eye on legacy wifi installs where br0 is present but not 'online' with an ip address
#due to hostapd didn't go to a carrier state. All others should get dnsmasq restarted #due to hostapd didn't go to a carrier state. All others should get dnsmasq restarted
- name: User choice of dnsmasq or dhcpd - restarting {{ dhcp_service2 }} #- name: User choice of dnsmasq or dhcpd - restarting {{ dhcp_service2 }}
- name: Restarting {{ dhcp_service2 }}
systemd: systemd:
name: "{{ dhcp_service2 }}" name: "{{ dhcp_service2 }}"
state: restarted state: restarted

View file

@ -31,7 +31,7 @@
when: country_code is defined and country_code.stdout | length > 0 when: country_code is defined and country_code.stdout | length > 0
- name: Put country code ({{ host_country_code }}) in /etc/wpa_supplicant/wpa_supplicant.conf if nec - name: Put country code ({{ host_country_code }}) in /etc/wpa_supplicant/wpa_supplicant.conf if nec
lineinfile: lineinfile:
path: /etc/wpa_supplicant/wpa_supplicant.conf path: /etc/wpa_supplicant/wpa_supplicant.conf
regexp: "^country.*" regexp: "^country.*"
line: country={{ host_country_code }} line: country={{ host_country_code }}
@ -54,8 +54,8 @@
src: network/dnsmasq-iiab src: network/dnsmasq-iiab
when: iiab_lan_iface == "br0" when: iiab_lan_iface == "br0"
- name: Stopping services #- name: Stopping services
include_tasks: down-debian.yml # include_tasks: down-debian.yml
- name: Reload systemd - name: Reload systemd
systemd: systemd:

View file

@ -44,8 +44,8 @@
#when: wan_ip != "dhcp" and not is_ubuntu_18 #when: wan_ip != "dhcp" and not is_ubuntu_18
- name: Stopping services #- name: Stopping services
include_tasks: down-debian.yml # include_tasks: down-debian.yml
- name: Reload systemd - name: Reload systemd
systemd: systemd: