From b1f5a078b1db475fa3e7bcad31d1aaa22144b7e3 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Tue, 13 Mar 2018 15:06:12 -0400 Subject: [PATCH 01/52] mount root directory --- roles/1-prep/templates/iiab.env.j2 | 1 + roles/usb-lib/tasks/main.yml | 7 +++++-- roles/usb-lib/templates/iiab-usb-lib-show-all-off | 6 ++++++ roles/usb-lib/templates/iiab-usb-lib-show-all-on | 6 ++++++ roles/usb-lib/templates/mount.d/70-usb-library | 13 ++++++++++++- vars/default_vars.yml | 1 + vars/ubuntu-18.yml | 1 + 7 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 roles/usb-lib/templates/iiab-usb-lib-show-all-off create mode 100644 roles/usb-lib/templates/iiab-usb-lib-show-all-on diff --git a/roles/1-prep/templates/iiab.env.j2 b/roles/1-prep/templates/iiab.env.j2 index cca28cc1e..f2140acad 100644 --- a/roles/1-prep/templates/iiab.env.j2 +++ b/roles/1-prep/templates/iiab.env.j2 @@ -4,6 +4,7 @@ IIAB_BASE_PATH={{ iiab_base }} IIAB_DIR={{ iiab_dir }} IIAB_RELEASE={{ iiab_base_ver }} IIAB_REVISION={{ iiab_revision }} +IIAB_USB_LIB_SHOW_ALL={{ iiab_usb_lib_show_all }} OS={{ ansible_local.local_facts.os }} OS_VER={{ ansible_local.local_facts.os_ver }} WWWROOT={{ doc_root }} diff --git a/roles/usb-lib/tasks/main.yml b/roles/usb-lib/tasks/main.yml index 2781cd7ce..3e04526ed 100644 --- a/roles/usb-lib/tasks/main.yml +++ b/roles/usb-lib/tasks/main.yml @@ -19,9 +19,12 @@ template: src: "{{ item.src }}" dest: "{{ item.dest }}" + mode: "{{ item.mode }}" with_items: - - { src: 'usbmount@.service.j2' , dest: '/etc/systemd/system/usbmount@.service' } - - { src: 'usbmount.rules.j2' , dest: '/etc/udev/rules.d/usbmount.rules' } + - { src: 'usbmount@.service.j2' , dest: '/etc/systemd/system/usbmount@.service', mode: '0644' } + - { src: 'usbmount.rules.j2' , dest: '/etc/udev/rules.d/usbmount.rules', mode: '0644' } + - { src: 'iiab-usb-lib-show-all-on' , dest: '/usr/bin/', mode: '0755' } + - { src: 'iiab-usb-lib-show-all-off' , dest: '/usr/bin/', mode: '0755' } - name: Enable exfat and ntfs lineinfile: diff --git a/roles/usb-lib/templates/iiab-usb-lib-show-all-off b/roles/usb-lib/templates/iiab-usb-lib-show-all-off new file mode 100644 index 000000000..ad844db9b --- /dev/null +++ b/roles/usb-lib/templates/iiab-usb-lib-show-all-off @@ -0,0 +1,6 @@ +#!/bin/bash +# turn on the flag which registers new USB sticks at root directory + +sed -i -e's/^IIAB_USB_LIB_SHOW_ALL.*/IIAB_USB_LIB_SHOW_ALL=False/' /etc/iiab/iiab.env + +udevadm trigger -t subsystems -s usb -c add diff --git a/roles/usb-lib/templates/iiab-usb-lib-show-all-on b/roles/usb-lib/templates/iiab-usb-lib-show-all-on new file mode 100644 index 000000000..7eaaef7b7 --- /dev/null +++ b/roles/usb-lib/templates/iiab-usb-lib-show-all-on @@ -0,0 +1,6 @@ +#!/bin/bash +# turn on the flag which registers new USB sticks at root directory + +sed -i -e's/^IIAB_USB_LIB_SHOW_ALL.*/IIAB_USB_LIB_SHOW_ALL=True/' /etc/iiab/iiab.env + +udevadm trigger -t subsystems -s usb -c add diff --git a/roles/usb-lib/templates/mount.d/70-usb-library b/roles/usb-lib/templates/mount.d/70-usb-library index 7a6b74690..7add0d102 100644 --- a/roles/usb-lib/templates/mount.d/70-usb-library +++ b/roles/usb-lib/templates/mount.d/70-usb-library @@ -9,7 +9,15 @@ # # by Tim Moody tim@timmoody.com -logger -p user.notice -t "70-usb-library" -- "Looking for /share, /Share, /Piratebox/Share, /USB, or /usb on $UM_MOUNTPOINT." +source /etc/iiab/iiab.env +case $IIAB_USB_LIB_SHOW_ALL in +'True'|'true'|'TRUE') + logger -p user.notice -t "70-usb-library" -- "Displaying root directory on $UM_MOUNTPOINT." + ;; +*) + logger -p user.notice -t "70-usb-library" -- "Looking for /share, /Share, /Piratebox/Share, /USB, or /usb on $UM_MOUNTPOINT." + ;; +esac VERBOSE=yes @@ -31,6 +39,9 @@ fi if [ -d $UM_MOUNTPOINT/usb ]; then SHARE_DIR="$UM_MOUNTPOINT/usb" fi +if [ -d $UM_MOUNTPOINT ]; then + SHARE_DIR="$UM_MOUNTPOINT" +fi if [ ! -z "$SHARE_DIR" ]; then logger -p user.notice -t "70-usb-library" -- "Found Share Directory $SHARE_DIR." diff --git a/vars/default_vars.yml b/vars/default_vars.yml index 4bc5cb105..12ae7d5fe 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -206,6 +206,7 @@ samba_enabled: False # usb-lib usb_lib_install: True usb_lib_enabled: True +iiab_usb_lib_show_all: False # Toggle iiab-refresh-wiki-docs scraping for offline docs (http://box/info) nodocs: False diff --git a/vars/ubuntu-18.yml b/vars/ubuntu-18.yml index 41fd02c1d..4fee5b15f 100644 --- a/vars/ubuntu-18.yml +++ b/vars/ubuntu-18.yml @@ -19,3 +19,4 @@ sshd_service: ssh php_version: 7.1 postgresql_version: 9.6 systemd_location: /lib/systemd/system +iiab_usb_lib_show_all: True From ddfa291803ab008df559b46a338d9b20b4c7e45d Mon Sep 17 00:00:00 2001 From: George Hunt Date: Tue, 13 Mar 2018 17:11:46 -0400 Subject: [PATCH 02/52] do not shadow directory selection --- roles/usb-lib/templates/mount.d/70-usb-library | 4 +++- vars/ubuntu-18.yml | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/usb-lib/templates/mount.d/70-usb-library b/roles/usb-lib/templates/mount.d/70-usb-library index 7add0d102..02328339d 100644 --- a/roles/usb-lib/templates/mount.d/70-usb-library +++ b/roles/usb-lib/templates/mount.d/70-usb-library @@ -13,6 +13,8 @@ source /etc/iiab/iiab.env case $IIAB_USB_LIB_SHOW_ALL in 'True'|'true'|'TRUE') logger -p user.notice -t "70-usb-library" -- "Displaying root directory on $UM_MOUNTPOINT." + # regularize the variable + IIAB_USB_LIB_SHOW_ALL=True ;; *) logger -p user.notice -t "70-usb-library" -- "Looking for /share, /Share, /Piratebox/Share, /USB, or /usb on $UM_MOUNTPOINT." @@ -39,7 +41,7 @@ fi if [ -d $UM_MOUNTPOINT/usb ]; then SHARE_DIR="$UM_MOUNTPOINT/usb" fi -if [ -d $UM_MOUNTPOINT ]; then +if [ "$IIAB_USB_LIB_SHOW_ALL" == "True" ]; then SHARE_DIR="$UM_MOUNTPOINT" fi diff --git a/vars/ubuntu-18.yml b/vars/ubuntu-18.yml index 4fee5b15f..41fd02c1d 100644 --- a/vars/ubuntu-18.yml +++ b/vars/ubuntu-18.yml @@ -19,4 +19,3 @@ sshd_service: ssh php_version: 7.1 postgresql_version: 9.6 systemd_location: /lib/systemd/system -iiab_usb_lib_show_all: True From 62de11463d140c34dbc0b4029bfc23c0904a1f75 Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 23 Mar 2018 12:50:18 -0400 Subject: [PATCH 03/52] restore scripts/ansible now that Ansible 2.5.0 is released & smoke-tested --- scripts/ansible | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/ansible b/scripts/ansible index 4921cbed7..5dceae0fc 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -3,9 +3,9 @@ # Installs or upgrades to the best possible Ansible release, so iiab-install # can proceed. Ensure you're online before running this script! -GOOD_VER="2.4.2" # Ansible version for OLPC, for pip. +GOOD_VER="2.5.0" # Ansible version for OLPC, for pip. # On other OS's we install/upgrade to the latest Ansible. - # Pin all to 2.4.x in future, if really/truly nec? + # Pin all to 2.5.x in future, if really/truly nec? CURR_VER="undefined" # FOUND="false" # NOT USED AS OF 2017-12-12 # FAMILY="undefined" # NOT USED AS OF 2017-12-12 @@ -80,15 +80,15 @@ else fi if [ ! -f /etc/centos-release ] && [ ! -f /etc/fedora-release ] && [ ! -f /etc/olpc-release ]; then + # Align IIAB with Ansible community's latest + echo "Using apt to check for updates, then install/upgrade ansible" + apt update + apt -y install ansible # TEMPORARILY USE ANSIBLE 2.4.2 DUE TO 2.4.3 MEMORY BUG. DETAILS @ https://github.com/iiab/iiab/issues/669 - echo "Install http://download.iiab.io/packages/ansible_2.4.2.0-1ppa~xenial_all.deb" - cd /tmp - wget http://download.iiab.io/packages/ansible_2.4.2.0-1ppa~xenial_all.deb - apt -y --allow-downgrades install ./ansible_2.4.2.0-1ppa~xenial_all.deb - # UNCOMMENT THE FOLLOWING 3 LINES IF ANSIBLE'S LATEST RELEASES IMPROVE - #echo "Using apt to check for updates, then install/upgrade ansible" - #apt update - #apt -y install ansible + #echo "Install http://download.iiab.io/packages/ansible_2.4.2.0-1ppa~xenial_all.deb" + #cd /tmp + #wget http://download.iiab.io/packages/ansible_2.4.2.0-1ppa~xenial_all.deb + #apt -y --allow-downgrades install ./ansible_2.4.2.0-1ppa~xenial_all.deb fi # needed? From 8e71469b52ee60c059aa854a5ef9da9c4845455e Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 23 Mar 2018 12:52:23 -0400 Subject: [PATCH 04/52] Update ansible --- scripts/ansible | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ansible b/scripts/ansible index 5dceae0fc..a272fd393 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -80,10 +80,11 @@ else fi if [ ! -f /etc/centos-release ] && [ ! -f /etc/fedora-release ] && [ ! -f /etc/olpc-release ]; then - # Align IIAB with Ansible community's latest + # Align IIAB with Ansible community's latest official release echo "Using apt to check for updates, then install/upgrade ansible" apt update apt -y install ansible + # TEMPORARILY USE ANSIBLE 2.4.2 DUE TO 2.4.3 MEMORY BUG. DETAILS @ https://github.com/iiab/iiab/issues/669 #echo "Install http://download.iiab.io/packages/ansible_2.4.2.0-1ppa~xenial_all.deb" #cd /tmp From 473680db84a9662067ce17eeaad472057db2be09 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 24 Mar 2018 14:23:55 -0400 Subject: [PATCH 05/52] system_warnings = False -> True + deprecation_warnings = False -> True --- ansible.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible.cfg b/ansible.cfg index 3e0caabbd..ef800a2b2 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -96,12 +96,12 @@ ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} # system running ansible itself. This may include warnings about 3rd party packages or # other conditions that should be resolved if possible. # to disable these warnings, set the following value to False: -system_warnings = False +system_warnings = True # by default (as of 1.4), Ansible may display deprecation warnings for language # features that should no longer be used and will be removed in future versions. # to disable these warnings, set the following value to False: -deprecation_warnings = False +deprecation_warnings = True # set plugin path directories here, separate with colons action_plugins = /usr/share/ansible_plugins/action_plugins From e2b76f3daacce730f7fa81055d2578c6256e241f Mon Sep 17 00:00:00 2001 From: A Holt Date: Sat, 24 Mar 2018 15:48:43 -0400 Subject: [PATCH 06/52] Rename ansible.cfg to ansible.cfg.deprecated --- ansible.cfg => ansible.cfg.deprecated | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ansible.cfg => ansible.cfg.deprecated (100%) diff --git a/ansible.cfg b/ansible.cfg.deprecated similarity index 100% rename from ansible.cfg rename to ansible.cfg.deprecated From 64273207f05686ae1077d343ac3f4f38560a6352 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 26 Mar 2018 11:15:41 -0400 Subject: [PATCH 07/52] Proposed by @jvonau & @tim-moody --- ansible.cfg | 1 + 1 file changed, 1 insertion(+) create mode 100644 ansible.cfg diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1 @@ + From d1073baa7cd171f8fc9d20ec580af1cb8a62c464 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 26 Mar 2018 11:18:47 -0400 Subject: [PATCH 08/52] Update ansible.cfg --- ansible.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ansible.cfg b/ansible.cfg index 8b1378917..67ec53645 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1 +1,2 @@ - +# Place future overrides of /etc/ansible/ansible.cfg into this file. +# Used by /opt/iiab/iiab-admin-console From a3c4fa275c78ae4f3ed4f61f10263fdb478fb456 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 26 Mar 2018 11:19:28 -0400 Subject: [PATCH 09/52] Update ansible.cfg --- ansible.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible.cfg b/ansible.cfg index 67ec53645..ea753b6f8 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,2 +1,2 @@ -# Place future overrides of /etc/ansible/ansible.cfg into this file. -# Used by /opt/iiab/iiab-admin-console +# Future overrides of /etc/ansible/ansible.cfg belong in this file. +# Used by iiab-admin-console From 47824e2f0981c82d542c37988e0d15dc2d15b056 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 26 Mar 2018 15:37:41 -0400 Subject: [PATCH 10/52] Update ansible.cfg --- ansible.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible.cfg b/ansible.cfg index ea753b6f8..e716a4831 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,2 +1,2 @@ # Future overrides of /etc/ansible/ansible.cfg belong in this file. -# Used by iiab-admin-console +# Also used by iiab-admin-console From 5c074e59a4cf8c49187cb30631957af5ca8285e9 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Thu, 29 Mar 2018 17:57:24 +0000 Subject: [PATCH 11/52] put rpi in Gateway, enable hostapd --- roles/network/tasks/computed_network.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/roles/network/tasks/computed_network.yml b/roles/network/tasks/computed_network.yml index ee418a81c..62d64bd25 100644 --- a/roles/network/tasks/computed_network.yml +++ b/roles/network/tasks/computed_network.yml @@ -130,7 +130,18 @@ - name: LAN configured - 'Gateway' mode set_fact: iiab_network_mode: "Gateway" - when: iiab_lan_iface != "none" and iiab_wan_iface != "none" + when: (iiab_lan_iface != "none" and iiab_wan_iface != "none") or is_rpi + +- name: Force iiab_lan_iface if is_rpi + set_fact: + iiab_lan_iface: "br0" + iiab_wireless_lan_iface: "wlan0" + when: is_rpi + +- name: Enable hostapd if discovered_wireless_iface is not WAN + set_fact: + hostapd_enabled: True + when: is_rpi and iiab_wan_iface != discovered_wireless_iface # override with user_lan_iface setting if no longer in auto - name: Setting user LAN fact From 227b5f4c323608a88528cc72f8cbf579cad2e4ea Mon Sep 17 00:00:00 2001 From: George Hunt Date: Thu, 29 Mar 2018 20:39:20 +0000 Subject: [PATCH 12/52] wifi really is turned off by rfkill until wpa_supplicant has country= --- roles/network/defaults/main.yml | 2 +- roles/network/tasks/computed_network.yml | 20 ++++++++++++++++++++ roles/network/tasks/main.yml | 21 --------------------- roles/network/tasks/rpi_debian.yml | 20 +++++++++++++++++--- 4 files changed, 38 insertions(+), 25 deletions(-) diff --git a/roles/network/defaults/main.yml b/roles/network/defaults/main.yml index cc6862dee..a160a01dc 100644 --- a/roles/network/defaults/main.yml +++ b/roles/network/defaults/main.yml @@ -14,7 +14,7 @@ device_gw2: "" iiab_wan_iface: "none" iiab_lan_iface: "none" -#discovered_lan_iface: "none" +discovered_lan_iface: "none" discovered_wired_iface: "none" discovered_wireless_iface: "none" #iiab_wired_lan_iface: "none" diff --git a/roles/network/tasks/computed_network.yml b/roles/network/tasks/computed_network.yml index 62d64bd25..ace548616 100644 --- a/roles/network/tasks/computed_network.yml +++ b/roles/network/tasks/computed_network.yml @@ -167,6 +167,26 @@ iiab_wan_iface: "none" when: adapter_count.stdout|int >= "5" and device_gw == "none" and gui_wan_iface == "unset" and gui_static_wan is defined +- name: Record IIAB_WAN_DEVICE to /etc/iiab/iiab.env + lineinfile: + dest: /etc/iiab/iiab.env + regexp: '^IIAB_WAN_DEVICE=*' + line: 'IIAB_WAN_DEVICE="{{ iiab_wan_iface }}"' + 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: Record IIAB_LAN_DEVICE to /etc/iiab/iiab.env + lineinfile: + dest: /etc/iiab/iiab.env + regexp: '^IIAB_LAN_DEVICE=*' + line: 'IIAB_LAN_DEVICE="{{ iiab_lan_iface }}"' + 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: Add location section to config file ini_file: dest: "{{ iiab_config_file }}" diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index 1735dcc91..f26f83d5a 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -132,27 +132,6 @@ tags: - network -# this is moving -- name: Record IIAB_WAN_DEVICE to /etc/iiab/iiab.env - lineinfile: - dest: /etc/iiab/iiab.env - regexp: '^IIAB_WAN_DEVICE=*' - line: 'IIAB_WAN_DEVICE="{{ iiab_wan_iface }}"' - 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: Record IIAB_LAN_DEVICE to /etc/iiab/iiab.env - lineinfile: - dest: /etc/iiab/iiab.env - regexp: '^IIAB_LAN_DEVICE=*' - line: 'IIAB_LAN_DEVICE="{{ iiab_lan_iface }}"' - state: present - when: not installing #REMOVE THIS LINE IF installing IS ALWAYS false AS SET IN roles/0-init/defaults/main.yml - tags: - - network - #### end network layout - include_tasks: restart.yml when: not installing diff --git a/roles/network/tasks/rpi_debian.yml b/roles/network/tasks/rpi_debian.yml index 25390091b..478e4d24e 100644 --- a/roles/network/tasks/rpi_debian.yml +++ b/roles/network/tasks/rpi_debian.yml @@ -20,10 +20,21 @@ dest: /etc/dhcpcd.conf src: network/dhcpcd.conf.j2 +- name: New raspbian requires counry code -- check for it + shell: grep country /etc/wpa_supplicant/wpa_supplicant.conf + register: country_code + +- name: Put a country code if it does not exist + lineinfile: + dest: /etc/wpa_supplicant/wpa_supplicant.conf + regexp: "^country.*" + line: country={{ host_country_code }} + when: country_code.stdout == "" + - name: Copy the bridge script for RPi template: dest: /etc/network/interfaces.d/iiab - src: network/rpi.j2 + src: network/iiab.j2 when: iiab_lan_iface == "br0" - name: Stopping services @@ -48,9 +59,12 @@ - name: Restart hostapd if appropriate service: name: hostapd - enabled: yes state: restarted - when: hostapd_enabled and iiab_wireless_lan_iface is defined and iiab_network_mode != "Appliance" + when: hostapd_enabled and iiab_wan_iface != discoveed_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 != discoveed_wireless_iface and iiab_network_mode != "Appliance" #- name: dhcp_server may be affected - starting - user choice # service: name={{ dhcp_service2 }} state=started From 54066b9b0792fd1f4ecd65f3fe020302ce2ef280 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Fri, 30 Mar 2018 00:17:56 +0000 Subject: [PATCH 13/52] typo, and use rfkill to unblock wifi --- roles/network/tasks/rpi_debian.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/roles/network/tasks/rpi_debian.yml b/roles/network/tasks/rpi_debian.yml index 478e4d24e..be4ea571a 100644 --- a/roles/network/tasks/rpi_debian.yml +++ b/roles/network/tasks/rpi_debian.yml @@ -23,13 +23,18 @@ - name: New raspbian requires counry code -- check for it shell: grep country /etc/wpa_supplicant/wpa_supplicant.conf register: country_code + ignore_errors: True - name: Put a country code if it does not exist lineinfile: dest: /etc/wpa_supplicant/wpa_supplicant.conf regexp: "^country.*" line: country={{ host_country_code }} - when: country_code.stdout == "" + when: country_code is defined and country_code.stdout == "" + +- name: Enable the wifi with rfkill + shell: rfkill unblock 0 + ignore_errors: True - name: Copy the bridge script for RPi template: @@ -60,11 +65,11 @@ service: name: hostapd state: restarted - when: hostapd_enabled and iiab_wan_iface != discoveed_wireless_iface and iiab_network_mode != "Appliance" + 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 != discoveed_wireless_iface and iiab_network_mode != "Appliance" + 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 From dc3f1c8ce00ef4e06458fe56c758a679de41ee3d Mon Sep 17 00:00:00 2001 From: George Hunt Date: Fri, 30 Mar 2018 17:34:42 +0000 Subject: [PATCH 14/52] wrong python_path for centos --- roles/0-init/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/0-init/tasks/main.yml b/roles/0-init/tasks/main.yml index b66db2d5a..01d391d65 100644 --- a/roles/0-init/tasks/main.yml +++ b/roles/0-init/tasks/main.yml @@ -123,7 +123,7 @@ - name: Set python_path (redhat) set_fact: - python_path: /usr/lib/python2.7/site-packages/ + python_path: /lib/python2.7/site-packages/ when: is_redhat - name: Set python_path (debuntu) From 7ee2bd43b67afab6ad2c714b735e3774ffb9d5a9 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Fri, 30 Mar 2018 18:40:00 +0000 Subject: [PATCH 15/52] centos missing mod_authnz_external --- roles/httpd/tasks/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/httpd/tasks/main.yml b/roles/httpd/tasks/main.yml index 518840487..76979dd84 100644 --- a/roles/httpd/tasks/main.yml +++ b/roles/httpd/tasks/main.yml @@ -39,6 +39,7 @@ - httpd - php - php-curl + - mod_authnz_external # - php-sqlite tags: - download From e0eae4fe9bed8008cc0503adac5c5eb0d76c4b84 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Fri, 30 Mar 2018 13:10:35 -0700 Subject: [PATCH 16/52] variables required by redhat --- roles/network/defaults/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/network/defaults/main.yml b/roles/network/defaults/main.yml index a160a01dc..b4cee63a2 100644 --- a/roles/network/defaults/main.yml +++ b/roles/network/defaults/main.yml @@ -17,10 +17,10 @@ iiab_lan_iface: "none" discovered_lan_iface: "none" discovered_wired_iface: "none" discovered_wireless_iface: "none" -#iiab_wired_lan_iface: "none" -#iiab_wireless_lan_iface: "none" #Redhat +iiab_wired_lan_iface: "none" +iiab_wireless_lan_iface: "none" has_WAN: False has_ifcfg_gw: "none" has_wifi_gw: "none" From 82394328cf8e2893f0057b1e1e3e3340a640cbbc Mon Sep 17 00:00:00 2001 From: George Hunt Date: Fri, 30 Mar 2018 16:02:31 -0700 Subject: [PATCH 17/52] centos errors out if no ifcfg files to delete --- roles/network/tasks/ifcfg_mods.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/network/tasks/ifcfg_mods.yml b/roles/network/tasks/ifcfg_mods.yml index 760cdd4aa..2d8a4769f 100644 --- a/roles/network/tasks/ifcfg_mods.yml +++ b/roles/network/tasks/ifcfg_mods.yml @@ -14,6 +14,7 @@ # clear all bridge ifcfg files - name: Now delete slave bridge ifcfg files shell: rm -f /etc/sysconfig/network-scripts/ifcfg-"{{ item }}" + ignore_errors: True when: num_lan_interfaces != 0 or iiab_wireless_lan_iface != "none" with_items: - "{{ ifcfg_slaves.stdout_lines }}" From 9be8d527362125da05f1e7da6d13525e4f8c0297 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Sat, 31 Mar 2018 00:01:45 +0000 Subject: [PATCH 18/52] need systemd service for hostapd unconditionally --- roles/network/tasks/hostapd.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index e5d744d5e..f0c8e9fbe 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -29,7 +29,6 @@ owner: root group: root mode: 0644 - when: hostapd_enabled - name: Create /usr/bin/iiab-hotspot-on from template template: From 8ad271903f7158f55f366bce497d0e77fb201fe9 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Fri, 30 Mar 2018 20:44:39 -0700 Subject: [PATCH 19/52] move iiab_usb_lib_show_all from template to lineinfile --- roles/1-prep/templates/iiab.env.j2 | 1 - roles/usb-lib/tasks/main.yml | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/roles/1-prep/templates/iiab.env.j2 b/roles/1-prep/templates/iiab.env.j2 index f2140acad..cca28cc1e 100644 --- a/roles/1-prep/templates/iiab.env.j2 +++ b/roles/1-prep/templates/iiab.env.j2 @@ -4,7 +4,6 @@ IIAB_BASE_PATH={{ iiab_base }} IIAB_DIR={{ iiab_dir }} IIAB_RELEASE={{ iiab_base_ver }} IIAB_REVISION={{ iiab_revision }} -IIAB_USB_LIB_SHOW_ALL={{ iiab_usb_lib_show_all }} OS={{ ansible_local.local_facts.os }} OS_VER={{ ansible_local.local_facts.os_ver }} WWWROOT={{ doc_root }} diff --git a/roles/usb-lib/tasks/main.yml b/roles/usb-lib/tasks/main.yml index 3e04526ed..209068a1e 100644 --- a/roles/usb-lib/tasks/main.yml +++ b/roles/usb-lib/tasks/main.yml @@ -53,6 +53,12 @@ state: absent when: not usb_lib_enabled +- name: Put a variable in iiab.env for display of content at root of USB + lineinfile: + file: /etc/iiab/iiab.env + regexp: "^IIAB_USB_LIB_SHOW_ALL.*" + line: "IIAB_USB_LIB_SHOW_ALL={{ iiab_usb_lib_show_all }}" + - name: Add Apache config for content directory template: src: content_dir.conf From 6a65ca85cfcd997fdcb4ce9948f474fa450a3dde Mon Sep 17 00:00:00 2001 From: George Hunt Date: Sat, 31 Mar 2018 04:02:18 +0000 Subject: [PATCH 20/52] lineinfile requires file->dest --- roles/usb-lib/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/usb-lib/tasks/main.yml b/roles/usb-lib/tasks/main.yml index 209068a1e..1f312b188 100644 --- a/roles/usb-lib/tasks/main.yml +++ b/roles/usb-lib/tasks/main.yml @@ -55,7 +55,7 @@ - name: Put a variable in iiab.env for display of content at root of USB lineinfile: - file: /etc/iiab/iiab.env + dest: /etc/iiab/iiab.env regexp: "^IIAB_USB_LIB_SHOW_ALL.*" line: "IIAB_USB_LIB_SHOW_ALL={{ iiab_usb_lib_show_all }}" From 24b99e31fdacda2c06961f7b0a848adb0fc1316b Mon Sep 17 00:00:00 2001 From: A Holt Date: Tue, 3 Apr 2018 14:28:12 -0400 Subject: [PATCH 21/52] Update ansible.cfg --- ansible.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible.cfg b/ansible.cfg index ecf501ac5..c2d5c5593 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,2 +1,2 @@ # Future overrides of /etc/ansible/ansible.cfg belong in this file. -# Also used by https://github.com/iiab/iiab-admin-console \ No newline at end of file +# Also used by https://github.com/iiab/iiab-admin-console From c7e611b755ee19b412fcd3292c343328d90c9533 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 02:32:43 -0400 Subject: [PATCH 22/52] pin Ansible to 2.4.x for now (e.g. "pip install ansible==2.4.4.0" on OLPC) --- scripts/ansible | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ansible b/scripts/ansible index a272fd393..21a81d49f 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -3,7 +3,7 @@ # Installs or upgrades to the best possible Ansible release, so iiab-install # can proceed. Ensure you're online before running this script! -GOOD_VER="2.5.0" # Ansible version for OLPC, for pip. +GOOD_VER="2.4.4" # Ansible version for OLPC, for pip. # On other OS's we install/upgrade to the latest Ansible. # Pin all to 2.5.x in future, if really/truly nec? CURR_VER="undefined" @@ -41,7 +41,7 @@ if ! which ansible-playbook ; then 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 -y install dirmngr python-pip python-setuptools python-wheel patch - echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" \ + echo "deb http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial main" \ >> /etc/apt/sources.list.d/ansible.list apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 fi From a87d41d2bc0f317ed90db1276257671a4825b2ff Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 02:57:11 -0400 Subject: [PATCH 23/52] let's not restrict PPA repo to Ansible 2.4.x if poss? --- scripts/ansible | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/ansible b/scripts/ansible index 21a81d49f..c278a9a80 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -41,7 +41,8 @@ if ! which ansible-playbook ; then 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 -y install dirmngr python-pip python-setuptools python-wheel patch - echo "deb http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial main" \ + # echo "deb http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial main" \ + echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" \ >> /etc/apt/sources.list.d/ansible.list apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 fi @@ -50,6 +51,7 @@ if ! which ansible-playbook ; then # Parens are optional, but greatly clarify :) elif (grep -qi ubuntu /etc/lsb-release) || (grep -qi ubuntu /etc/os-release); then apt -y install python-pip python-setuptools python-wheel patch + # apt-add-repository -y ppa:ansible/ansible-2.4 apt-add-repository -y ppa:ansible/ansible # FOUND="true" # FAMILY="debian" @@ -83,7 +85,7 @@ if [ ! -f /etc/centos-release ] && [ ! -f /etc/fedora-release ] && [ ! -f /etc/o # Align IIAB with Ansible community's latest official release echo "Using apt to check for updates, then install/upgrade ansible" apt update - apt -y install ansible + apt -y install ansible=2.4* # TEMPORARILY USE ANSIBLE 2.4.2 DUE TO 2.4.3 MEMORY BUG. DETAILS @ https://github.com/iiab/iiab/issues/669 #echo "Install http://download.iiab.io/packages/ansible_2.4.2.0-1ppa~xenial_all.deb" From d62c51c041ae67ace7d1f7bc85829fd9595b8ed0 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 03:06:24 -0400 Subject: [PATCH 24/52] add BOTH PPA repos (for Ansible 2.4.x & latest) to /etc/apt/* --- scripts/ansible | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/ansible b/scripts/ansible index c278a9a80..6932b6a03 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -20,7 +20,7 @@ if ! which ansible-playbook ; then yum -y install ca-certificates nss epel-release yum -y install git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python yum -y install python-pip python-setuptools python-wheel patch - yum -y install http://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.4.2.0-1.el7.ans.noarch.rpm + yum -y install http://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.4.4.0-1.el7.ans.noarch.rpm # FOUND="true" # FAMILY="redhat" # elif [ -f /etc/fedora-release ]; then @@ -41,9 +41,10 @@ if ! which ansible-playbook ; then 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 -y install dirmngr python-pip python-setuptools python-wheel patch - # echo "deb http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial main" \ echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" \ >> /etc/apt/sources.list.d/ansible.list + echo "deb http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial main" \ + >> /etc/apt/sources.list.d/ansible.list apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 fi # FOUND="true" @@ -51,8 +52,8 @@ if ! which ansible-playbook ; then # Parens are optional, but greatly clarify :) elif (grep -qi ubuntu /etc/lsb-release) || (grep -qi ubuntu /etc/os-release); then apt -y install python-pip python-setuptools python-wheel patch - # apt-add-repository -y ppa:ansible/ansible-2.4 apt-add-repository -y ppa:ansible/ansible + apt-add-repository -y ppa:ansible/ansible-2.4 # FOUND="true" # FAMILY="debian" # fi From 1684fd90e19711d2580f70ccad060276586c1f2a Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 03:28:52 -0400 Subject: [PATCH 25/52] safer test for existence of command (ansible-playbook) --- scripts/ansible | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/ansible b/scripts/ansible index 6932b6a03..3b08ace9b 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -3,9 +3,9 @@ # Installs or upgrades to the best possible Ansible release, so iiab-install # can proceed. Ensure you're online before running this script! -GOOD_VER="2.4.4" # Ansible version for OLPC, for pip. - # On other OS's we install/upgrade to the latest Ansible. - # Pin all to 2.5.x in future, if really/truly nec? +GOOD_VER="2.4.4" # Ansible version pip install onto OLPC XO laptops. + # On other OS's we install/upgrade to the latest Ansible 2.4.x + # Pins to 2.5.x in the near-future, for IIAB 6.6? CURR_VER="undefined" # FOUND="false" # NOT USED AS OF 2017-12-12 # FAMILY="undefined" # NOT USED AS OF 2017-12-12 @@ -14,7 +14,8 @@ CURR_VER="undefined" export DEBIAN_FRONTEND=noninteractive -if ! which ansible-playbook ; then +# if ! which ansible-playbook ; then +if [[ ! `command -v ansible-playbook` ]]; then echo "Installing --- Please Wait" if [ -f /etc/centos-release ]; then yum -y install ca-certificates nss epel-release From 49382001adb2db051323e261751a79c181c32914 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 03:29:16 -0400 Subject: [PATCH 26/52] Update ansible --- scripts/ansible | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ansible b/scripts/ansible index 3b08ace9b..b063f8688 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -5,7 +5,7 @@ GOOD_VER="2.4.4" # Ansible version pip install onto OLPC XO laptops. # On other OS's we install/upgrade to the latest Ansible 2.4.x - # Pins to 2.5.x in the near-future, for IIAB 6.6? + # Pin to 2.5.x in the near-future, for IIAB 6.6? CURR_VER="undefined" # FOUND="false" # NOT USED AS OF 2017-12-12 # FAMILY="undefined" # NOT USED AS OF 2017-12-12 From 7741f4a6510ecfd2329fea564535558d9718f7ab Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 03:30:02 -0400 Subject: [PATCH 27/52] Update ansible --- scripts/ansible | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ansible b/scripts/ansible index b063f8688..0870ab101 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -5,7 +5,7 @@ GOOD_VER="2.4.4" # Ansible version pip install onto OLPC XO laptops. # On other OS's we install/upgrade to the latest Ansible 2.4.x - # Pin to 2.5.x in the near-future, for IIAB 6.6? + # (Pin to 2.5.x in the near-future, for IIAB 6.6?) CURR_VER="undefined" # FOUND="false" # NOT USED AS OF 2017-12-12 # FAMILY="undefined" # NOT USED AS OF 2017-12-12 From be73c0f78921b7fdc245ced24cea3c3ab4340f1c Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 03:53:03 -0400 Subject: [PATCH 28/52] Add repo for ansible-2.4 alone (avoids upgrades to 2.5.x upon "apt update" etc) --- scripts/ansible | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/ansible b/scripts/ansible index 0870ab101..bd25e8ef5 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -42,8 +42,8 @@ if [[ ! `command -v ansible-playbook` ]]; then 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 -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/ansible.list + #echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" \ + # >> /etc/apt/sources.list.d/ansible.list echo "deb http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial main" \ >> /etc/apt/sources.list.d/ansible.list apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 @@ -53,7 +53,7 @@ if [[ ! `command -v ansible-playbook` ]]; then # Parens are optional, but greatly clarify :) elif (grep -qi ubuntu /etc/lsb-release) || (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 apt-add-repository -y ppa:ansible/ansible-2.4 # FOUND="true" # FAMILY="debian" From 5fa3cfd118e7680bf9638517a8db3adb67aada54 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 03:54:49 -0400 Subject: [PATCH 29/52] Update ansible --- scripts/ansible | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ansible b/scripts/ansible index bd25e8ef5..f98c83892 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -3,7 +3,7 @@ # Installs or upgrades to the best possible Ansible release, so iiab-install # can proceed. Ensure you're online before running this script! -GOOD_VER="2.4.4" # Ansible version pip install onto OLPC XO laptops. +GOOD_VER="2.4.4" # Ansible version to pip install onto OLPC XO laptops. # On other OS's we install/upgrade to the latest Ansible 2.4.x # (Pin to 2.5.x in the near-future, for IIAB 6.6?) CURR_VER="undefined" From 82a24a1ccbc5929c097f975b2708752afecc48cb Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 04:08:06 -0400 Subject: [PATCH 30/52] Update ansible --- scripts/ansible | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/ansible b/scripts/ansible index f98c83892..67ed43c1b 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -4,8 +4,9 @@ # can proceed. Ensure you're online before running this script! GOOD_VER="2.4.4" # Ansible version to pip install onto OLPC XO laptops. - # On other OS's we install/upgrade to the latest Ansible 2.4.x - # (Pin to 2.5.x in the near-future, for IIAB 6.6?) + # On other OS's we install/upgrade/pin to the latest Ansible 2.4.x + # (Whereas for the upcoming IIAB 6.6, we'll likely + # recommend the very latest Ansible 2.5.x or higher) CURR_VER="undefined" # FOUND="false" # NOT USED AS OF 2017-12-12 # FAMILY="undefined" # NOT USED AS OF 2017-12-12 @@ -15,7 +16,7 @@ CURR_VER="undefined" export DEBIAN_FRONTEND=noninteractive # if ! which ansible-playbook ; then -if [[ ! `command -v ansible-playbook` ]]; then +if [ ! `command -v ansible-playbook` ]; then echo "Installing --- Please Wait" if [ -f /etc/centos-release ]; then yum -y install ca-certificates nss epel-release From 42b13eb5136e58a13f6257ecc4d74b380d722273 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 04:35:10 -0400 Subject: [PATCH 31/52] generate LOUDER warning if /etc/apt/sources.list* already exist(s) (for folk wanting to revert from 2.5.x to 2.4.x) --- scripts/ansible | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ansible b/scripts/ansible index 67ed43c1b..791214027 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -77,7 +77,8 @@ else #fi #if [[ `grep -qi ansible /etc/apt/sources.list` ]] || [ -f /etc/apt/sources.list.d/ansible*.list ]; then elif (grep -qi ansible /etc/apt/sources.list) || (ls /etc/apt/sources.list.d/ansible*.list >/dev/null 2>&1) ; then - echo "Ansible repo(s) found within /etc/apt/sources.list*" + #echo "Ansible repo(s) found within /etc/apt/sources.list*" + echo -e '\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/ansible*.list -- YOU LIKELY WANT LINE "deb http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial main" -- AND REMOVE ALL SIMILAR LINES, IF YOU WANT TO LOCK IN/PIN TO ANSIBLE 2.4.x\n' else echo "Upstream ansible source repo not found, please uninstall ansible and re-run this script" exit 1 From 9cb6c40a6bd730b1575110ab0a087c10c8d709a2 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 04:36:31 -0400 Subject: [PATCH 32/52] Rename ansible to ansible-2.4.x --- scripts/{ansible => ansible-2.4.x} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{ansible => ansible-2.4.x} (100%) diff --git a/scripts/ansible b/scripts/ansible-2.4.x similarity index 100% rename from scripts/ansible rename to scripts/ansible-2.4.x From e09deecec87a192ae202ff66d3396285bc3fdbe9 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 04:48:56 -0400 Subject: [PATCH 33/52] Update ansible-2.4.x --- scripts/ansible-2.4.x | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/ansible-2.4.x b/scripts/ansible-2.4.x index 791214027..f75b6e097 100755 --- a/scripts/ansible-2.4.x +++ b/scripts/ansible-2.4.x @@ -90,7 +90,10 @@ if [ ! -f /etc/centos-release ] && [ ! -f /etc/fedora-release ] && [ ! -f /etc/o echo "Using apt to check for updates, then install/upgrade ansible" apt update apt -y install ansible=2.4* - + + # TEMPORARILY USE ANSIBLE 2.4.4 (REMOVE IT WITH "pip uninstall ansible") + #pip install ansible==2.4.4 + # TEMPORARILY USE ANSIBLE 2.4.2 DUE TO 2.4.3 MEMORY BUG. DETAILS @ https://github.com/iiab/iiab/issues/669 #echo "Install http://download.iiab.io/packages/ansible_2.4.2.0-1ppa~xenial_all.deb" #cd /tmp From f9640cb82dbb558a3ee47052b4ff42c8a318cd9b Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 05:29:16 -0400 Subject: [PATCH 34/52] Update ansible-2.4.x --- scripts/ansible-2.4.x | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/ansible-2.4.x b/scripts/ansible-2.4.x index f75b6e097..b0ed4726a 100755 --- a/scripts/ansible-2.4.x +++ b/scripts/ansible-2.4.x @@ -1,12 +1,12 @@ #!/bin/bash -e -# Installs or upgrades to the best possible Ansible release, so iiab-install -# can proceed. Ensure you're online before running this script! +echo -e '\nATTEMPTING TO INSTALL THE LATEST ANSIBLE 2.4.x' +echo -e 'Ensure you'"'"'re online before running this script!' +echo -e 'OR: consider scripts/ansible to keep up-to-date with Ansible'"'"'s evolution.\n' -GOOD_VER="2.4.4" # Ansible version to pip install onto OLPC XO laptops. - # On other OS's we install/upgrade/pin to the latest Ansible 2.4.x - # (Whereas for the upcoming IIAB 6.6, we'll likely - # recommend the very latest Ansible 2.5.x or higher) +GOOD_VER="2.4.4" # Ansible version for OLPC XO laptops (pip install). + # On other OS's we attempt to install/upgrade/pin to the latest Ansible 2.4.x + # WARNING: IIAB 6.6 will likely recommend the very latest Ansible 2.5.x or higher. CURR_VER="undefined" # FOUND="false" # NOT USED AS OF 2017-12-12 # FAMILY="undefined" # NOT USED AS OF 2017-12-12 From 005d7db1d46da7abefad63b74faef0308ec4ab55 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 05:29:52 -0400 Subject: [PATCH 35/52] Create ansible --- scripts/ansible | 108 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 scripts/ansible diff --git a/scripts/ansible b/scripts/ansible new file mode 100644 index 000000000..64ba25fa5 --- /dev/null +++ b/scripts/ansible @@ -0,0 +1,108 @@ +#!/bin/bash -e + +echo -e '\nATTEMPTING TO INSTALL THE LATEST (RELEASED VERSION OF) ANSIBLE.' +echo -e 'Ensure you'"'"'re online before running this script!' +echo -e 'OR: consider scripts/ansible-2.4.x for a "slow food" alternative.\n' + +# Installs or upgrades to the best possible Ansible release, so iiab-install +# can proceed. Ensure you're online before running this script! + +GOOD_VER="2.5.0" # Ansible version for OLPC XO laptops (pip install). + # On other OS's we install/upgrade to THE latest (released version of) Ansible. +CURR_VER="undefined" +# FOUND="false" # NOT USED AS OF 2017-12-12 +# FAMILY="undefined" # NOT USED AS OF 2017-12-12 +# below are unused for future use +# URL="NA" + +export DEBIAN_FRONTEND=noninteractive + +# if ! which ansible-playbook ; then +if [ ! `command -v ansible-playbook` ]; then + echo "Installing --- Please Wait" + if [ -f /etc/centos-release ]; then + yum -y install ca-certificates nss epel-release + yum -y install git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python + yum -y install python-pip python-setuptools python-wheel patch + yum -y install http://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.4.4.0-1.el7.ans.noarch.rpm + # FOUND="true" + # FAMILY="redhat" +# elif [ -f /etc/fedora-release ]; then +# CURR_VER=`grep VERSION_ID /etc/*elease | cut -d= -f2` +# URL=https://github.com/jvonau/iiab/blob/ansible/vars/fedora-$CURR_VER.yml +# dnf -y install ansible git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python +# dnf -y install python-pip python-setuptools python-wheel patch +# FOUND="true" +# FAMILY="redhat" + elif [ -f /etc/olpc-release ]; then + yum -y install ca-certificates nss + yum -y install git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python + yum -y install python-pip python-setuptools python-wheel patch + pip install --upgrade pip setuptools wheel #EOL just do it + pip install ansible==$GOOD_VER --disable-pip-version-check + # FOUND="true" + # FAMILY="olpc" + 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 -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/ansible.list + #echo "deb http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial main" \ + # >> /etc/apt/sources.list.d/ansible.list + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 + fi + # FOUND="true" + # FAMILY="debian" + # Parens are optional, but greatly clarify :) + elif (grep -qi ubuntu /etc/lsb-release) || (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 + # FOUND="true" + # FAMILY="debian" + # fi + # if [ ! $FOUND = "true" ]; then + else + echo "WARN: Could not detect distro or distro unsupported" + exit 1 + fi +else + #CURR_VER=`ansible --version | head -n 1 | cut -f 2 -d " "` + CURR_VER=`ansible --version | head -1 | awk '{print $2}'` # to match iiab-install + echo "Current ansible version installed is $CURR_VER" + if [ -f /etc/centos-release ] || [ -f /etc/fedora-release ]; then + echo "Please use your system's package manager to update ansible" + exit 0 + elif [ -f /etc/olpc-release ]; then + echo "Please use pip package manager to update ansible" + exit 0 + #fi + #if [[ `grep -qi ansible /etc/apt/sources.list` ]] || [ -f /etc/apt/sources.list.d/ansible*.list ]; then + elif (grep -qi ansible /etc/apt/sources.list) || (ls /etc/apt/sources.list.d/ansible*.list >/dev/null 2>&1) ; then + #echo "Ansible repo(s) found within /etc/apt/sources.list*" + echo -e '\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/ansible*.list -- YOU LIKELY WANT LINE "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" FOR THE LATEST RELEASED VERSION OF ANSIBLE\n' + else + echo "Upstream ansible source repo not found, please uninstall ansible and re-run this script" + exit 1 + fi +fi + +if [ ! -f /etc/centos-release ] && [ ! -f /etc/fedora-release ] && [ ! -f /etc/olpc-release ]; then + # Align IIAB with Ansible community's latest official release + echo "Using apt to check for updates, then install/upgrade ansible" + apt update + apt -y install ansible + + # TEMPORARILY USE ANSIBLE 2.4.4 (REMOVE IT WITH "pip uninstall ansible") + #pip install ansible==2.4.4 + + # TEMPORARILY USE ANSIBLE 2.4.2 DUE TO 2.4.3 MEMORY BUG. DETAILS @ https://github.com/iiab/iiab/issues/669 + #echo "Install http://download.iiab.io/packages/ansible_2.4.2.0-1ppa~xenial_all.deb" + #cd /tmp + #wget http://download.iiab.io/packages/ansible_2.4.2.0-1ppa~xenial_all.deb + #apt -y --allow-downgrades install ./ansible_2.4.2.0-1ppa~xenial_all.deb +fi + +# needed? +mkdir -p /etc/ansible/ +echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts From b57fffaa69a74c0831edf4d04af9642675d69943 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 05:33:35 -0400 Subject: [PATCH 36/52] Update ansible --- scripts/ansible | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/ansible b/scripts/ansible index 64ba25fa5..382e41fb5 100644 --- a/scripts/ansible +++ b/scripts/ansible @@ -4,9 +4,6 @@ echo -e '\nATTEMPTING TO INSTALL THE LATEST (RELEASED VERSION OF) ANSIBLE.' echo -e 'Ensure you'"'"'re online before running this script!' echo -e 'OR: consider scripts/ansible-2.4.x for a "slow food" alternative.\n' -# Installs or upgrades to the best possible Ansible release, so iiab-install -# can proceed. Ensure you're online before running this script! - GOOD_VER="2.5.0" # Ansible version for OLPC XO laptops (pip install). # On other OS's we install/upgrade to THE latest (released version of) Ansible. CURR_VER="undefined" From b5ddfbb89c90c57c27defb9a4578cd73a493d506 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 05:36:25 -0400 Subject: [PATCH 37/52] Update ansible-2.4.x --- scripts/ansible-2.4.x | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/ansible-2.4.x b/scripts/ansible-2.4.x index b0ed4726a..3158412f0 100755 --- a/scripts/ansible-2.4.x +++ b/scripts/ansible-2.4.x @@ -15,8 +15,7 @@ CURR_VER="undefined" export DEBIAN_FRONTEND=noninteractive -# if ! which ansible-playbook ; then -if [ ! `command -v ansible-playbook` ]; then +if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant; also catches built-in commands like "cd" echo "Installing --- Please Wait" if [ -f /etc/centos-release ]; then yum -y install ca-certificates nss epel-release From 94227e702a26fa24c63df63d34010cb18ac58938 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 05:36:29 -0400 Subject: [PATCH 38/52] Update ansible --- scripts/ansible | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/ansible b/scripts/ansible index 382e41fb5..2ca329168 100644 --- a/scripts/ansible +++ b/scripts/ansible @@ -14,8 +14,7 @@ CURR_VER="undefined" export DEBIAN_FRONTEND=noninteractive -# if ! which ansible-playbook ; then -if [ ! `command -v ansible-playbook` ]; then +if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant; also catches built-in commands like "cd" echo "Installing --- Please Wait" if [ -f /etc/centos-release ]; then yum -y install ca-certificates nss epel-release From a78e10403f3bc35822fe7abb8bd34d82892e443c Mon Sep 17 00:00:00 2001 From: root Date: Thu, 5 Apr 2018 05:41:38 -0400 Subject: [PATCH 39/52] scripts/ansible 644 -> 755 --- scripts/ansible | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/ansible diff --git a/scripts/ansible b/scripts/ansible old mode 100644 new mode 100755 From 71ab0953c9ea690615e1e3f38a3e55c3c9825cce Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 05:45:38 -0400 Subject: [PATCH 40/52] Update ansible --- scripts/ansible | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ansible b/scripts/ansible index 2ca329168..0dbd98591 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -20,7 +20,7 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant yum -y install ca-certificates nss epel-release yum -y install git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python yum -y install python-pip python-setuptools python-wheel patch - yum -y install http://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.4.4.0-1.el7.ans.noarch.rpm + yum -y install http://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.5.0-1.el7.ans.noarch.rpm # FOUND="true" # FAMILY="redhat" # elif [ -f /etc/fedora-release ]; then From 8d68e206520d2594fc7bbdbd37f8934bd3fac84c Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 05:57:13 -0400 Subject: [PATCH 41/52] Update ansible-2.4.x --- scripts/ansible-2.4.x | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ansible-2.4.x b/scripts/ansible-2.4.x index 3158412f0..d2b733bfa 100755 --- a/scripts/ansible-2.4.x +++ b/scripts/ansible-2.4.x @@ -77,7 +77,7 @@ else #if [[ `grep -qi ansible /etc/apt/sources.list` ]] || [ -f /etc/apt/sources.list.d/ansible*.list ]; then elif (grep -qi ansible /etc/apt/sources.list) || (ls /etc/apt/sources.list.d/ansible*.list >/dev/null 2>&1) ; then #echo "Ansible repo(s) found within /etc/apt/sources.list*" - echo -e '\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/ansible*.list -- YOU LIKELY WANT LINE "deb http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial main" -- AND REMOVE ALL SIMILAR LINES, IF YOU WANT TO LOCK IN/PIN TO ANSIBLE 2.4.x\n' + echo -e '\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/ansible*.list -- MUST CONTAIN LINE "deb http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial main" IF YOU WANT THE LATEST ANSIBLE 2.4.x -- AND REMOVE ALL SIMILAR LINES -- then re-run this script\n' else echo "Upstream ansible source repo not found, please uninstall ansible and re-run this script" exit 1 From e5e5969955832471fe7e29b4cb64e67bc4171492 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 05:57:46 -0400 Subject: [PATCH 42/52] Update ansible --- scripts/ansible | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ansible b/scripts/ansible index 0dbd98591..f26d5457d 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -76,7 +76,7 @@ else #if [[ `grep -qi ansible /etc/apt/sources.list` ]] || [ -f /etc/apt/sources.list.d/ansible*.list ]; then elif (grep -qi ansible /etc/apt/sources.list) || (ls /etc/apt/sources.list.d/ansible*.list >/dev/null 2>&1) ; then #echo "Ansible repo(s) found within /etc/apt/sources.list*" - echo -e '\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/ansible*.list -- YOU LIKELY WANT LINE "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" FOR THE LATEST RELEASED VERSION OF ANSIBLE\n' + echo -e '\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/ansible*.list -- MUST CONTAIN LINE "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" IF YOU WANT THE LATEST RELEASED VERSION OF ANSIBLE -- then re-run this script.\n' else echo "Upstream ansible source repo not found, please uninstall ansible and re-run this script" exit 1 From 5c8b89583716a674b10d09f37e0757d7d0ed9a9b Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 05:58:16 -0400 Subject: [PATCH 43/52] Update ansible-2.4.x --- scripts/ansible-2.4.x | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ansible-2.4.x b/scripts/ansible-2.4.x index d2b733bfa..a45f0d9c2 100755 --- a/scripts/ansible-2.4.x +++ b/scripts/ansible-2.4.x @@ -77,7 +77,7 @@ else #if [[ `grep -qi ansible /etc/apt/sources.list` ]] || [ -f /etc/apt/sources.list.d/ansible*.list ]; then elif (grep -qi ansible /etc/apt/sources.list) || (ls /etc/apt/sources.list.d/ansible*.list >/dev/null 2>&1) ; then #echo "Ansible repo(s) found within /etc/apt/sources.list*" - echo -e '\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/ansible*.list -- MUST CONTAIN LINE "deb http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial main" IF YOU WANT THE LATEST ANSIBLE 2.4.x -- AND REMOVE ALL SIMILAR LINES -- then re-run this script\n' + echo -e '\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/ansible*.list -- MUST CONTAIN LINE "deb http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial main" IF YOU WANT THE LATEST ANSIBLE 2.4.x -- AND REMOVE ALL SIMILAR LINES -- then re-run this script.\n' else echo "Upstream ansible source repo not found, please uninstall ansible and re-run this script" exit 1 From fa43e258167c183bfb6505e548b6be129ec6a539 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 06:32:12 -0400 Subject: [PATCH 44/52] --allow-downgrades --- scripts/ansible-2.4.x | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ansible-2.4.x b/scripts/ansible-2.4.x index a45f0d9c2..b1e7acea4 100755 --- a/scripts/ansible-2.4.x +++ b/scripts/ansible-2.4.x @@ -88,7 +88,7 @@ if [ ! -f /etc/centos-release ] && [ ! -f /etc/fedora-release ] && [ ! -f /etc/o # Align IIAB with Ansible community's latest official release echo "Using apt to check for updates, then install/upgrade ansible" apt update - apt -y install ansible=2.4* + apt -y --allow-downgrades install ansible=2.4* # TEMPORARILY USE ANSIBLE 2.4.4 (REMOVE IT WITH "pip uninstall ansible") #pip install ansible==2.4.4 From 66e85e88280aa9ce1150a9b69d5baa9128c9f1c5 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 5 Apr 2018 06:44:00 -0400 Subject: [PATCH 45/52] Added scripts/ansible-2.5.x (based off scripts/ansible-2.4.x) --- scripts/ansible-2.5.x | 104 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100755 scripts/ansible-2.5.x diff --git a/scripts/ansible-2.5.x b/scripts/ansible-2.5.x new file mode 100755 index 000000000..da6fbbe34 --- /dev/null +++ b/scripts/ansible-2.5.x @@ -0,0 +1,104 @@ +#!/bin/bash -e + +echo -e '\nATTEMPTING TO INSTALL THE LATEST ANSIBLE 2.5.x' +echo -e 'Ensure you'"'"'re online before running this script!' +echo -e 'OR: consider scripts/ansible to keep up-to-date with Ansible'"'"'s evolution.\n' + +GOOD_VER="2.5.0" # Ansible version for OLPC XO laptops (pip install). + # On other OS's we attempt to install/upgrade/pin to the latest Ansible 2.5.x +CURR_VER="undefined" +# FOUND="false" # NOT USED AS OF 2017-12-12 +# FAMILY="undefined" # NOT USED AS OF 2017-12-12 +# below are unused for future use +# URL="NA" + +export DEBIAN_FRONTEND=noninteractive + +if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant; also catches built-in commands like "cd" + echo "Installing --- Please Wait" + if [ -f /etc/centos-release ]; then + yum -y install ca-certificates nss epel-release + yum -y install git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python + yum -y install python-pip python-setuptools python-wheel patch + yum -y install http://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.5.0-1.el7.ans.noarch.rpm + # FOUND="true" + # FAMILY="redhat" +# elif [ -f /etc/fedora-release ]; then +# CURR_VER=`grep VERSION_ID /etc/*elease | cut -d= -f2` +# URL=https://github.com/jvonau/iiab/blob/ansible/vars/fedora-$CURR_VER.yml +# dnf -y install ansible git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python +# dnf -y install python-pip python-setuptools python-wheel patch +# FOUND="true" +# FAMILY="redhat" + elif [ -f /etc/olpc-release ]; then + yum -y install ca-certificates nss + yum -y install git bzip2 file findutils gzip hg svn sudo tar which unzip xz zip libselinux-python + yum -y install python-pip python-setuptools python-wheel patch + pip install --upgrade pip setuptools wheel #EOL just do it + pip install ansible==$GOOD_VER --disable-pip-version-check + # FOUND="true" + # FAMILY="olpc" + 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 -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/ansible.list + echo "deb http://ppa.launchpad.net/ansible/ansible-2.5/ubuntu xenial main" \ + >> /etc/apt/sources.list.d/ansible.list + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 + fi + # FOUND="true" + # FAMILY="debian" + # Parens are optional, but greatly clarify :) + elif (grep -qi ubuntu /etc/lsb-release) || (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 + # FOUND="true" + # FAMILY="debian" + # fi + # if [ ! $FOUND = "true" ]; then + else + echo "WARN: Could not detect distro or distro unsupported" + exit 1 + fi +else + #CURR_VER=`ansible --version | head -n 1 | cut -f 2 -d " "` + CURR_VER=`ansible --version | head -1 | awk '{print $2}'` # to match iiab-install + echo "Current ansible version installed is $CURR_VER" + if [ -f /etc/centos-release ] || [ -f /etc/fedora-release ]; then + echo "Please use your system's package manager to update ansible" + exit 0 + elif [ -f /etc/olpc-release ]; then + echo "Please use pip package manager to update ansible" + exit 0 + #fi + #if [[ `grep -qi ansible /etc/apt/sources.list` ]] || [ -f /etc/apt/sources.list.d/ansible*.list ]; then + elif (grep -qi ansible /etc/apt/sources.list) || (ls /etc/apt/sources.list.d/ansible*.list >/dev/null 2>&1) ; then + #echo "Ansible repo(s) found within /etc/apt/sources.list*" + echo -e '\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/ansible*.list -- MUST CONTAIN LINE "deb http://ppa.launchpad.net/ansible/ansible-2.5/ubuntu xenial main" IF YOU WANT THE LATEST ANSIBLE 2.5.x -- AND REMOVE ALL SIMILAR LINES -- then re-run this script.\n' + else + echo "Upstream ansible source repo not found, please uninstall ansible and re-run this script" + exit 1 + fi +fi + +if [ ! -f /etc/centos-release ] && [ ! -f /etc/fedora-release ] && [ ! -f /etc/olpc-release ]; then + # Align IIAB with Ansible community's latest official release + echo "Using apt to check for updates, then install/upgrade ansible" + apt update + apt -y --allow-downgrades install ansible=2.5* + + # TEMPORARILY USE ANSIBLE 2.4.4 (REMOVE IT WITH "pip uninstall ansible") + #pip install ansible==2.4.4 + + # TEMPORARILY USE ANSIBLE 2.4.2 DUE TO 2.4.3 MEMORY BUG. DETAILS @ https://github.com/iiab/iiab/issues/669 + #echo "Install http://download.iiab.io/packages/ansible_2.4.2.0-1ppa~xenial_all.deb" + #cd /tmp + #wget http://download.iiab.io/packages/ansible_2.4.2.0-1ppa~xenial_all.deb + #apt -y --allow-downgrades install ./ansible_2.4.2.0-1ppa~xenial_all.deb +fi + +# needed? +mkdir -p /etc/ansible/ +echo -e '[local]\nlocalhost\n' > /etc/ansible/hosts From 71d4f15d3eb2809b151abf822b0c3bb06ef227bd Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 5 Apr 2018 08:46:35 -0500 Subject: [PATCH 46/52] use stock OS provided deb on RPI's --- roles/calibre/tasks/debs.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/roles/calibre/tasks/debs.yml b/roles/calibre/tasks/debs.yml index 64c6504a2..03d77ae32 100644 --- a/roles/calibre/tasks/debs.yml +++ b/roles/calibre/tasks/debs.yml @@ -3,5 +3,10 @@ name: calibre state: present +# 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. + - name: Upgrade latest Calibre command: scripts/calibre-install-latest.sh + when: not is_rpi From 76a17f6f8cebfb1401cb19627029d6baba021d54 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 11:47:55 -0400 Subject: [PATCH 47/52] change from /etc/apt/sources.list.d/ansible.list to iiab-ansible.list for Debian & Raspbian --- scripts/ansible | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/ansible b/scripts/ansible index f26d5457d..4c4039831 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -42,9 +42,9 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant if ( ! grep -qi ansible /etc/apt/sources.list) && [ ! -f /etc/apt/sources.list.d/ansible ]; then 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/ansible.list + >> /etc/apt/sources.list.d/iiab-ansible.list #echo "deb http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial main" \ - # >> /etc/apt/sources.list.d/ansible.list + # >> /etc/apt/sources.list.d/iiab-ansible.list apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 fi # FOUND="true" @@ -74,7 +74,7 @@ else exit 0 #fi #if [[ `grep -qi ansible /etc/apt/sources.list` ]] || [ -f /etc/apt/sources.list.d/ansible*.list ]; then - elif (grep -qi ansible /etc/apt/sources.list) || (ls /etc/apt/sources.list.d/ansible*.list >/dev/null 2>&1) ; then + elif (grep -qi ansible /etc/apt/sources.list) || (ls /etc/apt/sources.list.d/*ansible*.list >/dev/null 2>&1) ; then #echo "Ansible repo(s) found within /etc/apt/sources.list*" echo -e '\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/ansible*.list -- MUST CONTAIN LINE "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" IF YOU WANT THE LATEST RELEASED VERSION OF ANSIBLE -- then re-run this script.\n' else From 77e0820e57312d2f4ca612b6b75a1e9f4b8cf30f Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 11:49:19 -0400 Subject: [PATCH 48/52] change from /etc/apt/sources.list.d/ansible.list to iiab-ansible.list for Debian & Raspbian --- scripts/ansible-2.4.x | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/ansible-2.4.x b/scripts/ansible-2.4.x index b1e7acea4..14067a861 100755 --- a/scripts/ansible-2.4.x +++ b/scripts/ansible-2.4.x @@ -43,9 +43,9 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant if ( ! grep -qi ansible /etc/apt/sources.list) && [ ! -f /etc/apt/sources.list.d/ansible ]; then 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/ansible.list + # >> /etc/apt/sources.list.d/iiab-ansible.list echo "deb http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial main" \ - >> /etc/apt/sources.list.d/ansible.list + >> /etc/apt/sources.list.d/iiab-ansible.list apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 fi # FOUND="true" @@ -75,7 +75,7 @@ else exit 0 #fi #if [[ `grep -qi ansible /etc/apt/sources.list` ]] || [ -f /etc/apt/sources.list.d/ansible*.list ]; then - elif (grep -qi ansible /etc/apt/sources.list) || (ls /etc/apt/sources.list.d/ansible*.list >/dev/null 2>&1) ; then + elif (grep -qi ansible /etc/apt/sources.list) || (ls /etc/apt/sources.list.d/*ansible*.list >/dev/null 2>&1) ; then #echo "Ansible repo(s) found within /etc/apt/sources.list*" echo -e '\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/ansible*.list -- MUST CONTAIN LINE "deb http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial main" IF YOU WANT THE LATEST ANSIBLE 2.4.x -- AND REMOVE ALL SIMILAR LINES -- then re-run this script.\n' else From ba7167e637eca09d788959bc26b175a472fe236a Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 11:50:03 -0400 Subject: [PATCH 49/52] change from /etc/apt/sources.list.d/ansible.list to iiab-ansible.list for Debian & Raspbian --- scripts/ansible-2.5.x | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/ansible-2.5.x b/scripts/ansible-2.5.x index da6fbbe34..23c85f097 100755 --- a/scripts/ansible-2.5.x +++ b/scripts/ansible-2.5.x @@ -42,9 +42,9 @@ if [ ! `command -v ansible-playbook` ]; then # "command -v" is POSIX compliant if ( ! grep -qi ansible /etc/apt/sources.list) && [ ! -f /etc/apt/sources.list.d/ansible ]; then 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/ansible.list + # >> /etc/apt/sources.list.d/iiab-ansible.list echo "deb http://ppa.launchpad.net/ansible/ansible-2.5/ubuntu xenial main" \ - >> /etc/apt/sources.list.d/ansible.list + >> /etc/apt/sources.list.d/iiab-ansible.list apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 fi # FOUND="true" @@ -74,9 +74,9 @@ else exit 0 #fi #if [[ `grep -qi ansible /etc/apt/sources.list` ]] || [ -f /etc/apt/sources.list.d/ansible*.list ]; then - elif (grep -qi ansible /etc/apt/sources.list) || (ls /etc/apt/sources.list.d/ansible*.list >/dev/null 2>&1) ; then + elif (grep -qi ansible /etc/apt/sources.list) || (ls /etc/apt/sources.list.d/*ansible*.list >/dev/null 2>&1) ; then #echo "Ansible repo(s) found within /etc/apt/sources.list*" - echo -e '\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/ansible*.list -- MUST CONTAIN LINE "deb http://ppa.launchpad.net/ansible/ansible-2.5/ubuntu xenial main" IF YOU WANT THE LATEST ANSIBLE 2.5.x -- AND REMOVE ALL SIMILAR LINES -- then re-run this script.\n' + echo -e '\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/*ansible*.list -- MUST CONTAIN LINE "deb http://ppa.launchpad.net/ansible/ansible-2.5/ubuntu xenial main" IF YOU WANT THE LATEST ANSIBLE 2.5.x -- AND REMOVE ALL SIMILAR LINES -- then re-run this script.\n' else echo "Upstream ansible source repo not found, please uninstall ansible and re-run this script" exit 1 From beda349937970f181d2f3733bf890255f3fae470 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 11:50:30 -0400 Subject: [PATCH 50/52] Update ansible-2.4.x --- scripts/ansible-2.4.x | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ansible-2.4.x b/scripts/ansible-2.4.x index 14067a861..a74c84811 100755 --- a/scripts/ansible-2.4.x +++ b/scripts/ansible-2.4.x @@ -77,7 +77,7 @@ else #if [[ `grep -qi ansible /etc/apt/sources.list` ]] || [ -f /etc/apt/sources.list.d/ansible*.list ]; then elif (grep -qi ansible /etc/apt/sources.list) || (ls /etc/apt/sources.list.d/*ansible*.list >/dev/null 2>&1) ; then #echo "Ansible repo(s) found within /etc/apt/sources.list*" - echo -e '\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/ansible*.list -- MUST CONTAIN LINE "deb http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial main" IF YOU WANT THE LATEST ANSIBLE 2.4.x -- AND REMOVE ALL SIMILAR LINES -- then re-run this script.\n' + echo -e '\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/*ansible*.list -- MUST CONTAIN LINE "deb http://ppa.launchpad.net/ansible/ansible-2.4/ubuntu xenial main" IF YOU WANT THE LATEST ANSIBLE 2.4.x -- AND REMOVE ALL SIMILAR LINES -- then re-run this script.\n' else echo "Upstream ansible source repo not found, please uninstall ansible and re-run this script" exit 1 From 4f49e8f436aba3f23545fb5a04cfdd01c267da14 Mon Sep 17 00:00:00 2001 From: A Holt Date: Thu, 5 Apr 2018 11:50:57 -0400 Subject: [PATCH 51/52] Update ansible --- scripts/ansible | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ansible b/scripts/ansible index 4c4039831..8ca758331 100755 --- a/scripts/ansible +++ b/scripts/ansible @@ -76,7 +76,7 @@ else #if [[ `grep -qi ansible /etc/apt/sources.list` ]] || [ -f /etc/apt/sources.list.d/ansible*.list ]; then elif (grep -qi ansible /etc/apt/sources.list) || (ls /etc/apt/sources.list.d/*ansible*.list >/dev/null 2>&1) ; then #echo "Ansible repo(s) found within /etc/apt/sources.list*" - echo -e '\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/ansible*.list -- MUST CONTAIN LINE "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" IF YOU WANT THE LATEST RELEASED VERSION OF ANSIBLE -- then re-run this script.\n' + echo -e '\nANSIBLE REPO(S) FOUND WITHIN /etc/apt/sources.list AND/OR /etc/apt/sources.list.d/*ansible*.list -- MUST CONTAIN LINE "deb http://ppa.launchpad.net/ansible/ansible/ubuntu xenial main" IF YOU WANT THE LATEST RELEASED VERSION OF ANSIBLE -- then re-run this script.\n' else echo "Upstream ansible source repo not found, please uninstall ansible and re-run this script" exit 1 From 170dc0d84338407d2377132f88daf1754559604c Mon Sep 17 00:00:00 2001 From: George Hunt Date: Thu, 5 Apr 2018 16:17:26 +0000 Subject: [PATCH 52/52] remove udevadm --- roles/usb-lib/templates/iiab-usb-lib-show-all-off | 1 - roles/usb-lib/templates/iiab-usb-lib-show-all-on | 1 - 2 files changed, 2 deletions(-) diff --git a/roles/usb-lib/templates/iiab-usb-lib-show-all-off b/roles/usb-lib/templates/iiab-usb-lib-show-all-off index ad844db9b..adeff4c81 100644 --- a/roles/usb-lib/templates/iiab-usb-lib-show-all-off +++ b/roles/usb-lib/templates/iiab-usb-lib-show-all-off @@ -3,4 +3,3 @@ sed -i -e's/^IIAB_USB_LIB_SHOW_ALL.*/IIAB_USB_LIB_SHOW_ALL=False/' /etc/iiab/iiab.env -udevadm trigger -t subsystems -s usb -c add diff --git a/roles/usb-lib/templates/iiab-usb-lib-show-all-on b/roles/usb-lib/templates/iiab-usb-lib-show-all-on index 7eaaef7b7..297f37025 100644 --- a/roles/usb-lib/templates/iiab-usb-lib-show-all-on +++ b/roles/usb-lib/templates/iiab-usb-lib-show-all-on @@ -3,4 +3,3 @@ sed -i -e's/^IIAB_USB_LIB_SHOW_ALL.*/IIAB_USB_LIB_SHOW_ALL=True/' /etc/iiab/iiab.env -udevadm trigger -t subsystems -s usb -c add