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

replace shell use of daemon_reload with systemd module, use systemd module in place of service for hostapd

This commit is contained in:
Jerry Vonau 2018-04-07 16:45:04 -05:00
parent e7872a2a9d
commit 367164029c
7 changed files with 32 additions and 63 deletions

View file

@ -29,22 +29,11 @@
when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance" when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance"
- name: Reload systemd - name: Reload systemd
shell: systemctl daemon-reload systemd:
daemon_reload: yes
- name: Restart the NetworkManager service - name: Restart the NetworkManager service
service: systemd:
name: network-manager name: network-manager
state: restarted state: restarted
when: not nobridge is defined and not no_net_restart when: not nobridge is defined and not no_net_restart
- name: Restart hostapd when WiFi is present
service:
name: hostapd
state: restarted
when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance"
- name: dhcp_server may be affected - starting - user choice
service:
name: "{{ dhcp_service2 }}"
state: started
when: iiab_network_mode != "Appliance"

View file

@ -58,7 +58,8 @@
when: dnsmasq_install when: dnsmasq_install
- name: Reload systemd - name: Reload systemd
shell: systemctl daemon-reload systemd:
daemon_reload: yes
# now pick up denyinterfaces # now pick up denyinterfaces
- name: Restart dhcpcd - name: Restart dhcpcd
@ -68,11 +69,3 @@
- name: Restart the networking service - name: Restart the networking service
service: name=networking state=restarted service: name=networking state=restarted
when: not nobridge is defined and not no_net_restart when: not nobridge is defined and not no_net_restart
- name: Restart hostapd when WiFi is present
service: name=hostapd state=restarted
when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance"
#- name: dhcp_server may be affected - starting - user choice
# service: name={{ dhcp_service2 }} state=started
# when: iiab_network_mode != "Appliance"

View file

@ -16,12 +16,6 @@
mode: 0644 mode: 0644
when: discovered_wireless_iface is defined when: discovered_wireless_iface is defined
- name: Disable the Access Point 'hostapd' service
service:
enabled: no
name: hostapd.service
when: not hostapd_enabled
- name: Use custom systemd unit file to start 'hostapd' service - name: Use custom systemd unit file to start 'hostapd' service
template: template:
src: hostapd/hostapd.service.j2 src: hostapd/hostapd.service.j2
@ -46,6 +40,14 @@
group: root group: root
mode: 0755 mode: 0755
- name: Ansible is having a problem enabling hostapd service - name: Disable the Access Point 'hostapd' service
shell: systemctl enable hostapd systemd:
name: hostapd
enabled: no
when: not hostapd_enabled
- name: Enable the Access Point 'hostapd' service
systemd:
name: hostapd
enabled: yes
when: hostapd_enabled and iiab_wireless_lan_iface is defined and iiab_network_mode != "Appliance" when: hostapd_enabled and iiab_wireless_lan_iface is defined and iiab_network_mode != "Appliance"

View file

@ -1,6 +1,7 @@
- name: Stop the Access Point hostapd program - name: Stop the Access Point hostapd program
service: name=hostapd.service systemd:
state=stopped name: hostapd
state: stopped
when: iiab_wireless_lan_iface != "none" when: iiab_wireless_lan_iface != "none"
# might need an exclude for F18 here # might need an exclude for F18 here
@ -81,7 +82,8 @@
when: not installing and not iiab_demo_mode when: not installing and not iiab_demo_mode
- name: ask systemd to reread the unit files, picks up changes done - name: ask systemd to reread the unit files, picks up changes done
shell: systemctl daemon-reload systemd:
daemon_reload: yes
when: not installing when: not installing
# monitor-connection-files defaults to no with F21, F18-F20 defaults to yes # monitor-connection-files defaults to no with F21, F18-F20 defaults to yes

View file

@ -1,6 +1,8 @@
#- name: restart hostapd when wifi is present - name: restart hostapd when wifi is present
# service: name=hostapd state=started systemd:
# when: iiab_wireless_lan_iface is defined and hostapd_enabled name: hostapd
state: restarted
when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance"
- name: Start named service - name: Start named service
service: service:
@ -63,8 +65,8 @@
register: wifi_slave register: wifi_slave
- name: Restart hostapd if WiFi slave is inactive - name: Restart hostapd if WiFi slave is inactive
service: systemd:
name: hostapd.service name: hostapd
state: restarted state: restarted
when: hostapd_enabled and wifi_slave.stdout is defined and wifi_slave.stdout == 0 when: hostapd_enabled and wifi_slave.stdout is defined and wifi_slave.stdout == 0

View file

@ -46,7 +46,8 @@
include_tasks: down-debian.yml include_tasks: down-debian.yml
- name: Reload systemd - name: Reload systemd
shell: systemctl daemon-reload systemd:
daemon_reload: yes
# now pick up denyinterfaces # now pick up denyinterfaces
- name: Restart dhcpcd - name: Restart dhcpcd
@ -60,13 +61,3 @@
enabled: yes enabled: yes
state: restarted state: restarted
when: not nobridge is defined and not no_net_restart when: not nobridge is defined and not no_net_restart
- name: Restart hostapd if appropriate
service:
name: hostapd
state: restarted
when: hostapd_enabled and iiab_wan_iface != discovered_wireless_iface and iiab_network_mode != "Appliance"
#- name: dhcp_server may be affected - starting - user choice
# service: name={{ dhcp_service2 }} state=started
# when: iiab_network_mode != "Appliance"

View file

@ -19,22 +19,12 @@
include_tasks: down-debian.yml include_tasks: down-debian.yml
- name: Reload systemd - name: Reload systemd
shell: systemctl daemon-reload systemd:
daemon_reload: yes
- name: Restart the systemd-networkd service - name: Restart the systemd-networkd service
service: systemd:
name: systemd-networkd name: systemd-networkd
enabled: yes enabled: yes
state: restarted state: restarted
when: not nobridge is defined and not no_net_restart when: not nobridge is defined and not no_net_restart
- name: Restart hostapd when WiFi is present
service:
name: hostapd
enabled: yes
state: restarted
when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance"
#- name: dhcp_server may be affected - starting - user choice
# service: name={{ dhcp_service2 }} state=started
# when: iiab_network_mode != "Appliance"