From 58292c310c6a6d828a7cd5e0179306799d16a408 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 18:03:41 -0400 Subject: [PATCH 01/14] Update debs.yml --- roles/calibre/tasks/debs.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/roles/calibre/tasks/debs.yml b/roles/calibre/tasks/debs.yml index 03d77ae32..02021775d 100644 --- a/roles/calibre/tasks/debs.yml +++ b/roles/calibre/tasks/debs.yml @@ -9,4 +9,9 @@ - name: Upgrade latest Calibre command: scripts/calibre-install-latest.sh - when: not is_rpi + #when: not is_rpi + +# Oops "when: not is_rpi" causes Calibre playbook to fail on Raspbian Lite (possibly +# other OS's too). Error msg is: "Unable to start service calibre-serve: Job for +# calibre-serve.service failed because the control process exited with error code." +# Running "calibre --version" responds with "calibre (calibre 2.75.1)". From f8b8c51735867403767ac394644292b637c9a1a9 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 18:06:28 -0400 Subject: [PATCH 02/14] Update debs.yml --- roles/calibre/tasks/debs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/calibre/tasks/debs.yml b/roles/calibre/tasks/debs.yml index 02021775d..02c9e1283 100644 --- a/roles/calibre/tasks/debs.yml +++ b/roles/calibre/tasks/debs.yml @@ -14,4 +14,4 @@ # Oops "when: not is_rpi" causes Calibre playbook to fail on Raspbian Lite (possibly # other OS's too). Error msg is: "Unable to start service calibre-serve: Job for # calibre-serve.service failed because the control process exited with error code." -# Running "calibre --version" responds with "calibre (calibre 2.75.1)". +# Running "calibre --version" then responds with "calibre (calibre 2.75.1)". From fd2daca9c005ec74ce5c73e46e84a5b0a4844dd2 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 6 Apr 2018 18:03:38 -0500 Subject: [PATCH 03/14] Calibre - split RPi from others to use raspbain's testing repo, split off unstable --- roles/calibre/defaults/main.yml | 4 +++- roles/calibre/tasks/debs.yml | 17 ++++++++++------- scripts/calibre-install-latest-rpi.sh | 18 ++++++++++++++++++ scripts/calibre-install-latest.sh | 18 ++++++------------ scripts/calibre-install-unstable.sh | 18 ++++++++++++++++++ 5 files changed, 55 insertions(+), 20 deletions(-) create mode 100755 scripts/calibre-install-latest-rpi.sh create mode 100755 scripts/calibre-install-unstable.sh diff --git a/roles/calibre/defaults/main.yml b/roles/calibre/defaults/main.yml index 737072bde..8cafdb995 100644 --- a/roles/calibre/defaults/main.yml +++ b/roles/calibre/defaults/main.yml @@ -12,5 +12,7 @@ calibre_sample_book: "Metamorphosis-jackson.epub" calibre_src_url: "https://raw.githubusercontent.com/kovidgoyal/calibre/master/setup/linux-installer.py" -calibre_debs_on_debian: true # USE TO TEST debs.yml (RASPBIAN APPROACH!) ON DEBIAN 9.X +calibre_debs_on_debian: True +# enable calibre unstable +calibre_unstable: False diff --git a/roles/calibre/tasks/debs.yml b/roles/calibre/tasks/debs.yml index 02c9e1283..b2ca6be68 100644 --- a/roles/calibre/tasks/debs.yml +++ b/roles/calibre/tasks/debs.yml @@ -5,13 +5,16 @@ # April 5 2018 raspbian is now tracking the latest Calibre with a small delay. # Should you really want the latest just run the below script standalone, it is -# strongly suggested that waiting for the lastest deb from Rasbian is the best. +# strongly suggested that waiting for the lastest deb from Raspbian is the best. -- name: Upgrade latest Calibre +- name: Upgrade to testing Calibre - RPi + command: scripts/calibre-install-latest-rpi.sh + when: is_rpi + +- name: Upgrade to tesing Calibre - non-RPi command: scripts/calibre-install-latest.sh - #when: not is_rpi + when: not is_rpi -# Oops "when: not is_rpi" causes Calibre playbook to fail on Raspbian Lite (possibly -# other OS's too). Error msg is: "Unable to start service calibre-serve: Job for -# calibre-serve.service failed because the control process exited with error code." -# Running "calibre --version" then responds with "calibre (calibre 2.75.1)". +- name: Upgrade to unstable Calibre - all + command: scripts/calibre-install-unstable.sh + when: calibre_unstable diff --git a/scripts/calibre-install-latest-rpi.sh b/scripts/calibre-install-latest-rpi.sh new file mode 100755 index 000000000..8b7bc89c2 --- /dev/null +++ b/scripts/calibre-install-latest-rpi.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Thanks to Jerry Vonau (https://github.com/jvonau) who made +# this critical breakthrough (Calibre 3.x on Raspbian) possible! +# The latest available is 3.20 available from testing +# https://packages.debian.org/search?keywords=calibre +# (SEE http://archive.raspbian.org/raspbian/pool/main/c/calibre/ ?) +# might break future updates, you have been warned + +export DEBIAN_FRONTEND=noninteractive +# Updates calibre calibre-bin to version 3.20 or ... from testing +echo "deb http://raspbian.raspberrypi.org/raspbian/ testing main" > /etc/apt/sources.list.d/rpi-testing.list +apt update +apt -y install calibre calibre-bin +# Remove last line, safer than: rm /etc/apt/sources.list.d/debian-testing.list +sed -i '$ d' /etc/apt/sources.list.d/rpi-testing.list +# Clears the cache of testing +apt update diff --git a/scripts/calibre-install-latest.sh b/scripts/calibre-install-latest.sh index 77730fa4b..aebc86ca1 100755 --- a/scripts/calibre-install-latest.sh +++ b/scripts/calibre-install-latest.sh @@ -1,26 +1,20 @@ #!/bin/bash # Thanks to Jerry Vonau (https://github.com/jvonau) who made -# this critical breakthrough (Calibre 3.x on Raspbian) possible! +# this critical breakthrough for Calibre 3.x possible! +# The latest available is 3.20 available from testing +# https://packages.debian.org/search?keywords=calibre +# (SEE http://deb.debian.org/debian/pool/main/c/calibre/ ?) +# might break future updates, you have been warned export DEBIAN_FRONTEND=noninteractive # Drags in stock desktop dependencies without too much from testing below apt -y install calibre-bin dirmngr - -# Updates calibre-bin to version 3.10 or 3.14 or ... from testing (SEE http://archive.raspbian.org/raspbian/pool/main/c/calibre/ ?) +# Updates calibre calibre-bin to version 3.20 or ... from testing apt-key adv --recv-key --keyserver keyserver.ubuntu.com 7638D0442B90D010 echo "deb http://deb.debian.org/debian testing main" >> /etc/apt/sources.list.d/debian-testing.list apt update apt -y install libqt5core5a python-lxml calibre # Remove last line, safer than: rm /etc/apt/sources.list.d/debian-testing.list sed -i '$ d' /etc/apt/sources.list.d/debian-testing.list - -# Updates to calibre & calibre-bin to "very latest" 3.x from unstable -echo "deb http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list.d/debian-unstable.list -apt update -apt -y install calibre -# Remove last line, safer than: rm /etc/apt/sources.list.d/debian-unstable.list -sed -i '$ d' /etc/apt/sources.list.d/debian-unstable.list - -# Clears the cache of testing and unstable apt update diff --git a/scripts/calibre-install-unstable.sh b/scripts/calibre-install-unstable.sh new file mode 100755 index 000000000..c27bfebf5 --- /dev/null +++ b/scripts/calibre-install-unstable.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Thanks to Jerry Vonau (https://github.com/jvonau) who made +# this critical breakthrough possible! +# might break future updates, you have been warned +# The latest available is 3.20 available from testing +# https://packages.debian.org/search?keywords=calibre +# might break future updates, you have been warned + +export DEBIAN_FRONTEND=noninteractive +# Updates to calibre & calibre-bin to "very latest" 3.x from unstable +echo "deb http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list.d/unstable.list +apt update +apt -y install calibre calibre-bin +# Remove last line, safer than: rm /etc/apt/sources.list.d/debian-unstable.list +sed -i '$ d' /etc/apt/sources.list.d/unstable.list +# Clears the cache of testing and unstable +apt update From 01dee58596aa994a2b209277225bc6c02d8dc047 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 6 Apr 2018 22:43:44 -0500 Subject: [PATCH 04/14] Ubuntu 18.04 is going to ship Calibre 3.20, use debs --- roles/calibre/tasks/debs.yml | 4 ++-- roles/calibre/tasks/main.yml | 7 +++++-- vars/default_vars.yml | 1 + vars/ubuntu-18.yml | 1 + 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/roles/calibre/tasks/debs.yml b/roles/calibre/tasks/debs.yml index b2ca6be68..214b8a667 100644 --- a/roles/calibre/tasks/debs.yml +++ b/roles/calibre/tasks/debs.yml @@ -1,6 +1,6 @@ - name: Start by installing OS's Calibre package package: - name: calibre + name: calibre calibre-bin state: present # April 5 2018 raspbian is now tracking the latest Calibre with a small delay. @@ -13,7 +13,7 @@ - name: Upgrade to tesing Calibre - non-RPi command: scripts/calibre-install-latest.sh - when: not is_rpi + when: not is_rpi and not is_ubuntu_18 - name: Upgrade to unstable Calibre - all command: scripts/calibre-install-unstable.sh diff --git a/roles/calibre/tasks/main.yml b/roles/calibre/tasks/main.yml index 097e7b044..eb771e161 100644 --- a/roles/calibre/tasks/main.yml +++ b/roles/calibre/tasks/main.yml @@ -3,13 +3,16 @@ # RUNS IF /usr/bin/calibre-uninstall DOES NOT ALEADY EXIST - name: Install Calibre via calibre-installer.py (redhat, ubuntu, debian if NOT calibre_debs_on_debian) include_tasks: py-installer.yml - when: is_redhat or is_ubuntu or (is_debian and not calibre_debs_on_debian) + when: is_redhat or (is_ubuntu and not is_ubuntu_18) or (is_debian and not calibre_debs_on_debian) #when: not is_rpi - name: Install Calibre via .debs (Raspbian, Debian if calibre_debs_on_debian) include_tasks: debs.yml when: is_rpi or (is_debian and calibre_debs_on_debian) - #when: is_rpi or is_debian # (is_debian also covers & includes is_rpi) + +- name: Install Calibre via .debs (Ubuntu 18.xx) + include_tasks: debs.yml + when: is_ubuntu_18 - name: Create calibre-serve.service and calibre.conf template: diff --git a/vars/default_vars.yml b/vars/default_vars.yml index 669f61965..1632d1f80 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -383,6 +383,7 @@ xovis_chart_heading: "My School: Usage Data Visualization" # wide to narrow is_debuntu: False is_ubuntu: False +is_ubuntu_18: False is_debian: False is_debian_9: False is_debian_8: False diff --git a/vars/ubuntu-18.yml b/vars/ubuntu-18.yml index 41fd02c1d..02f4d2355 100644 --- a/vars/ubuntu-18.yml +++ b/vars/ubuntu-18.yml @@ -1,5 +1,6 @@ is_debuntu: True is_ubuntu: True +is_ubuntu_18: True dns_service: bind9 dns_user: bind dhcp_service: isc-dhcp-server From 0411cf27485a6f22009162ebc6a4b0e5b9807e9d Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Fri, 6 Apr 2018 23:14:13 -0500 Subject: [PATCH 05/14] would need with_items --- roles/calibre/tasks/debs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/calibre/tasks/debs.yml b/roles/calibre/tasks/debs.yml index 214b8a667..fd556029b 100644 --- a/roles/calibre/tasks/debs.yml +++ b/roles/calibre/tasks/debs.yml @@ -1,6 +1,6 @@ - name: Start by installing OS's Calibre package package: - name: calibre calibre-bin + name: calibre state: present # April 5 2018 raspbian is now tracking the latest Calibre with a small delay. From 785715c4129528e890ba65d8ab234ce19d85876c Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 7 Apr 2018 01:26:44 -0500 Subject: [PATCH 06/14] small typo --- roles/calibre/tasks/debs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/calibre/tasks/debs.yml b/roles/calibre/tasks/debs.yml index fd556029b..faa050a35 100644 --- a/roles/calibre/tasks/debs.yml +++ b/roles/calibre/tasks/debs.yml @@ -11,7 +11,7 @@ command: scripts/calibre-install-latest-rpi.sh when: is_rpi -- name: Upgrade to tesing Calibre - non-RPi +- name: Upgrade to testing Calibre - non-RPi command: scripts/calibre-install-latest.sh when: not is_rpi and not is_ubuntu_18 From e7872a2a9da875e47e29c4bb21771c12104cd68e Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 7 Apr 2018 11:50:13 -0500 Subject: [PATCH 07/14] fix enabling hostapd --- roles/network/tasks/hostapd.yml | 7 ++----- roles/network/tasks/rpi_debian.yml | 4 ---- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index f0c8e9fbe..dc4cee801 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -46,9 +46,6 @@ group: root mode: 0755 -- name: Enable/Restart the Access Point 'hostapd' service - service: - # enabled: yes - state: restarted - name: hostapd.service +- name: Ansible is having a problem enabling hostapd service + shell: systemctl enable hostapd when: hostapd_enabled and iiab_wireless_lan_iface is defined and iiab_network_mode != "Appliance" diff --git a/roles/network/tasks/rpi_debian.yml b/roles/network/tasks/rpi_debian.yml index be4ea571a..ec9b59143 100644 --- a/roles/network/tasks/rpi_debian.yml +++ b/roles/network/tasks/rpi_debian.yml @@ -67,10 +67,6 @@ state: restarted when: hostapd_enabled and iiab_wan_iface != discovered_wireless_iface and iiab_network_mode != "Appliance" -- name: Ansible is having a problem enabling services - shell: systemctl enable hostapd - 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" From 367164029ca42fe873d3dfac1174fe9c365bac95 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 7 Apr 2018 16:45:04 -0500 Subject: [PATCH 08/14] replace shell use of daemon_reload with systemd module, use systemd module in place of service for hostapd --- roles/network/tasks/NM-debian.yml | 17 +++-------------- roles/network/tasks/debian.yml | 11 ++--------- roles/network/tasks/hostapd.yml | 18 ++++++++++-------- roles/network/tasks/ifcfg_mods.yml | 8 +++++--- roles/network/tasks/restart.yml | 12 +++++++----- roles/network/tasks/rpi_debian.yml | 13 ++----------- roles/network/tasks/sysd-netd-debian.yml | 16 +++------------- 7 files changed, 32 insertions(+), 63 deletions(-) diff --git a/roles/network/tasks/NM-debian.yml b/roles/network/tasks/NM-debian.yml index a7ece265e..23ecc9dd2 100644 --- a/roles/network/tasks/NM-debian.yml +++ b/roles/network/tasks/NM-debian.yml @@ -29,22 +29,11 @@ when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance" - name: Reload systemd - shell: systemctl daemon-reload + systemd: + daemon_reload: yes - name: Restart the NetworkManager service - service: + systemd: name: network-manager state: restarted 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" diff --git a/roles/network/tasks/debian.yml b/roles/network/tasks/debian.yml index 69ae60cbd..e2103047d 100644 --- a/roles/network/tasks/debian.yml +++ b/roles/network/tasks/debian.yml @@ -58,7 +58,8 @@ when: dnsmasq_install - name: Reload systemd - shell: systemctl daemon-reload + systemd: + daemon_reload: yes # now pick up denyinterfaces - name: Restart dhcpcd @@ -68,11 +69,3 @@ - name: Restart the networking service service: name=networking state=restarted 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" diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index dc4cee801..2f9f71e5c 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -16,12 +16,6 @@ mode: 0644 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 template: src: hostapd/hostapd.service.j2 @@ -46,6 +40,14 @@ group: root mode: 0755 -- name: Ansible is having a problem enabling hostapd service - shell: systemctl enable hostapd +- name: Disable the Access Point 'hostapd' service + 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" diff --git a/roles/network/tasks/ifcfg_mods.yml b/roles/network/tasks/ifcfg_mods.yml index 2d8a4769f..b5a3f5f9c 100644 --- a/roles/network/tasks/ifcfg_mods.yml +++ b/roles/network/tasks/ifcfg_mods.yml @@ -1,6 +1,7 @@ - name: Stop the Access Point hostapd program - service: name=hostapd.service - state=stopped + systemd: + name: hostapd + state: stopped when: iiab_wireless_lan_iface != "none" # might need an exclude for F18 here @@ -81,7 +82,8 @@ when: not installing and not iiab_demo_mode - name: ask systemd to reread the unit files, picks up changes done - shell: systemctl daemon-reload + systemd: + daemon_reload: yes when: not installing # monitor-connection-files defaults to no with F21, F18-F20 defaults to yes diff --git a/roles/network/tasks/restart.yml b/roles/network/tasks/restart.yml index 98fc09114..30aa4b307 100644 --- a/roles/network/tasks/restart.yml +++ b/roles/network/tasks/restart.yml @@ -1,6 +1,8 @@ -#- name: restart hostapd when wifi is present -# service: name=hostapd state=started -# when: iiab_wireless_lan_iface is defined and hostapd_enabled +- name: restart hostapd when wifi is present + systemd: + name: hostapd + state: restarted + when: iiab_wireless_lan_iface is defined and hostapd_enabled and iiab_network_mode != "Appliance" - name: Start named service service: @@ -63,8 +65,8 @@ register: wifi_slave - name: Restart hostapd if WiFi slave is inactive - service: - name: hostapd.service + systemd: + name: hostapd state: restarted when: hostapd_enabled and wifi_slave.stdout is defined and wifi_slave.stdout == 0 diff --git a/roles/network/tasks/rpi_debian.yml b/roles/network/tasks/rpi_debian.yml index ec9b59143..406c70e07 100644 --- a/roles/network/tasks/rpi_debian.yml +++ b/roles/network/tasks/rpi_debian.yml @@ -46,7 +46,8 @@ include_tasks: down-debian.yml - name: Reload systemd - shell: systemctl daemon-reload + systemd: + daemon_reload: yes # now pick up denyinterfaces - name: Restart dhcpcd @@ -60,13 +61,3 @@ enabled: yes state: restarted 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" diff --git a/roles/network/tasks/sysd-netd-debian.yml b/roles/network/tasks/sysd-netd-debian.yml index 6e94c9c1f..08e09f1bc 100644 --- a/roles/network/tasks/sysd-netd-debian.yml +++ b/roles/network/tasks/sysd-netd-debian.yml @@ -19,22 +19,12 @@ include_tasks: down-debian.yml - name: Reload systemd - shell: systemctl daemon-reload + systemd: + daemon_reload: yes - name: Restart the systemd-networkd service - service: + systemd: name: systemd-networkd enabled: yes state: restarted 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" From 3c59be94388ec44c98f61bf8b1643378cfef055a Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 7 Apr 2018 18:04:12 -0500 Subject: [PATCH 09/14] calibre debs use latest, add internet_available --- roles/calibre/tasks/debs.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/roles/calibre/tasks/debs.yml b/roles/calibre/tasks/debs.yml index faa050a35..ad9917fce 100644 --- a/roles/calibre/tasks/debs.yml +++ b/roles/calibre/tasks/debs.yml @@ -1,7 +1,11 @@ - name: Start by installing OS's Calibre package package: - name: calibre - state: present + name: "{{ item }}" + state: latest + with_items: + - calibre + - calibre-bin + when: internet_available # April 5 2018 raspbian is now tracking the latest Calibre with a small delay. # Should you really want the latest just run the below script standalone, it is @@ -9,12 +13,12 @@ - name: Upgrade to testing Calibre - RPi command: scripts/calibre-install-latest-rpi.sh - when: is_rpi + when: is_rpi and internet_available - name: Upgrade to testing Calibre - non-RPi command: scripts/calibre-install-latest.sh - when: not is_rpi and not is_ubuntu_18 + when: not is_rpi and not is_ubuntu_18 and internet_available - name: Upgrade to unstable Calibre - all command: scripts/calibre-install-unstable.sh - when: calibre_unstable + when: calibre_unstable and internet_available From ceb4d7d901afaf57e706914ef903124b05130278 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 8 Apr 2018 19:22:57 -0500 Subject: [PATCH 10/14] hostapd - disable before enable Similar workarounds exist in named.yml and dhcpd.yml, just go with the flow --- roles/network/tasks/enable_services.yml | 6 ------ roles/network/tasks/hostapd.yml | 3 ++- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/roles/network/tasks/enable_services.yml b/roles/network/tasks/enable_services.yml index 243342c15..ee7b395d0 100644 --- a/roles/network/tasks/enable_services.yml +++ b/roles/network/tasks/enable_services.yml @@ -1,9 +1,3 @@ -- name: Disable the Access Point 'hostapd' service - service: enabled=no - name=hostapd.service - when: not iiab_wireless_lan_iface is defined or iiab_network_mode == "Appliance" -#or not hostapd_enabled - - name: Disable dhcpd service service: name=dhcpd enabled=no diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 2f9f71e5c..1b165f4ff 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -44,7 +44,8 @@ systemd: name: hostapd enabled: no - when: not hostapd_enabled +# cheap workaround for when /etc/init.d is populated +# when: not hostapd_enabled - name: Enable the Access Point 'hostapd' service systemd: From 5a0a37d064eb0e2cf76e788d5919d1f833e235be Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 8 Apr 2018 19:46:31 -0500 Subject: [PATCH 11/14] scripts only apply to the RPi --- roles/network/tasks/hostapd.yml | 9 +++++++++ roles/network/tasks/main.yml | 10 ---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index 1b165f4ff..f27e60470 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -31,6 +31,7 @@ owner: root group: root mode: 0755 + when: is_rpi - name: Create /usr/bin/iiab-hotspot-off from template template: @@ -39,6 +40,7 @@ owner: root group: root mode: 0755 + when: is_rpi - name: Disable the Access Point 'hostapd' service systemd: @@ -52,3 +54,10 @@ name: hostapd enabled: yes when: hostapd_enabled and iiab_wireless_lan_iface is defined and iiab_network_mode != "Appliance" + +- name: Record HOSTAPD_ENABLED to /etc/iiab/iiab.env + lineinfile: + dest: /etc/iiab/iiab.env + regexp: '^HOSTAPD_ENABLED=*' + line: 'HOSTAPD_ENABLED={{ hostapd_enabled }}' + state: present diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index cc595770b..2c36298a3 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -19,16 +19,6 @@ # be encapsulated into roles/network/tasks/hostapd.yml in future? Whereas # today "./runtags hostapd" doesn't exist & "./runtags AP" is UNSUPPORTED! -- name: Record HOSTAPD_ENABLED to /etc/iiab/iiab.env - lineinfile: - dest: /etc/iiab/iiab.env - regexp: '^HOSTAPD_ENABLED=*' - line: 'HOSTAPD_ENABLED={{ hostapd_enabled }}' - state: present - #when: not installing #REMOVE THIS LINE IF installing IS ALWAYS false AS SET IN roles/0-init/defaults/main.yml - tags: - - network - #- name: RPi - reboot to AP post install - installed via wifi so the services are ready # set_fact: # iiab_lan_iface: br0 From 50ad0de6be9ae68aedc260c0c47a75218cfaa297 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 8 Apr 2018 19:57:49 -0500 Subject: [PATCH 12/14] revise feedback --- iiab-network | 4 ++-- roles/network/tasks/main.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/iiab-network b/iiab-network index 65c77b55a..563ecace6 100755 --- a/iiab-network +++ b/iiab-network @@ -19,11 +19,11 @@ fi OS="unknown" # will be overridden below, if /etc/iiab/iiab.env is legit if [ -f /etc/iiab/iiab.env ]; then - echo "Running /etc/iiab/iiab.env" + echo "Reading /etc/iiab/iiab.env" source /etc/iiab/iiab.env fi -echo "Ansible will now run iiab-network.yml -- monitor log file iiab-network.log" +echo "Ansible will now run iiab-network.yml -- log file is iiab-network.log" Start=`date` ansible-playbook -i ansible_hosts iiab-network.yml --connection=local End=`date` diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index 2c36298a3..f1adc8d92 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -12,7 +12,7 @@ # (2) debian.yml, (3) rpi_debian.yml when: discovered_wireless_iface == iiab_wan_iface and not reboot_to_AP # EITHER WAY: hostapd_enabled's state is RECORDED into /etc/iiab/iiab.env -# (happens just below) for later use by... +# in hostapd.yml for later use by... # /usr/libexec/iiab-startup.sh, iiab-hotspot-off & iiab-hotspot-on # # Separate Idea, Not Without Risks: should WiFi-as-gateway detection logic From 739e96d7d817a7d477fd817277efeb3574e5637d Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 9 Apr 2018 13:25:22 -0500 Subject: [PATCH 13/14] See https://github.com/jvonau/iiab/issues/18 --- scripts/ansible | 1 + scripts/ansible-2.4.x | 1 + scripts/ansible-2.5.x | 1 + 3 files changed, 3 insertions(+) diff --git a/scripts/ansible b/scripts/ansible index 1d60fbdf5..e25b099a4 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -38,6 +38,7 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant # elif UBUNTU MUST REMAIN ABOVE (as Ubuntu ALSO contains /etc/debian_version, which would trigger the line just below) elif [ -f /etc/debian_version ] || (grep -qi raspbian /etc/*elease) ; then if ( ! grep -qi ansible /etc/apt/sources.list) && [ ! -f /etc/apt/sources.list.d/ansible ]; then + apt update apt -y install dirmngr python-pip python-setuptools python-wheel patch echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" \ >> /etc/apt/sources.list.d/iiab-ansible.list diff --git a/scripts/ansible-2.4.x b/scripts/ansible-2.4.x index 4e8e74595..b8d0844e1 100755 --- a/scripts/ansible-2.4.x +++ b/scripts/ansible-2.4.x @@ -39,6 +39,7 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant # elif UBUNTU MUST REMAIN ABOVE (as Ubuntu ALSO contains /etc/debian_version, which would trigger the line just below) elif [ -f /etc/debian_version ] || (grep -qi raspbian /etc/*elease) ; then if ( ! grep -qi ansible /etc/apt/sources.list) && [ ! -f /etc/apt/sources.list.d/ansible ]; then + apt update apt -y install dirmngr python-pip python-setuptools python-wheel patch #echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" \ # >> /etc/apt/sources.list.d/iiab-ansible.list diff --git a/scripts/ansible-2.5.x b/scripts/ansible-2.5.x index 38c31b64a..18708f73b 100755 --- a/scripts/ansible-2.5.x +++ b/scripts/ansible-2.5.x @@ -38,6 +38,7 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant # elif UBUNTU MUST REMAIN ABOVE (as Ubuntu ALSO contains /etc/debian_version, which would trigger the line just below) elif [ -f /etc/debian_version ] || (grep -qi raspbian /etc/*elease) ; then if ( ! grep -qi ansible /etc/apt/sources.list) && [ ! -f /etc/apt/sources.list.d/ansible ]; then + apt update apt -y install dirmngr python-pip python-setuptools python-wheel patch #echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" \ # >> /etc/apt/sources.list.d/iiab-ansible.list From cc80573c2f8caa3ac5244a10b60f2f6e90d6e622 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 9 Apr 2018 15:06:52 -0500 Subject: [PATCH 14/14] make grep shutup if not found --- scripts/ansible | 2 +- scripts/ansible-2.4.x | 2 +- scripts/ansible-2.5.x | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/ansible b/scripts/ansible index e25b099a4..52a27a25d 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -31,7 +31,7 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant pip install --upgrade pip setuptools wheel #EOL just do it pip install ansible==$GOOD_VER --disable-pip-version-check # Parens are optional, but greatly clarify :) - elif (grep -qi ubuntu /etc/lsb-release) || (grep -qi ubuntu /etc/os-release); then + elif (grep -qi ubuntu /etc/lsb-release 2> /dev/null) || (grep -qi ubuntu /etc/os-release); then apt -y install python-pip python-setuptools python-wheel patch apt-add-repository -y ppa:ansible/ansible #apt-add-repository -y ppa:ansible/ansible-2.4 diff --git a/scripts/ansible-2.4.x b/scripts/ansible-2.4.x index b8d0844e1..bebfd3f5b 100755 --- a/scripts/ansible-2.4.x +++ b/scripts/ansible-2.4.x @@ -32,7 +32,7 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant pip install --upgrade pip setuptools wheel #EOL just do it pip install ansible==$GOOD_VER --disable-pip-version-check # Parens are optional, but greatly clarify :) - elif (grep -qi ubuntu /etc/lsb-release) || (grep -qi ubuntu /etc/os-release); then + elif (grep -qi ubuntu /etc/lsb-release 2> /dev/null) || (grep -qi ubuntu /etc/os-release); then apt -y install python-pip python-setuptools python-wheel patch #apt-add-repository -y ppa:ansible/ansible apt-add-repository -y ppa:ansible/ansible-2.4 diff --git a/scripts/ansible-2.5.x b/scripts/ansible-2.5.x index 18708f73b..08a0741bb 100755 --- a/scripts/ansible-2.5.x +++ b/scripts/ansible-2.5.x @@ -31,7 +31,7 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant pip install --upgrade pip setuptools wheel #EOL just do it pip install ansible==$GOOD_VER --disable-pip-version-check # Parens are optional, but greatly clarify :) - elif (grep -qi ubuntu /etc/lsb-release) || (grep -qi ubuntu /etc/os-release); then + elif (grep -qi ubuntu /etc/lsb-release 2> /dev/null) || (grep -qi ubuntu /etc/os-release); then apt -y install python-pip python-setuptools python-wheel patch #apt-add-repository -y ppa:ansible/ansible apt-add-repository -y ppa:ansible/ansible-2.5