From b973906dc38857b99b80daa126890a6d90b16e93 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 15 Oct 2018 06:41:58 -0400 Subject: [PATCH] iiab_env_file -> {{ iiab_env_file }} or "{{ iiab_env_file }}" --- roles/0-init/defaults/main.yml | 2 +- roles/1-prep/templates/iiab_env.py.j2 | 2 +- roles/2-common/templates/iiab-startup.sh | 2 +- roles/httpd/templates/refresh-wiki-docs.sh | 2 +- roles/kiwix/templates/iiab-make-kiwix-lib.py | 2 +- roles/network/tasks/computed_network.yml | 8 ++++---- roles/network/tasks/detected_network.yml | 2 +- roles/network/tasks/enable_services.yml | 4 ++-- roles/network/tasks/hostapd.yml | 4 ++-- roles/network/tasks/main.yml | 2 +- roles/network/templates/gateway/iiab-gen-iptables | 2 +- roles/network/templates/network/iiab-hotspot-off | 2 +- roles/network/templates/network/iiab-hotspot-on | 2 +- roles/openvpn/templates/announcer.j2 | 2 +- roles/usb-lib/tasks/main.yml | 2 +- roles/usb-lib/templates/iiab-usb-lib-show-all-off | 2 +- roles/usb-lib/templates/iiab-usb-lib-show-all-on | 2 +- roles/usb-lib/templates/mount.d/70-usb-library | 2 +- 18 files changed, 23 insertions(+), 23 deletions(-) diff --git a/roles/0-init/defaults/main.yml b/roles/0-init/defaults/main.yml index 8901ff7eb..ccdfd58e0 100644 --- a/roles/0-init/defaults/main.yml +++ b/roles/0-init/defaults/main.yml @@ -1,4 +1,4 @@ -# Use these to tag a release at a point in time, for /etc/iiab/iiab.env +# Use these to tag a release at a point in time, for {{ iiab_env_file }} iiab_base_ver: 6.7 iiab_revision: 0 diff --git a/roles/1-prep/templates/iiab_env.py.j2 b/roles/1-prep/templates/iiab_env.py.j2 index e3484e08e..78c4869be 100644 --- a/roles/1-prep/templates/iiab_env.py.j2 +++ b/roles/1-prep/templates/iiab_env.py.j2 @@ -4,7 +4,7 @@ def get_iiab_env(name): """ read iiab.env file for a value, return "" if does not exist""" try: - fd = open("/etc/iiab/iiab.env","r") + fd = open("{{ iiab_env_file }}","r") for line in fd: line = line.lstrip() line = line.rstrip('\n') diff --git a/roles/2-common/templates/iiab-startup.sh b/roles/2-common/templates/iiab-startup.sh index b2bfeb397..b563b908d 100644 --- a/roles/2-common/templates/iiab-startup.sh +++ b/roles/2-common/templates/iiab-startup.sh @@ -15,7 +15,7 @@ fi if [[ $(grep -i raspbian /etc/*release) && #($(grep "hostapd_enabled = False" /etc/iiab/config_vars.yml) || #((! $(grep "hostapd_enabled = True" /etc/iiab/config_vars.yml)) && - ! $(grep "^HOSTAPD_ENABLED=True" /etc/iiab/iiab.env) ]]; + ! $(grep "^HOSTAPD_ENABLED=True" {{ iiab_env_file }}) ]]; # NEGATED LOGIC HELPS FORCE PROMISCUOUS MODE EARLY IN INSTALL # (when network/tasks/main.yml hasn't yet populated iiab.env) diff --git a/roles/httpd/templates/refresh-wiki-docs.sh b/roles/httpd/templates/refresh-wiki-docs.sh index f1124c714..1d6bb20b8 100755 --- a/roles/httpd/templates/refresh-wiki-docs.sh +++ b/roles/httpd/templates/refresh-wiki-docs.sh @@ -3,7 +3,7 @@ # Pull down repo's entire wiki (and similar) to create offline docs set -e -source /etc/iiab/iiab.env +source {{ iiab_env_file }} INPUT=/tmp/iiab-wiki OUTPUT=/tmp/iiab-wiki.out DESTPATH=/library/www/html/info diff --git a/roles/kiwix/templates/iiab-make-kiwix-lib.py b/roles/kiwix/templates/iiab-make-kiwix-lib.py index 1efa285a8..d5cbd97c4 100644 --- a/roles/kiwix/templates/iiab-make-kiwix-lib.py +++ b/roles/kiwix/templates/iiab-make-kiwix-lib.py @@ -29,7 +29,7 @@ if not IIAB_PATH in sys.path: from iiab_env import get_iiab_env # Config Files -# iiab_ini_file should be in /etc/iiab/iiab.env +# iiab_ini_file should be in {{ iiab_env_file }} iiab_ini_file = "{{ iiab_ini_file }}" # nominally /etc/iiab/iiab.ini # iiab_ini_file = "/etc/iiab/iiab.ini" # comment out after testing diff --git a/roles/network/tasks/computed_network.yml b/roles/network/tasks/computed_network.yml index 34a7fc32e..fb0108847 100644 --- a/roles/network/tasks/computed_network.yml +++ b/roles/network/tasks/computed_network.yml @@ -172,9 +172,9 @@ 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 +- name: Record IIAB_WAN_DEVICE to {{ iiab_env_file }} lineinfile: - dest: /etc/iiab/iiab.env + dest: "{{ iiab_env_file }}" regexp: '^IIAB_WAN_DEVICE=*' line: 'IIAB_WAN_DEVICE="{{ iiab_wan_iface }}"' state: present @@ -182,9 +182,9 @@ tags: - network -- name: Record IIAB_LAN_DEVICE to /etc/iiab/iiab.env +- name: Record IIAB_LAN_DEVICE to {{ iiab_env_file }} lineinfile: - dest: /etc/iiab/iiab.env + dest: "{{ iiab_env_file }}" regexp: '^IIAB_LAN_DEVICE=*' line: 'IIAB_LAN_DEVICE="{{ iiab_lan_iface }}"' state: present diff --git a/roles/network/tasks/detected_network.yml b/roles/network/tasks/detected_network.yml index b2f1fc588..cb58deef0 100644 --- a/roles/network/tasks/detected_network.yml +++ b/roles/network/tasks/detected_network.yml @@ -1,5 +1,5 @@ - name: iiab_wan_device - shell: grep IIAB_WAN_DEVICE /etc/iiab/iiab.env | awk -F "=" '{print $2}' + shell: grep IIAB_WAN_DEVICE {{ iiab_env_file }} | awk -F "=" '{print $2}' when: iiab_stage|int > 4 register: prior_gw diff --git a/roles/network/tasks/enable_services.yml b/roles/network/tasks/enable_services.yml index 703356c5e..e59c388f4 100644 --- a/roles/network/tasks/enable_services.yml +++ b/roles/network/tasks/enable_services.yml @@ -79,7 +79,7 @@ - name: Create xs_httpcache flag lineinfile: - dest: /etc/iiab/iiab.env + dest: "{{ iiab_env_file }}" regexp: '^HTTPCACHE_ON=*' line: 'HTTPCACHE_ON=True' state: present @@ -121,7 +121,7 @@ - name: Remove xs_httpcache flag lineinfile: - dest: /etc/iiab/iiab.env + dest: "{{ iiab_env_file }}" regexp: '^HTTPCACHE_ON=*' line: 'HTTPCACHE_ON=False' state: present diff --git a/roles/network/tasks/hostapd.yml b/roles/network/tasks/hostapd.yml index f27e60470..f44cce108 100644 --- a/roles/network/tasks/hostapd.yml +++ b/roles/network/tasks/hostapd.yml @@ -55,9 +55,9 @@ 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 +- name: Record HOSTAPD_ENABLED to {{ iiab_env_file }} lineinfile: - dest: /etc/iiab/iiab.env + dest: "{{ iiab_env_file }}" 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 d5736714d..8dde0ad30 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -11,7 +11,7 @@ no_net_restart: True # used below in (1) sysd-netd-debian.yml, # (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 +# EITHER WAY: hostapd_enabled's state is RECORDED into {{ iiab_env_file }} # in hostapd.yml for later use by... # /usr/libexec/iiab-startup.sh, iiab-hotspot-off & iiab-hotspot-on # diff --git a/roles/network/templates/gateway/iiab-gen-iptables b/roles/network/templates/gateway/iiab-gen-iptables index 1494a2bee..83867f1bd 100755 --- a/roles/network/templates/gateway/iiab-gen-iptables +++ b/roles/network/templates/gateway/iiab-gen-iptables @@ -1,5 +1,5 @@ #!/bin/bash -x -source /etc/iiab/iiab.env +source {{ iiab_env_file }} {% if is_debuntu %} IPTABLES=/sbin/iptables IPTABLES_DATA=/etc/iptables.up.rules diff --git a/roles/network/templates/network/iiab-hotspot-off b/roles/network/templates/network/iiab-hotspot-off index 31b1d5ffc..0bb81e8f2 100755 --- a/roles/network/templates/network/iiab-hotspot-off +++ b/roles/network/templates/network/iiab-hotspot-off @@ -16,4 +16,4 @@ if grep -qi raspbian /etc/*release; then ip link set dev wlan0 promisc on fi -sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" /etc/iiab/iiab.env +sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" {{ iiab_env_file }} diff --git a/roles/network/templates/network/iiab-hotspot-on b/roles/network/templates/network/iiab-hotspot-on index bb264ca92..5d225abeb 100755 --- a/roles/network/templates/network/iiab-hotspot-on +++ b/roles/network/templates/network/iiab-hotspot-on @@ -17,6 +17,6 @@ if grep -qi raspbian /etc/*release; then ip link set dev wlan0 promisc off fi -sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" /etc/iiab/iiab.env +sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }} echo -e "\nPlease consider rebooting now.\n" diff --git a/roles/openvpn/templates/announcer.j2 b/roles/openvpn/templates/announcer.j2 index f453abf24..9c301f065 100755 --- a/roles/openvpn/templates/announcer.j2 +++ b/roles/openvpn/templates/announcer.j2 @@ -19,7 +19,7 @@ if [ -f /etc/iiab/openvpn_handle ]; then #else # # Option #3: Dangerous to invoke hypothetical variables :( -# source /etc/iiab/iiab.env +# source {{ iiab_env_file }} # # Option #4: CAUSED FAILURES IN AUGUST 2018, invoking stale variable from /etc/iiab/iiab.ini, but safer now that relegated to #4 ? # if [ -z "$HANDLE" ]; then # HANDLE=`cat /etc/iiab/iiab.ini | gawk \ diff --git a/roles/usb-lib/tasks/main.yml b/roles/usb-lib/tasks/main.yml index 1792cd584..4fa46ca42 100644 --- a/roles/usb-lib/tasks/main.yml +++ b/roles/usb-lib/tasks/main.yml @@ -55,7 +55,7 @@ - name: Put variable in iiab.env that enables display of content at root of USB lineinfile: - dest: /etc/iiab/iiab.env + dest: "{{ iiab_env_file }}" regexp: "^IIAB_USB_LIB_SHOW_ALL.*" line: "IIAB_USB_LIB_SHOW_ALL={{ iiab_usb_lib_show_all }}" 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 adeff4c81..06f36ba70 100644 --- a/roles/usb-lib/templates/iiab-usb-lib-show-all-off +++ b/roles/usb-lib/templates/iiab-usb-lib-show-all-off @@ -1,5 +1,5 @@ #!/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 +sed -i -e's/^IIAB_USB_LIB_SHOW_ALL.*/IIAB_USB_LIB_SHOW_ALL=False/' {{ iiab_env_file }} 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 297f37025..83a03f225 100644 --- a/roles/usb-lib/templates/iiab-usb-lib-show-all-on +++ b/roles/usb-lib/templates/iiab-usb-lib-show-all-on @@ -1,5 +1,5 @@ #!/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 +sed -i -e's/^IIAB_USB_LIB_SHOW_ALL.*/IIAB_USB_LIB_SHOW_ALL=True/' {{ iiab_env_file }} diff --git a/roles/usb-lib/templates/mount.d/70-usb-library b/roles/usb-lib/templates/mount.d/70-usb-library index 02328339d..11358220d 100644 --- a/roles/usb-lib/templates/mount.d/70-usb-library +++ b/roles/usb-lib/templates/mount.d/70-usb-library @@ -9,7 +9,7 @@ # # by Tim Moody tim@timmoody.com -source /etc/iiab/iiab.env +source {{ iiab_env_file }} case $IIAB_USB_LIB_SHOW_ALL in 'True'|'true'|'TRUE') logger -p user.notice -t "70-usb-library" -- "Displaying root directory on $UM_MOUNTPOINT."