From c865505c5a899ee5795a114958a7c0c16c27d36c Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 28 Oct 2017 13:30:27 -0500 Subject: [PATCH 01/63] introduce iiab-steps.yml --- iiab-steps.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 iiab-steps.yml diff --git a/iiab-steps.yml b/iiab-steps.yml new file mode 100644 index 000000000..66c97721c --- /dev/null +++ b/iiab-steps.yml @@ -0,0 +1,29 @@ +--- +- hosts: all + become: yes + + vars_files: + - vars/default_vars.yml + - vars/{{ ansible_local.local_facts.os_ver }}.yml + - vars/local_vars.yml + + roles: + - { role: 0-init, tags: ['0-init'] } + - { role: 1-prep, tags: ['1-prep','platform','base'], + when: ansible_local.local_facts.stage|int < 1 } + - { role: 2-common, tags: ['2-common','base'], + when: ansible_local.local_facts.stage|int < 2 } + - { role: 3-base-server, tags: ['3-base-server','base'], + when: ansible_local.local_facts.stage|int < 3 } + - { role: 4-server-options, tags: ['4-server-options'], + when: ansible_local.local_facts.stage|int < 4 } + - { role: 5-xo-services, tags: ['5-xo-services'], + when: ansible_local.local_facts.stage|int < 5 } + - { role: 6-generic-apps, tags: ['6-generic-apps'], + when: ansible_local.local_facts.stage|int < 6 } + - { role: 7-edu-apps, tags: ['7-edu-apps'], + when: ansible_local.local_facts.stage|int < 7 } + - { role: 8-mgmt-tools, tags: ['8-mgmt-tools'], + when: ansible_local.local_facts.stage|int < 8 } + - { role: 9-local-addons, tags: ['9-local-addons'], + when: ansible_local.local_facts.stage|int < 9 } From f60dc751c6516773dbf9294c66a4d67812b1b78c Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 28 Oct 2017 11:31:32 -0500 Subject: [PATCH 02/63] introduce 'stage' --- scripts/local_facts.fact | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/local_facts.fact b/scripts/local_facts.fact index 4d9da02d6..43f8ab6f5 100755 --- a/scripts/local_facts.fact +++ b/scripts/local_facts.fact @@ -41,9 +41,20 @@ else XO_VERSION="none" fi +# upgrades return found, clean installs return 0 +# interruptions return last stage number recorded (1-9) +if [ -f /etc/iiab/iiab.env ] +then + STAGE=0 + source /etc/iiab/iiab.env + STAGE=$STAGE +else + STAGE=0 +fi ANSIBLE_VERSION=$(ansible --version|head -n 1|cut -f 2 -d " ") cat < Date: Sat, 28 Oct 2017 12:42:51 -0500 Subject: [PATCH 03/63] activate old marker code --- roles/3-base-server/tasks/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/3-base-server/tasks/main.yml b/roles/3-base-server/tasks/main.yml index 3aa90c43b..ca7c86b66 100644 --- a/roles/3-base-server/tasks/main.yml +++ b/roles/3-base-server/tasks/main.yml @@ -31,11 +31,11 @@ when: not installing # If we got here we're done -#- name: Record base gui version -# lineinfile: dest=/etc/iiab/iiab.env -# regexp='^BASE_VERSION=*' -# line='BASE_VERSION="{{ gui_version }}"' -# state=present +- name: Record STAGE + lineinfile: dest=/etc/iiab/iiab.env + regexp='^STAGE=*' + line='STAGE=3' + state=present - name: ...HAS COMPLETED ==================================== command: echo From e895f6a00b9199fe8eba194f5fefa9e91af17e6b Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 28 Oct 2017 12:46:47 -0500 Subject: [PATCH 04/63] move iiab.env template - add starting STAGE=1 - update STAGE on the fly part 1 --- roles/1-prep/tasks/main.yml | 8 ++++++++ roles/1-prep/templates/iiab.env.j2 | 1 + roles/2-common/tasks/main.yml | 6 ++++++ roles/4-server-options/tasks/main.yml | 12 +++++------- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/roles/1-prep/tasks/main.yml b/roles/1-prep/tasks/main.yml index e6e2b382a..02e39ccd1 100644 --- a/roles/1-prep/tasks/main.yml +++ b/roles/1-prep/tasks/main.yml @@ -88,5 +88,13 @@ url={{ iiab_download_url }}/iwlwifi-8000C-13.ucode when: first_run and usb_NUC6.stdout|int > 0 +# this script can be sourced to get IIAB location +- name: Create iiab.env file + template: src=roles/1-prep/templates/iiab.env.j2 + dest=/etc/iiab/iiab.env + owner=root + group=root + mode=0644 + - name: ...HAS COMPLETED =========================================== command: echo diff --git a/roles/1-prep/templates/iiab.env.j2 b/roles/1-prep/templates/iiab.env.j2 index b472d4fe6..bd08f9441 100644 --- a/roles/1-prep/templates/iiab.env.j2 +++ b/roles/1-prep/templates/iiab.env.j2 @@ -5,3 +5,4 @@ IIAB_DIR={{ iiab_dir }} OS={{ ansible_local.local_facts.os }} OS_VER={{ ansible_local.local_facts.os_ver }} WWWROOT={{ doc_root }} +STAGE=1 diff --git a/roles/2-common/tasks/main.yml b/roles/2-common/tasks/main.yml index bfb69887b..e67044a85 100644 --- a/roles/2-common/tasks/main.yml +++ b/roles/2-common/tasks/main.yml @@ -48,5 +48,11 @@ - include: udev.yml +- name: Record STAGE + lineinfile: dest=/etc/iiab/iiab.env + regexp='^STAGE=*' + line='STAGE=2' + state=present + - name: ...HAS COMPLETED ========================================= command: echo diff --git a/roles/4-server-options/tasks/main.yml b/roles/4-server-options/tasks/main.yml index 7efdffe74..fb22f6d0e 100644 --- a/roles/4-server-options/tasks/main.yml +++ b/roles/4-server-options/tasks/main.yml @@ -57,13 +57,11 @@ when: usb_lib_install tags: usb-lib -# this script can be sourced to get IIAB location -- name: Create iiab.env file - template: src=roles/1-prep/templates/iiab.env.j2 - dest=/etc/iiab/iiab.env - owner=root - group=root - mode=0644 +- name: Record STAGE + lineinfile: dest=/etc/iiab/iiab.env + regexp='^STAGE=*' + line='STAGE=4' + state=present - name: Put a Python interface to iiab.env template: src=roles/1-prep/templates/iiab_env.py.j2 From 88f535f6947e6fe6135193a2062a1bb951282bf2 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 28 Oct 2017 12:53:47 -0500 Subject: [PATCH 05/63] update STAGE on the fly part 2 --- roles/5-xo-services/tasks/main.yml | 6 ++++++ roles/6-generic-apps/tasks/main.yml | 6 ++++++ roles/7-edu-apps/tasks/main.yml | 6 ++++++ roles/8-mgmt-tools/tasks/main.yml | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/roles/5-xo-services/tasks/main.yml b/roles/5-xo-services/tasks/main.yml index 2ee59d9e0..6e99a3299 100644 --- a/roles/5-xo-services/tasks/main.yml +++ b/roles/5-xo-services/tasks/main.yml @@ -21,5 +21,11 @@ when: idmgr_install tags: olpc, idmgr +- name: Record STAGE 5 + lineinfile: dest=/etc/iiab/iiab.env + regexp='^STAGE=*' + line='STAGE=5' + state=present + - name: ...HAS COMPLETED ==================================== command: echo diff --git a/roles/6-generic-apps/tasks/main.yml b/roles/6-generic-apps/tasks/main.yml index 6b4deeb49..969450b36 100644 --- a/roles/6-generic-apps/tasks/main.yml +++ b/roles/6-generic-apps/tasks/main.yml @@ -45,5 +45,11 @@ when: wordpress_install tags: wordpress +- name: Record STAGE 6 + lineinfile: dest=/etc/iiab/iiab.env + regexp='^STAGE=*' + line='STAGE=6' + state=present + - name: ...HAS COMPLETED =================================== command: echo diff --git a/roles/7-edu-apps/tasks/main.yml b/roles/7-edu-apps/tasks/main.yml index d484570b1..d5a5e97b3 100644 --- a/roles/7-edu-apps/tasks/main.yml +++ b/roles/7-edu-apps/tasks/main.yml @@ -39,5 +39,11 @@ when: sugarizer_install tags: sugarizer +- name: Record STAGE 7 + lineinfile: dest=/etc/iiab/iiab.env + regexp='^STAGE=*' + line='STAGE=7' + state=present + - name: ...HAS COMPLETED ======================================= command: echo diff --git a/roles/8-mgmt-tools/tasks/main.yml b/roles/8-mgmt-tools/tasks/main.yml index 01920102d..9351d6770 100644 --- a/roles/8-mgmt-tools/tasks/main.yml +++ b/roles/8-mgmt-tools/tasks/main.yml @@ -51,5 +51,11 @@ when: xovis_install and ansible_distribution != "CentOS" tags: xovis +- name: Record STAGE 8 + lineinfile: dest=/etc/iiab/iiab.env + regexp='^STAGE=*' + line='STAGE=8' + state=present + - name: ...HAS COMPLETED ===================================== command: echo From 02529e03b32592e045c4ea2eebe4c1c691babc16 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 29 Oct 2017 01:53:13 -0500 Subject: [PATCH 06/63] cherry-pick f6ddc8ecfbf736dd0bbaf034c9943ee0b2ae7d6d --- roles/1-prep/tasks/computed_vars.yml | 63 +++++++++++++++------------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/roles/1-prep/tasks/computed_vars.yml b/roles/1-prep/tasks/computed_vars.yml index ae53e7970..28ba861d6 100644 --- a/roles/1-prep/tasks/computed_vars.yml +++ b/roles/1-prep/tasks/computed_vars.yml @@ -6,8 +6,9 @@ # set top level variables from local facts for convenience - set_fact: - xo_model: '{{ ansible_local["local_facts"]["xo_model"] }}' - phplib_dir: '{{ ansible_local["local_facts"]["phplib_dir"] }}' + xo_model: '{{ ansible_local.local_facts.xo_model }}' + phplib_dir: '{{ ansible_local.local_facts.phplib_dir }}' + iiab_stage: '{{ ansible_local.local_facts.stage }}' - name: Set exFAT enabled for XO laptops set_fact: @@ -46,33 +47,6 @@ file: path=/tmp/heart-beat.txt state=absent -- name: add version section - ini_file: dest='{{ iiab_config_file }}' - section=runtime - option='{{ item.option }}' - value='{{ item.value }}' - with_items: - - option: 'runtime_branch' - value: '{{ ansible_local["local_facts"]["iiab_branch"] }}' - - option: 'runtime_commit' - value: '{{ ansible_local["local_facts"]["iiab_commit"] }}' - - option: 'runtime_date' - value: '{{ ansible_date_time["iso8601"] }}' - - option: 'runtime_php' - value: '{{ phplib_dir }}' - - option: 'kernel' - value: '{{ ansible_kernel }}' - - option: 'memory_mb' - value: '{{ ansible_memtotal_mb }}' - - option: 'swap_mb' - value: '{{ ansible_swaptotal_mb }}' - - option: 'product_id' - value: '{{ ansible_product_uuid }}' - - option: 'gw_active' - value: '{{ gw_active }}' - - option: 'internet_available' - value: '{{ internet_available }}' - # Put all computed vars here so derive properly from any prior var file - name: If the TZ is not set in env, set it to UTC set_fact: local_tz='UTC' @@ -176,3 +150,34 @@ set_fact: is_CentOS: True when: ansible_distribution == "CentOS" + +- name: add version section + ini_file: dest='{{ iiab_config_file }}' + section=runtime + option='{{ item.option }}' + value='{{ item.value }}' + with_items: + - option: 'iiab_stage' + value: '{{ iiab_stage }}' + - option: 'runtime_php' + value: '{{ phplib_dir }}' + - option: 'runtime_branch' + value: '{{ ansible_local.local_facts.iiab_branch }}' + - option: 'runtime_commit' + value: '{{ ansible_local.local_facts.iiab_commit }}' + - option: 'runtime_date' + value: '{{ ansible_date_time.iso8601 }}' + - option: 'ansible_version' + value: '{{ ansible_local.local_facts.ansible_version }}' + - option: 'kernel' + value: '{{ ansible_kernel }}' + - option: 'memory_mb' + value: '{{ ansible_memtotal_mb }}' + - option: 'swap_mb' + value: '{{ ansible_swaptotal_mb }}' + - option: 'product_id' + value: '{{ ansible_product_uuid }}' + - option: 'gw_active' + value: '{{ gw_active }}' + - option: 'internet_available' + value: '{{ internet_available }}' From d20a3f6aa0a030f7c343983b77e3f04bf8f9efe7 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 30 Oct 2017 12:02:18 -0500 Subject: [PATCH 07/63] partial cherry-pick of 87c81df5e0f4c938ac03df92433bcfc31a0294e0 --- scripts/local_facts.fact | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/local_facts.fact b/scripts/local_facts.fact index 43f8ab6f5..54863bcd7 100755 --- a/scripts/local_facts.fact +++ b/scripts/local_facts.fact @@ -45,7 +45,7 @@ fi # interruptions return last stage number recorded (1-9) if [ -f /etc/iiab/iiab.env ] then - STAGE=0 + STAGE=1 source /etc/iiab/iiab.env STAGE=$STAGE else @@ -58,7 +58,7 @@ cat < Date: Mon, 30 Oct 2017 12:14:09 -0500 Subject: [PATCH 08/63] partial cherry-pick of 0026446a800b345a7cbc7314ce10de0ea85efb0a --- roles/1-prep/tasks/main.yml | 7 ++----- roles/2-common/tasks/main.yml | 7 ++----- roles/3-base-server/tasks/main.yml | 8 ++------ roles/4-server-options/tasks/main.yml | 14 +++++--------- roles/5-xo-services/tasks/main.yml | 8 ++------ roles/6-generic-apps/tasks/main.yml | 8 ++------ roles/7-edu-apps/tasks/main.yml | 8 ++------ roles/8-mgmt-tools/tasks/main.yml | 7 ++----- roles/9-local-addons/tasks/main.yml | 9 ++++++--- 9 files changed, 25 insertions(+), 51 deletions(-) diff --git a/roles/1-prep/tasks/main.yml b/roles/1-prep/tasks/main.yml index 02e39ccd1..84ae926eb 100644 --- a/roles/1-prep/tasks/main.yml +++ b/roles/1-prep/tasks/main.yml @@ -1,6 +1,6 @@ # Preparations (Hardware Level) -- name: ...IS BEGINNING ============================================ +- name: ...IS BEGINNING ================================== command: echo - name: Get the uuidgen program @@ -89,12 +89,9 @@ when: first_run and usb_NUC6.stdout|int > 0 # this script can be sourced to get IIAB location -- name: Create iiab.env file +- name: Recording STAGE 1 HAS COMPLETED ================== template: src=roles/1-prep/templates/iiab.env.j2 dest=/etc/iiab/iiab.env owner=root group=root mode=0644 - -- name: ...HAS COMPLETED =========================================== - command: echo diff --git a/roles/2-common/tasks/main.yml b/roles/2-common/tasks/main.yml index e67044a85..acaacc99f 100644 --- a/roles/2-common/tasks/main.yml +++ b/roles/2-common/tasks/main.yml @@ -1,6 +1,6 @@ # Common OS-Level Additions & Mods (that only need to be performed once) -- name: ...IS BEGINNING ========================================== +- name: ...IS BEGINNING ================================== command: echo #- include: iiab_ini.yml @@ -48,11 +48,8 @@ - include: udev.yml -- name: Record STAGE +- name: Recording STAGE 2 HAS COMPLETED ================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=2' state=present - -- name: ...HAS COMPLETED ========================================= - command: echo diff --git a/roles/3-base-server/tasks/main.yml b/roles/3-base-server/tasks/main.yml index ca7c86b66..e59553e9e 100644 --- a/roles/3-base-server/tasks/main.yml +++ b/roles/3-base-server/tasks/main.yml @@ -1,6 +1,5 @@ # Base Server - -- name: ...IS BEGINNING ===================================== +- name: ...IS BEGINNING ================================== command: echo - name: HTTPD @@ -30,12 +29,9 @@ state=restarted when: not installing -# If we got here we're done -- name: Record STAGE +- name: Record STAGE 3 HAS COMPLETED ===================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=3' state=present -- name: ...HAS COMPLETED ==================================== - command: echo diff --git a/roles/4-server-options/tasks/main.yml b/roles/4-server-options/tasks/main.yml index fb22f6d0e..2b68861eb 100644 --- a/roles/4-server-options/tasks/main.yml +++ b/roles/4-server-options/tasks/main.yml @@ -1,5 +1,4 @@ # Server Options - - name: ...IS BEGINNING ================================== command: echo @@ -57,12 +56,6 @@ when: usb_lib_install tags: usb-lib -- name: Record STAGE - lineinfile: dest=/etc/iiab/iiab.env - regexp='^STAGE=*' - line='STAGE=4' - state=present - - name: Put a Python interface to iiab.env template: src=roles/1-prep/templates/iiab_env.py.j2 dest=/etc/iiab/iiab_env.py @@ -71,5 +64,8 @@ command: /usr/bin/iiab-refresh-wiki-docs when: not nodocs -- name: ...HAS COMPLETED ================================= - command: echo +- name: Recording STAGE 4 HAS COMPLETED ================== + lineinfile: dest=/etc/iiab/iiab.env + regexp='^STAGE=*' + line='STAGE=4' + state=present diff --git a/roles/5-xo-services/tasks/main.yml b/roles/5-xo-services/tasks/main.yml index 6e99a3299..bc9c20653 100644 --- a/roles/5-xo-services/tasks/main.yml +++ b/roles/5-xo-services/tasks/main.yml @@ -1,6 +1,5 @@ # XO Services - -- name: ...IS BEGINNING ===================================== +- name: ...IS BEGINNING ================================== command: echo - name: ACTIVITY-SERVER @@ -21,11 +20,8 @@ when: idmgr_install tags: olpc, idmgr -- name: Record STAGE 5 +- name: Recording STAGE 5 HAS COMPLETED ================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=5' state=present - -- name: ...HAS COMPLETED ==================================== - command: echo diff --git a/roles/6-generic-apps/tasks/main.yml b/roles/6-generic-apps/tasks/main.yml index 969450b36..9cf53a700 100644 --- a/roles/6-generic-apps/tasks/main.yml +++ b/roles/6-generic-apps/tasks/main.yml @@ -1,6 +1,5 @@ # Generic Apps - -- name: ...IS BEGINNING ==================================== +- name: ...IS BEGINNING ================================== command: echo - name: CALIBRE @@ -45,11 +44,8 @@ when: wordpress_install tags: wordpress -- name: Record STAGE 6 +- name: Recording STAGE 6 HAS COMPLETED ================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=6' state=present - -- name: ...HAS COMPLETED =================================== - command: echo diff --git a/roles/7-edu-apps/tasks/main.yml b/roles/7-edu-apps/tasks/main.yml index d5a5e97b3..ee98a0d2d 100644 --- a/roles/7-edu-apps/tasks/main.yml +++ b/roles/7-edu-apps/tasks/main.yml @@ -1,6 +1,5 @@ # Educational Apps - -- name: ...IS BEGINNING ======================================== +- name: ...IS BEGINNING ================================== command: echo - name: KALITE @@ -39,11 +38,8 @@ when: sugarizer_install tags: sugarizer -- name: Record STAGE 7 +- name: Recording STAGE 7 HAS COMPLETED ================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=7' state=present - -- name: ...HAS COMPLETED ======================================= - command: echo diff --git a/roles/8-mgmt-tools/tasks/main.yml b/roles/8-mgmt-tools/tasks/main.yml index 9351d6770..91413900b 100644 --- a/roles/8-mgmt-tools/tasks/main.yml +++ b/roles/8-mgmt-tools/tasks/main.yml @@ -1,6 +1,6 @@ # Assessment and Monitoring Tools -- name: ...IS BEGINNING ====================================== +- name: ...IS BEGINNING ================================== command: echo - name: AWSTATS @@ -51,11 +51,8 @@ when: xovis_install and ansible_distribution != "CentOS" tags: xovis -- name: Record STAGE 8 +- name: Recording STAGE 8 HAS COMPLETED ================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=8' state=present - -- name: ...HAS COMPLETED ===================================== - command: echo diff --git a/roles/9-local-addons/tasks/main.yml b/roles/9-local-addons/tasks/main.yml index 197bb3366..f518d6c81 100644 --- a/roles/9-local-addons/tasks/main.yml +++ b/roles/9-local-addons/tasks/main.yml @@ -1,7 +1,10 @@ # Local Add-ons -- name: ...IS BEGINNING ==================================== +- name: ...IS BEGINNING ============================= command: echo -- name: ...HAS COMPLETED =================================== - command: echo +- name: Recording STAGE 9 HAS COMPLETED ============= + lineinfile: dest=/etc/iiab/iiab.env + regexp='^STAGE=*' + line='STAGE=9' + state=present From ebbcfb0c5d32b7d51ec07f91aa7c6ed61d8b8ba6 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 30 Oct 2017 12:57:55 -0500 Subject: [PATCH 09/63] scripts cleanup --- iiab-network | 14 +++----------- install-support | 3 ++- runtags | 14 +++----------- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/iiab-network b/iiab-network index 9e24154be..feb2e3ac9 100755 --- a/iiab-network +++ b/iiab-network @@ -1,15 +1,8 @@ #!/bin/bash - -if [ -f /etc/iiab/iiab.env ] -then - . /etc/iiab/iiab.env - cd $IIAB_DIR -else - echo /etc/iiab/iiab.env is missing. Playbook has not been run. - exit 1 -fi - +# running from a git repo +# ansible files exist CWD=`pwd` +export ANSIBLE_LOG_PATH="$CWD/iiab-network.log" if [ ! -f iiab-network.yml ] then @@ -24,7 +17,6 @@ then touch /etc/iiab/config_vars.yml fi -export ANSIBLE_LOG_PATH="$CWD/iiab-network.log" ansible-playbook -i ansible_hosts iiab-network.yml --connection=local echo "" >> iiab-network.log ls -la /etc/sys*/net*/ifcfg* >> iiab-network.log diff --git a/install-support b/install-support index b7df01489..79439f2f7 100755 --- a/install-support +++ b/install-support @@ -4,6 +4,8 @@ PLAYBOOK="iiab-base.yml" INVENTORY="ansible_hosts" CWD=`pwd` +export ANSIBLE_LOG_PATH="$CWD/iiab-install.log" + if [ ! -f $PLAYBOOK ] then echo "IIAB Playbook not found." @@ -15,5 +17,4 @@ fi sed -i -e "s/openvpn_install: False/openvpn_install: True/" vars/local_vars.yml sed -i -e "s/openvpn_enabled: False/openvpn_enabled: True/" vars/local_vars.yml -export ANSIBLE_LOG_PATH="$CWD/iiab-install.log" ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local diff --git a/runtags b/runtags index b353d3a65..45ee507e7 100755 --- a/runtags +++ b/runtags @@ -1,16 +1,11 @@ #!/bin/bash +# running from a git repo PLAYBOOK="iiab.yml" INVENTORY="ansible_hosts" -# Pass cmdline options for ansible - -if [ -f /etc/iiab/iiab.env ] -then - . /etc/iiab/iiab.env - cd $IIAB_DIR -fi - CWD=`pwd` +export ANSIBLE_LOG_PATH="$CWD/iiab-debug.log" + if [ ! -f $PLAYBOOK ] then echo "IIAB Playbook not found." @@ -41,8 +36,6 @@ do fi done -# echo $found - taglist=$1 if [ "$found" == "N" ] @@ -50,5 +43,4 @@ then taglist="0-init,"$taglist fi -export ANSIBLE_LOG_PATH="$CWD/iiab-debug.log" ansible-playbook -i ansible_hosts iiab.yml --connection=local --tags="""$taglist""" From becba2c06e16b4b7b55b1e9d07f4c6b6c2c30d36 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 28 Oct 2017 15:09:24 -0500 Subject: [PATCH 10/63] XSCE -> IIAB in iiab.env --- roles/1-prep/templates/iiab.env.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/1-prep/templates/iiab.env.j2 b/roles/1-prep/templates/iiab.env.j2 index bd08f9441..423c13ec6 100644 --- a/roles/1-prep/templates/iiab.env.j2 +++ b/roles/1-prep/templates/iiab.env.j2 @@ -1,4 +1,4 @@ -# This is a configuration file for XSCE +# This is a configuration file for IIAB # It can sourced in a shell script or read into an application IIAB_BASE_PATH={{ iiab_base }} IIAB_DIR={{ iiab_dir }} From 722ea46f8a0f584037ba8d085d053b8919c91af5 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 30 Oct 2017 13:05:19 -0500 Subject: [PATCH 11/63] introduce iiab-install --- iiab-install | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 iiab-install diff --git a/iiab-install b/iiab-install new file mode 100755 index 000000000..5a3994622 --- /dev/null +++ b/iiab-install @@ -0,0 +1,74 @@ +#!/bin/bash -e +# running from a git repo +PLAYBOOK="iiab-steps.yml" +INVENTORY="ansible_hosts" +CWD=`pwd` +# Add cmdline options for passing to ansible +# todo add proper shift to gobble up --debug --upgrade +ARGS="" + +export ANSIBLE_LOG_PATH="$CWD/iiab-install.log" + +if [ ! -f /etc/ansible/facts.d/local_facts.fact ]; then + mkdir -p /etc/ansible/facts.d +fi +cp ./scripts/local_facts.fact /etc/ansible/facts.d/local_facts.fact + +STAGE="" + +if [ -f /etc/iiab/iiab.env ]; then + OLD=`grep XSCE /etc/iiab/iiab.env | wc -l` + if [ "$OLD" != 0 ] || [ "$1" = "--reinstall" ]; then + echo "Found old XSCE install - re-installing from scratch" + rm /etc/iiab/iiab.env + # check ansible version here and force ansible upgrade if needed + else + source /etc/iiab/iiab.env + if [ $STAGE == 9 ] && [ "$1" = "--debug" ]; then + echo "Entering debug mode" + sed -i -e 's/^STAGE=.*/STAGE=2/' /etc/iiab/iiab.env + elif [ ! $STAGE == 9 ]; then + echo "Restarting from STAGE $STAGE" + else + # place keeper add read response + # "offer 'Y' or stage number dialog box option to override" + echo "'iiab-install' has already been completed" + echo "use --debug to override " + echo "In demo mode not preventing second run" + #echo "Exiting." + #exit 0 + fi + fi +else + mkdir -p /etc/iiab +fi + +if [ ! -f $PLAYBOOK ]; then + echo "IIAB Playbook not found." + echo "Please run this command from the top level of the git repo." + echo "Exiting." + exit 1 +fi + +# if vars/local_vars.yml is missing, put a default one in place - First Run +if [ ! -f ./vars/local_vars.yml ]; then + OS=`grep ^ID= /etc/*release|cut -d= -f2` + OS=${OS//\"/} + + case $OS in + OLPC | fedora) + cp ./vars/olpc.localvars ./vars/local_vars.yml + ;; + centos | debian | ubuntu | raspbian) + cp ./vars/medium.localvars ./vars/local_vars.yml + ;; + *) + echo "IIAB supports raspbian, debian, ubuntu, centos, and OLPC - exiting now..." + exit 1 + ;; + esac +fi + +echo "Running local playbooks! " +ansible -m setup -i $INVENTORY localhost --connection=local >> /dev/null +ansible-playbook -i $INVENTORY $PLAYBOOK ${ARGS} --connection=local From aed29780fb24a7a4cc17d969ef24824a6f7a6b39 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 30 Oct 2017 15:02:23 -0500 Subject: [PATCH 12/63] flip logic for easier read - exit if STAGE=9 --- iiab-install | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/iiab-install b/iiab-install index 5a3994622..15010a3bd 100755 --- a/iiab-install +++ b/iiab-install @@ -4,7 +4,7 @@ PLAYBOOK="iiab-steps.yml" INVENTORY="ansible_hosts" CWD=`pwd` # Add cmdline options for passing to ansible -# todo add proper shift to gobble up --debug --upgrade +# todo add proper shift to gobble up --debug --reinstall ARGS="" export ANSIBLE_LOG_PATH="$CWD/iiab-install.log" @@ -16,7 +16,9 @@ cp ./scripts/local_facts.fact /etc/ansible/facts.d/local_facts.fact STAGE="" -if [ -f /etc/iiab/iiab.env ]; then +if [ ! -f /etc/iiab/iiab.env ]; then + mkdir -p /etc/iiab +else OLD=`grep XSCE /etc/iiab/iiab.env | wc -l` if [ "$OLD" != 0 ] || [ "$1" = "--reinstall" ]; then echo "Found old XSCE install - re-installing from scratch" @@ -34,13 +36,11 @@ if [ -f /etc/iiab/iiab.env ]; then # "offer 'Y' or stage number dialog box option to override" echo "'iiab-install' has already been completed" echo "use --debug to override " - echo "In demo mode not preventing second run" + #echo "In demo mode not preventing second run" #echo "Exiting." - #exit 0 + exit 1 fi fi -else - mkdir -p /etc/iiab fi if [ ! -f $PLAYBOOK ]; then From 6b4c61b28a0ded96ace1e5102a6df37cd2534f6c Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 30 Oct 2017 15:19:09 -0500 Subject: [PATCH 13/63] exit warning --- iiab-install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iiab-install b/iiab-install index 15010a3bd..52f4575ca 100755 --- a/iiab-install +++ b/iiab-install @@ -37,7 +37,7 @@ else echo "'iiab-install' has already been completed" echo "use --debug to override " #echo "In demo mode not preventing second run" - #echo "Exiting." + echo "Exiting." exit 1 fi fi From f5e4eef39d34be6f7f8db0801f9b4a25672a6b7f Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:29:49 -0400 Subject: [PATCH 14/63] fill lines with ==='s --- roles/1-prep/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/1-prep/tasks/main.yml b/roles/1-prep/tasks/main.yml index 84ae926eb..fea4ea34f 100644 --- a/roles/1-prep/tasks/main.yml +++ b/roles/1-prep/tasks/main.yml @@ -1,6 +1,6 @@ # Preparations (Hardware Level) -- name: ...IS BEGINNING ================================== +- name: ...IS BEGINNING ============================================ command: echo - name: Get the uuidgen program @@ -89,7 +89,7 @@ when: first_run and usb_NUC6.stdout|int > 0 # this script can be sourced to get IIAB location -- name: Recording STAGE 1 HAS COMPLETED ================== +- name: Recording STAGE 1 HAS COMPLETED ============================ template: src=roles/1-prep/templates/iiab.env.j2 dest=/etc/iiab/iiab.env owner=root From 319ae07484617a16daabb8eff668cc72d376095d Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:31:16 -0400 Subject: [PATCH 15/63] fill lines with ==='s --- roles/2-common/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/2-common/tasks/main.yml b/roles/2-common/tasks/main.yml index acaacc99f..c7af19941 100644 --- a/roles/2-common/tasks/main.yml +++ b/roles/2-common/tasks/main.yml @@ -1,6 +1,6 @@ # Common OS-Level Additions & Mods (that only need to be performed once) -- name: ...IS BEGINNING ================================== +- name: ...IS BEGINNING ========================================== command: echo #- include: iiab_ini.yml @@ -48,7 +48,7 @@ - include: udev.yml -- name: Recording STAGE 2 HAS COMPLETED ================== +- name: Recording STAGE 2 HAS COMPLETED ========================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=2' From 07dd80b2dff4974d27b034630bd13e26f65fccf6 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:32:31 -0400 Subject: [PATCH 16/63] fill lines with ==='s --- roles/3-base-server/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/3-base-server/tasks/main.yml b/roles/3-base-server/tasks/main.yml index e59553e9e..b77c032ef 100644 --- a/roles/3-base-server/tasks/main.yml +++ b/roles/3-base-server/tasks/main.yml @@ -1,5 +1,5 @@ # Base Server -- name: ...IS BEGINNING ================================== +- name: ...IS BEGINNING ===================================== command: echo - name: HTTPD @@ -29,7 +29,7 @@ state=restarted when: not installing -- name: Record STAGE 3 HAS COMPLETED ===================== +- name: Record STAGE 3 HAS COMPLETED ======================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=3' From 95121c76557240a5ee21a24adf15f5af1b8086d8 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 28 Oct 2017 13:30:27 -0500 Subject: [PATCH 17/63] introduce iiab-steps.yml --- iiab-steps.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 iiab-steps.yml diff --git a/iiab-steps.yml b/iiab-steps.yml new file mode 100644 index 000000000..66c97721c --- /dev/null +++ b/iiab-steps.yml @@ -0,0 +1,29 @@ +--- +- hosts: all + become: yes + + vars_files: + - vars/default_vars.yml + - vars/{{ ansible_local.local_facts.os_ver }}.yml + - vars/local_vars.yml + + roles: + - { role: 0-init, tags: ['0-init'] } + - { role: 1-prep, tags: ['1-prep','platform','base'], + when: ansible_local.local_facts.stage|int < 1 } + - { role: 2-common, tags: ['2-common','base'], + when: ansible_local.local_facts.stage|int < 2 } + - { role: 3-base-server, tags: ['3-base-server','base'], + when: ansible_local.local_facts.stage|int < 3 } + - { role: 4-server-options, tags: ['4-server-options'], + when: ansible_local.local_facts.stage|int < 4 } + - { role: 5-xo-services, tags: ['5-xo-services'], + when: ansible_local.local_facts.stage|int < 5 } + - { role: 6-generic-apps, tags: ['6-generic-apps'], + when: ansible_local.local_facts.stage|int < 6 } + - { role: 7-edu-apps, tags: ['7-edu-apps'], + when: ansible_local.local_facts.stage|int < 7 } + - { role: 8-mgmt-tools, tags: ['8-mgmt-tools'], + when: ansible_local.local_facts.stage|int < 8 } + - { role: 9-local-addons, tags: ['9-local-addons'], + when: ansible_local.local_facts.stage|int < 9 } From 2753307da8efdbeca646097007a2bec709893fb0 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 28 Oct 2017 11:31:32 -0500 Subject: [PATCH 18/63] introduce 'stage' --- scripts/local_facts.fact | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/local_facts.fact b/scripts/local_facts.fact index 4d9da02d6..43f8ab6f5 100755 --- a/scripts/local_facts.fact +++ b/scripts/local_facts.fact @@ -41,9 +41,20 @@ else XO_VERSION="none" fi +# upgrades return found, clean installs return 0 +# interruptions return last stage number recorded (1-9) +if [ -f /etc/iiab/iiab.env ] +then + STAGE=0 + source /etc/iiab/iiab.env + STAGE=$STAGE +else + STAGE=0 +fi ANSIBLE_VERSION=$(ansible --version|head -n 1|cut -f 2 -d " ") cat < Date: Sat, 28 Oct 2017 12:42:51 -0500 Subject: [PATCH 19/63] activate old marker code --- roles/3-base-server/tasks/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/3-base-server/tasks/main.yml b/roles/3-base-server/tasks/main.yml index 3aa90c43b..ca7c86b66 100644 --- a/roles/3-base-server/tasks/main.yml +++ b/roles/3-base-server/tasks/main.yml @@ -31,11 +31,11 @@ when: not installing # If we got here we're done -#- name: Record base gui version -# lineinfile: dest=/etc/iiab/iiab.env -# regexp='^BASE_VERSION=*' -# line='BASE_VERSION="{{ gui_version }}"' -# state=present +- name: Record STAGE + lineinfile: dest=/etc/iiab/iiab.env + regexp='^STAGE=*' + line='STAGE=3' + state=present - name: ...HAS COMPLETED ==================================== command: echo From 3b72c9bd5800507f48e658e45a86dfc93ef1afad Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 28 Oct 2017 12:46:47 -0500 Subject: [PATCH 20/63] move iiab.env template - add starting STAGE=1 - update STAGE on the fly part 1 --- roles/1-prep/tasks/main.yml | 8 ++++++++ roles/1-prep/templates/iiab.env.j2 | 1 + roles/2-common/tasks/main.yml | 6 ++++++ roles/4-server-options/tasks/main.yml | 12 +++++------- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/roles/1-prep/tasks/main.yml b/roles/1-prep/tasks/main.yml index e6e2b382a..02e39ccd1 100644 --- a/roles/1-prep/tasks/main.yml +++ b/roles/1-prep/tasks/main.yml @@ -88,5 +88,13 @@ url={{ iiab_download_url }}/iwlwifi-8000C-13.ucode when: first_run and usb_NUC6.stdout|int > 0 +# this script can be sourced to get IIAB location +- name: Create iiab.env file + template: src=roles/1-prep/templates/iiab.env.j2 + dest=/etc/iiab/iiab.env + owner=root + group=root + mode=0644 + - name: ...HAS COMPLETED =========================================== command: echo diff --git a/roles/1-prep/templates/iiab.env.j2 b/roles/1-prep/templates/iiab.env.j2 index b472d4fe6..bd08f9441 100644 --- a/roles/1-prep/templates/iiab.env.j2 +++ b/roles/1-prep/templates/iiab.env.j2 @@ -5,3 +5,4 @@ IIAB_DIR={{ iiab_dir }} OS={{ ansible_local.local_facts.os }} OS_VER={{ ansible_local.local_facts.os_ver }} WWWROOT={{ doc_root }} +STAGE=1 diff --git a/roles/2-common/tasks/main.yml b/roles/2-common/tasks/main.yml index bfb69887b..e67044a85 100644 --- a/roles/2-common/tasks/main.yml +++ b/roles/2-common/tasks/main.yml @@ -48,5 +48,11 @@ - include: udev.yml +- name: Record STAGE + lineinfile: dest=/etc/iiab/iiab.env + regexp='^STAGE=*' + line='STAGE=2' + state=present + - name: ...HAS COMPLETED ========================================= command: echo diff --git a/roles/4-server-options/tasks/main.yml b/roles/4-server-options/tasks/main.yml index 7efdffe74..fb22f6d0e 100644 --- a/roles/4-server-options/tasks/main.yml +++ b/roles/4-server-options/tasks/main.yml @@ -57,13 +57,11 @@ when: usb_lib_install tags: usb-lib -# this script can be sourced to get IIAB location -- name: Create iiab.env file - template: src=roles/1-prep/templates/iiab.env.j2 - dest=/etc/iiab/iiab.env - owner=root - group=root - mode=0644 +- name: Record STAGE + lineinfile: dest=/etc/iiab/iiab.env + regexp='^STAGE=*' + line='STAGE=4' + state=present - name: Put a Python interface to iiab.env template: src=roles/1-prep/templates/iiab_env.py.j2 From c989a6d3383a595bae2b081736fedd1f3c9e59bd Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 28 Oct 2017 12:53:47 -0500 Subject: [PATCH 21/63] update STAGE on the fly part 2 --- roles/5-xo-services/tasks/main.yml | 6 ++++++ roles/6-generic-apps/tasks/main.yml | 6 ++++++ roles/7-edu-apps/tasks/main.yml | 6 ++++++ roles/8-mgmt-tools/tasks/main.yml | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/roles/5-xo-services/tasks/main.yml b/roles/5-xo-services/tasks/main.yml index 2ee59d9e0..6e99a3299 100644 --- a/roles/5-xo-services/tasks/main.yml +++ b/roles/5-xo-services/tasks/main.yml @@ -21,5 +21,11 @@ when: idmgr_install tags: olpc, idmgr +- name: Record STAGE 5 + lineinfile: dest=/etc/iiab/iiab.env + regexp='^STAGE=*' + line='STAGE=5' + state=present + - name: ...HAS COMPLETED ==================================== command: echo diff --git a/roles/6-generic-apps/tasks/main.yml b/roles/6-generic-apps/tasks/main.yml index 6b4deeb49..969450b36 100644 --- a/roles/6-generic-apps/tasks/main.yml +++ b/roles/6-generic-apps/tasks/main.yml @@ -45,5 +45,11 @@ when: wordpress_install tags: wordpress +- name: Record STAGE 6 + lineinfile: dest=/etc/iiab/iiab.env + regexp='^STAGE=*' + line='STAGE=6' + state=present + - name: ...HAS COMPLETED =================================== command: echo diff --git a/roles/7-edu-apps/tasks/main.yml b/roles/7-edu-apps/tasks/main.yml index d484570b1..d5a5e97b3 100644 --- a/roles/7-edu-apps/tasks/main.yml +++ b/roles/7-edu-apps/tasks/main.yml @@ -39,5 +39,11 @@ when: sugarizer_install tags: sugarizer +- name: Record STAGE 7 + lineinfile: dest=/etc/iiab/iiab.env + regexp='^STAGE=*' + line='STAGE=7' + state=present + - name: ...HAS COMPLETED ======================================= command: echo diff --git a/roles/8-mgmt-tools/tasks/main.yml b/roles/8-mgmt-tools/tasks/main.yml index 01920102d..9351d6770 100644 --- a/roles/8-mgmt-tools/tasks/main.yml +++ b/roles/8-mgmt-tools/tasks/main.yml @@ -51,5 +51,11 @@ when: xovis_install and ansible_distribution != "CentOS" tags: xovis +- name: Record STAGE 8 + lineinfile: dest=/etc/iiab/iiab.env + regexp='^STAGE=*' + line='STAGE=8' + state=present + - name: ...HAS COMPLETED ===================================== command: echo From 96ff88da4991d91268fc04a84d6364051b1e999a Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 29 Oct 2017 01:53:13 -0500 Subject: [PATCH 22/63] cherry-pick f6ddc8ecfbf736dd0bbaf034c9943ee0b2ae7d6d --- roles/1-prep/tasks/computed_vars.yml | 63 +++++++++++++++------------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/roles/1-prep/tasks/computed_vars.yml b/roles/1-prep/tasks/computed_vars.yml index ae53e7970..28ba861d6 100644 --- a/roles/1-prep/tasks/computed_vars.yml +++ b/roles/1-prep/tasks/computed_vars.yml @@ -6,8 +6,9 @@ # set top level variables from local facts for convenience - set_fact: - xo_model: '{{ ansible_local["local_facts"]["xo_model"] }}' - phplib_dir: '{{ ansible_local["local_facts"]["phplib_dir"] }}' + xo_model: '{{ ansible_local.local_facts.xo_model }}' + phplib_dir: '{{ ansible_local.local_facts.phplib_dir }}' + iiab_stage: '{{ ansible_local.local_facts.stage }}' - name: Set exFAT enabled for XO laptops set_fact: @@ -46,33 +47,6 @@ file: path=/tmp/heart-beat.txt state=absent -- name: add version section - ini_file: dest='{{ iiab_config_file }}' - section=runtime - option='{{ item.option }}' - value='{{ item.value }}' - with_items: - - option: 'runtime_branch' - value: '{{ ansible_local["local_facts"]["iiab_branch"] }}' - - option: 'runtime_commit' - value: '{{ ansible_local["local_facts"]["iiab_commit"] }}' - - option: 'runtime_date' - value: '{{ ansible_date_time["iso8601"] }}' - - option: 'runtime_php' - value: '{{ phplib_dir }}' - - option: 'kernel' - value: '{{ ansible_kernel }}' - - option: 'memory_mb' - value: '{{ ansible_memtotal_mb }}' - - option: 'swap_mb' - value: '{{ ansible_swaptotal_mb }}' - - option: 'product_id' - value: '{{ ansible_product_uuid }}' - - option: 'gw_active' - value: '{{ gw_active }}' - - option: 'internet_available' - value: '{{ internet_available }}' - # Put all computed vars here so derive properly from any prior var file - name: If the TZ is not set in env, set it to UTC set_fact: local_tz='UTC' @@ -176,3 +150,34 @@ set_fact: is_CentOS: True when: ansible_distribution == "CentOS" + +- name: add version section + ini_file: dest='{{ iiab_config_file }}' + section=runtime + option='{{ item.option }}' + value='{{ item.value }}' + with_items: + - option: 'iiab_stage' + value: '{{ iiab_stage }}' + - option: 'runtime_php' + value: '{{ phplib_dir }}' + - option: 'runtime_branch' + value: '{{ ansible_local.local_facts.iiab_branch }}' + - option: 'runtime_commit' + value: '{{ ansible_local.local_facts.iiab_commit }}' + - option: 'runtime_date' + value: '{{ ansible_date_time.iso8601 }}' + - option: 'ansible_version' + value: '{{ ansible_local.local_facts.ansible_version }}' + - option: 'kernel' + value: '{{ ansible_kernel }}' + - option: 'memory_mb' + value: '{{ ansible_memtotal_mb }}' + - option: 'swap_mb' + value: '{{ ansible_swaptotal_mb }}' + - option: 'product_id' + value: '{{ ansible_product_uuid }}' + - option: 'gw_active' + value: '{{ gw_active }}' + - option: 'internet_available' + value: '{{ internet_available }}' From 1032e6474ff316fb3a5d0d46333536a80b3ca779 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 30 Oct 2017 12:02:18 -0500 Subject: [PATCH 23/63] partial cherry-pick of 87c81df5e0f4c938ac03df92433bcfc31a0294e0 --- scripts/local_facts.fact | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/local_facts.fact b/scripts/local_facts.fact index 43f8ab6f5..54863bcd7 100755 --- a/scripts/local_facts.fact +++ b/scripts/local_facts.fact @@ -45,7 +45,7 @@ fi # interruptions return last stage number recorded (1-9) if [ -f /etc/iiab/iiab.env ] then - STAGE=0 + STAGE=1 source /etc/iiab/iiab.env STAGE=$STAGE else @@ -58,7 +58,7 @@ cat < Date: Mon, 30 Oct 2017 12:14:09 -0500 Subject: [PATCH 24/63] partial cherry-pick of 0026446a800b345a7cbc7314ce10de0ea85efb0a --- roles/1-prep/tasks/main.yml | 7 ++----- roles/2-common/tasks/main.yml | 7 ++----- roles/3-base-server/tasks/main.yml | 8 ++------ roles/4-server-options/tasks/main.yml | 14 +++++--------- roles/5-xo-services/tasks/main.yml | 8 ++------ roles/6-generic-apps/tasks/main.yml | 8 ++------ roles/7-edu-apps/tasks/main.yml | 8 ++------ roles/8-mgmt-tools/tasks/main.yml | 7 ++----- roles/9-local-addons/tasks/main.yml | 9 ++++++--- 9 files changed, 25 insertions(+), 51 deletions(-) diff --git a/roles/1-prep/tasks/main.yml b/roles/1-prep/tasks/main.yml index 02e39ccd1..84ae926eb 100644 --- a/roles/1-prep/tasks/main.yml +++ b/roles/1-prep/tasks/main.yml @@ -1,6 +1,6 @@ # Preparations (Hardware Level) -- name: ...IS BEGINNING ============================================ +- name: ...IS BEGINNING ================================== command: echo - name: Get the uuidgen program @@ -89,12 +89,9 @@ when: first_run and usb_NUC6.stdout|int > 0 # this script can be sourced to get IIAB location -- name: Create iiab.env file +- name: Recording STAGE 1 HAS COMPLETED ================== template: src=roles/1-prep/templates/iiab.env.j2 dest=/etc/iiab/iiab.env owner=root group=root mode=0644 - -- name: ...HAS COMPLETED =========================================== - command: echo diff --git a/roles/2-common/tasks/main.yml b/roles/2-common/tasks/main.yml index e67044a85..acaacc99f 100644 --- a/roles/2-common/tasks/main.yml +++ b/roles/2-common/tasks/main.yml @@ -1,6 +1,6 @@ # Common OS-Level Additions & Mods (that only need to be performed once) -- name: ...IS BEGINNING ========================================== +- name: ...IS BEGINNING ================================== command: echo #- include: iiab_ini.yml @@ -48,11 +48,8 @@ - include: udev.yml -- name: Record STAGE +- name: Recording STAGE 2 HAS COMPLETED ================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=2' state=present - -- name: ...HAS COMPLETED ========================================= - command: echo diff --git a/roles/3-base-server/tasks/main.yml b/roles/3-base-server/tasks/main.yml index ca7c86b66..e59553e9e 100644 --- a/roles/3-base-server/tasks/main.yml +++ b/roles/3-base-server/tasks/main.yml @@ -1,6 +1,5 @@ # Base Server - -- name: ...IS BEGINNING ===================================== +- name: ...IS BEGINNING ================================== command: echo - name: HTTPD @@ -30,12 +29,9 @@ state=restarted when: not installing -# If we got here we're done -- name: Record STAGE +- name: Record STAGE 3 HAS COMPLETED ===================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=3' state=present -- name: ...HAS COMPLETED ==================================== - command: echo diff --git a/roles/4-server-options/tasks/main.yml b/roles/4-server-options/tasks/main.yml index fb22f6d0e..2b68861eb 100644 --- a/roles/4-server-options/tasks/main.yml +++ b/roles/4-server-options/tasks/main.yml @@ -1,5 +1,4 @@ # Server Options - - name: ...IS BEGINNING ================================== command: echo @@ -57,12 +56,6 @@ when: usb_lib_install tags: usb-lib -- name: Record STAGE - lineinfile: dest=/etc/iiab/iiab.env - regexp='^STAGE=*' - line='STAGE=4' - state=present - - name: Put a Python interface to iiab.env template: src=roles/1-prep/templates/iiab_env.py.j2 dest=/etc/iiab/iiab_env.py @@ -71,5 +64,8 @@ command: /usr/bin/iiab-refresh-wiki-docs when: not nodocs -- name: ...HAS COMPLETED ================================= - command: echo +- name: Recording STAGE 4 HAS COMPLETED ================== + lineinfile: dest=/etc/iiab/iiab.env + regexp='^STAGE=*' + line='STAGE=4' + state=present diff --git a/roles/5-xo-services/tasks/main.yml b/roles/5-xo-services/tasks/main.yml index 6e99a3299..bc9c20653 100644 --- a/roles/5-xo-services/tasks/main.yml +++ b/roles/5-xo-services/tasks/main.yml @@ -1,6 +1,5 @@ # XO Services - -- name: ...IS BEGINNING ===================================== +- name: ...IS BEGINNING ================================== command: echo - name: ACTIVITY-SERVER @@ -21,11 +20,8 @@ when: idmgr_install tags: olpc, idmgr -- name: Record STAGE 5 +- name: Recording STAGE 5 HAS COMPLETED ================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=5' state=present - -- name: ...HAS COMPLETED ==================================== - command: echo diff --git a/roles/6-generic-apps/tasks/main.yml b/roles/6-generic-apps/tasks/main.yml index 969450b36..9cf53a700 100644 --- a/roles/6-generic-apps/tasks/main.yml +++ b/roles/6-generic-apps/tasks/main.yml @@ -1,6 +1,5 @@ # Generic Apps - -- name: ...IS BEGINNING ==================================== +- name: ...IS BEGINNING ================================== command: echo - name: CALIBRE @@ -45,11 +44,8 @@ when: wordpress_install tags: wordpress -- name: Record STAGE 6 +- name: Recording STAGE 6 HAS COMPLETED ================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=6' state=present - -- name: ...HAS COMPLETED =================================== - command: echo diff --git a/roles/7-edu-apps/tasks/main.yml b/roles/7-edu-apps/tasks/main.yml index d5a5e97b3..ee98a0d2d 100644 --- a/roles/7-edu-apps/tasks/main.yml +++ b/roles/7-edu-apps/tasks/main.yml @@ -1,6 +1,5 @@ # Educational Apps - -- name: ...IS BEGINNING ======================================== +- name: ...IS BEGINNING ================================== command: echo - name: KALITE @@ -39,11 +38,8 @@ when: sugarizer_install tags: sugarizer -- name: Record STAGE 7 +- name: Recording STAGE 7 HAS COMPLETED ================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=7' state=present - -- name: ...HAS COMPLETED ======================================= - command: echo diff --git a/roles/8-mgmt-tools/tasks/main.yml b/roles/8-mgmt-tools/tasks/main.yml index 9351d6770..91413900b 100644 --- a/roles/8-mgmt-tools/tasks/main.yml +++ b/roles/8-mgmt-tools/tasks/main.yml @@ -1,6 +1,6 @@ # Assessment and Monitoring Tools -- name: ...IS BEGINNING ====================================== +- name: ...IS BEGINNING ================================== command: echo - name: AWSTATS @@ -51,11 +51,8 @@ when: xovis_install and ansible_distribution != "CentOS" tags: xovis -- name: Record STAGE 8 +- name: Recording STAGE 8 HAS COMPLETED ================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=8' state=present - -- name: ...HAS COMPLETED ===================================== - command: echo diff --git a/roles/9-local-addons/tasks/main.yml b/roles/9-local-addons/tasks/main.yml index 197bb3366..f518d6c81 100644 --- a/roles/9-local-addons/tasks/main.yml +++ b/roles/9-local-addons/tasks/main.yml @@ -1,7 +1,10 @@ # Local Add-ons -- name: ...IS BEGINNING ==================================== +- name: ...IS BEGINNING ============================= command: echo -- name: ...HAS COMPLETED =================================== - command: echo +- name: Recording STAGE 9 HAS COMPLETED ============= + lineinfile: dest=/etc/iiab/iiab.env + regexp='^STAGE=*' + line='STAGE=9' + state=present From 1fa790a2d7ae6ae9dcf60c82c395f273036c8380 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 30 Oct 2017 12:57:55 -0500 Subject: [PATCH 25/63] scripts cleanup --- iiab-network | 14 +++----------- install-support | 3 ++- runtags | 14 +++----------- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/iiab-network b/iiab-network index 9e24154be..feb2e3ac9 100755 --- a/iiab-network +++ b/iiab-network @@ -1,15 +1,8 @@ #!/bin/bash - -if [ -f /etc/iiab/iiab.env ] -then - . /etc/iiab/iiab.env - cd $IIAB_DIR -else - echo /etc/iiab/iiab.env is missing. Playbook has not been run. - exit 1 -fi - +# running from a git repo +# ansible files exist CWD=`pwd` +export ANSIBLE_LOG_PATH="$CWD/iiab-network.log" if [ ! -f iiab-network.yml ] then @@ -24,7 +17,6 @@ then touch /etc/iiab/config_vars.yml fi -export ANSIBLE_LOG_PATH="$CWD/iiab-network.log" ansible-playbook -i ansible_hosts iiab-network.yml --connection=local echo "" >> iiab-network.log ls -la /etc/sys*/net*/ifcfg* >> iiab-network.log diff --git a/install-support b/install-support index b7df01489..79439f2f7 100755 --- a/install-support +++ b/install-support @@ -4,6 +4,8 @@ PLAYBOOK="iiab-base.yml" INVENTORY="ansible_hosts" CWD=`pwd` +export ANSIBLE_LOG_PATH="$CWD/iiab-install.log" + if [ ! -f $PLAYBOOK ] then echo "IIAB Playbook not found." @@ -15,5 +17,4 @@ fi sed -i -e "s/openvpn_install: False/openvpn_install: True/" vars/local_vars.yml sed -i -e "s/openvpn_enabled: False/openvpn_enabled: True/" vars/local_vars.yml -export ANSIBLE_LOG_PATH="$CWD/iiab-install.log" ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local diff --git a/runtags b/runtags index b353d3a65..45ee507e7 100755 --- a/runtags +++ b/runtags @@ -1,16 +1,11 @@ #!/bin/bash +# running from a git repo PLAYBOOK="iiab.yml" INVENTORY="ansible_hosts" -# Pass cmdline options for ansible - -if [ -f /etc/iiab/iiab.env ] -then - . /etc/iiab/iiab.env - cd $IIAB_DIR -fi - CWD=`pwd` +export ANSIBLE_LOG_PATH="$CWD/iiab-debug.log" + if [ ! -f $PLAYBOOK ] then echo "IIAB Playbook not found." @@ -41,8 +36,6 @@ do fi done -# echo $found - taglist=$1 if [ "$found" == "N" ] @@ -50,5 +43,4 @@ then taglist="0-init,"$taglist fi -export ANSIBLE_LOG_PATH="$CWD/iiab-debug.log" ansible-playbook -i ansible_hosts iiab.yml --connection=local --tags="""$taglist""" From dab26c82ccc0dcce616f18ac7c594d1b2c65e6dc Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 28 Oct 2017 15:09:24 -0500 Subject: [PATCH 26/63] XSCE -> IIAB in iiab.env --- roles/1-prep/templates/iiab.env.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/1-prep/templates/iiab.env.j2 b/roles/1-prep/templates/iiab.env.j2 index bd08f9441..423c13ec6 100644 --- a/roles/1-prep/templates/iiab.env.j2 +++ b/roles/1-prep/templates/iiab.env.j2 @@ -1,4 +1,4 @@ -# This is a configuration file for XSCE +# This is a configuration file for IIAB # It can sourced in a shell script or read into an application IIAB_BASE_PATH={{ iiab_base }} IIAB_DIR={{ iiab_dir }} From cbb165a9e552bc14a6078aa79fe6e50a2458b047 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 30 Oct 2017 13:05:19 -0500 Subject: [PATCH 27/63] introduce iiab-install --- iiab-install | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 iiab-install diff --git a/iiab-install b/iiab-install new file mode 100755 index 000000000..5a3994622 --- /dev/null +++ b/iiab-install @@ -0,0 +1,74 @@ +#!/bin/bash -e +# running from a git repo +PLAYBOOK="iiab-steps.yml" +INVENTORY="ansible_hosts" +CWD=`pwd` +# Add cmdline options for passing to ansible +# todo add proper shift to gobble up --debug --upgrade +ARGS="" + +export ANSIBLE_LOG_PATH="$CWD/iiab-install.log" + +if [ ! -f /etc/ansible/facts.d/local_facts.fact ]; then + mkdir -p /etc/ansible/facts.d +fi +cp ./scripts/local_facts.fact /etc/ansible/facts.d/local_facts.fact + +STAGE="" + +if [ -f /etc/iiab/iiab.env ]; then + OLD=`grep XSCE /etc/iiab/iiab.env | wc -l` + if [ "$OLD" != 0 ] || [ "$1" = "--reinstall" ]; then + echo "Found old XSCE install - re-installing from scratch" + rm /etc/iiab/iiab.env + # check ansible version here and force ansible upgrade if needed + else + source /etc/iiab/iiab.env + if [ $STAGE == 9 ] && [ "$1" = "--debug" ]; then + echo "Entering debug mode" + sed -i -e 's/^STAGE=.*/STAGE=2/' /etc/iiab/iiab.env + elif [ ! $STAGE == 9 ]; then + echo "Restarting from STAGE $STAGE" + else + # place keeper add read response + # "offer 'Y' or stage number dialog box option to override" + echo "'iiab-install' has already been completed" + echo "use --debug to override " + echo "In demo mode not preventing second run" + #echo "Exiting." + #exit 0 + fi + fi +else + mkdir -p /etc/iiab +fi + +if [ ! -f $PLAYBOOK ]; then + echo "IIAB Playbook not found." + echo "Please run this command from the top level of the git repo." + echo "Exiting." + exit 1 +fi + +# if vars/local_vars.yml is missing, put a default one in place - First Run +if [ ! -f ./vars/local_vars.yml ]; then + OS=`grep ^ID= /etc/*release|cut -d= -f2` + OS=${OS//\"/} + + case $OS in + OLPC | fedora) + cp ./vars/olpc.localvars ./vars/local_vars.yml + ;; + centos | debian | ubuntu | raspbian) + cp ./vars/medium.localvars ./vars/local_vars.yml + ;; + *) + echo "IIAB supports raspbian, debian, ubuntu, centos, and OLPC - exiting now..." + exit 1 + ;; + esac +fi + +echo "Running local playbooks! " +ansible -m setup -i $INVENTORY localhost --connection=local >> /dev/null +ansible-playbook -i $INVENTORY $PLAYBOOK ${ARGS} --connection=local From 2a07a00025ec6f3faf8a81803645e873bc51abbc Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 30 Oct 2017 15:02:23 -0500 Subject: [PATCH 28/63] flip logic for easier read - exit if STAGE=9 --- iiab-install | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/iiab-install b/iiab-install index 5a3994622..15010a3bd 100755 --- a/iiab-install +++ b/iiab-install @@ -4,7 +4,7 @@ PLAYBOOK="iiab-steps.yml" INVENTORY="ansible_hosts" CWD=`pwd` # Add cmdline options for passing to ansible -# todo add proper shift to gobble up --debug --upgrade +# todo add proper shift to gobble up --debug --reinstall ARGS="" export ANSIBLE_LOG_PATH="$CWD/iiab-install.log" @@ -16,7 +16,9 @@ cp ./scripts/local_facts.fact /etc/ansible/facts.d/local_facts.fact STAGE="" -if [ -f /etc/iiab/iiab.env ]; then +if [ ! -f /etc/iiab/iiab.env ]; then + mkdir -p /etc/iiab +else OLD=`grep XSCE /etc/iiab/iiab.env | wc -l` if [ "$OLD" != 0 ] || [ "$1" = "--reinstall" ]; then echo "Found old XSCE install - re-installing from scratch" @@ -34,13 +36,11 @@ if [ -f /etc/iiab/iiab.env ]; then # "offer 'Y' or stage number dialog box option to override" echo "'iiab-install' has already been completed" echo "use --debug to override " - echo "In demo mode not preventing second run" + #echo "In demo mode not preventing second run" #echo "Exiting." - #exit 0 + exit 1 fi fi -else - mkdir -p /etc/iiab fi if [ ! -f $PLAYBOOK ]; then From ce3dac9102b11cd3337e3e3a5c75908169f49307 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 30 Oct 2017 15:19:09 -0500 Subject: [PATCH 29/63] exit warning --- iiab-install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iiab-install b/iiab-install index 15010a3bd..52f4575ca 100755 --- a/iiab-install +++ b/iiab-install @@ -37,7 +37,7 @@ else echo "'iiab-install' has already been completed" echo "use --debug to override " #echo "In demo mode not preventing second run" - #echo "Exiting." + echo "Exiting." exit 1 fi fi From 4ea786b8ec53191621eb39148ac420126d8c1e1a Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:34:22 -0400 Subject: [PATCH 30/63] fill lines with ==='s --- roles/5-xo-services/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/5-xo-services/tasks/main.yml b/roles/5-xo-services/tasks/main.yml index bc9c20653..58b750908 100644 --- a/roles/5-xo-services/tasks/main.yml +++ b/roles/5-xo-services/tasks/main.yml @@ -1,5 +1,5 @@ # XO Services -- name: ...IS BEGINNING ================================== +- name: ...IS BEGINNING ===================================== command: echo - name: ACTIVITY-SERVER @@ -20,7 +20,7 @@ when: idmgr_install tags: olpc, idmgr -- name: Recording STAGE 5 HAS COMPLETED ================== +- name: Recording STAGE 5 HAS COMPLETED ===================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=5' From d38993df7b5f547277fc76e5c522e0f7e613c30b Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:35:28 -0400 Subject: [PATCH 31/63] fill lines with ==='s --- roles/6-generic-apps/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/6-generic-apps/tasks/main.yml b/roles/6-generic-apps/tasks/main.yml index 9cf53a700..9c4113fc1 100644 --- a/roles/6-generic-apps/tasks/main.yml +++ b/roles/6-generic-apps/tasks/main.yml @@ -1,5 +1,5 @@ # Generic Apps -- name: ...IS BEGINNING ================================== +- name: ...IS BEGINNING ==================================== command: echo - name: CALIBRE @@ -44,7 +44,7 @@ when: wordpress_install tags: wordpress -- name: Recording STAGE 6 HAS COMPLETED ================== +- name: Recording STAGE 6 HAS COMPLETED ==================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=6' From 61074be84ec8544f07bd43e542734d546a5665d1 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:37:06 -0400 Subject: [PATCH 32/63] fill lines with ==='s --- roles/7-edu-apps/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/7-edu-apps/tasks/main.yml b/roles/7-edu-apps/tasks/main.yml index ee98a0d2d..5f7f081d9 100644 --- a/roles/7-edu-apps/tasks/main.yml +++ b/roles/7-edu-apps/tasks/main.yml @@ -1,5 +1,5 @@ # Educational Apps -- name: ...IS BEGINNING ================================== +- name: ...IS BEGINNING ======================================== command: echo - name: KALITE @@ -38,7 +38,7 @@ when: sugarizer_install tags: sugarizer -- name: Recording STAGE 7 HAS COMPLETED ================== +- name: Recording STAGE 7 HAS COMPLETED ======================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=7' From 3bd984d642b7f0195eba314cb3f605d7fb9000bb Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:38:09 -0400 Subject: [PATCH 33/63] fill lines with ==='s --- roles/8-mgmt-tools/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/8-mgmt-tools/tasks/main.yml b/roles/8-mgmt-tools/tasks/main.yml index 91413900b..ad22382ed 100644 --- a/roles/8-mgmt-tools/tasks/main.yml +++ b/roles/8-mgmt-tools/tasks/main.yml @@ -1,6 +1,6 @@ # Assessment and Monitoring Tools -- name: ...IS BEGINNING ================================== +- name: ...IS BEGINNING ====================================== command: echo - name: AWSTATS @@ -51,7 +51,7 @@ when: xovis_install and ansible_distribution != "CentOS" tags: xovis -- name: Recording STAGE 8 HAS COMPLETED ================== +- name: Recording STAGE 8 HAS COMPLETED ====================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=8' From 6684c0a02426730a922f4c6866d44eded56a365a Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:39:35 -0400 Subject: [PATCH 34/63] fill lines with ==='s --- roles/9-local-addons/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/9-local-addons/tasks/main.yml b/roles/9-local-addons/tasks/main.yml index f518d6c81..3a13a1b37 100644 --- a/roles/9-local-addons/tasks/main.yml +++ b/roles/9-local-addons/tasks/main.yml @@ -1,9 +1,9 @@ # Local Add-ons -- name: ...IS BEGINNING ============================= +- name: ...IS BEGINNING ==================================== command: echo -- name: Recording STAGE 9 HAS COMPLETED ============= +- name: Recording STAGE 9 HAS COMPLETED ==================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=9' From 68cdd43698ad18e7d0ca1a29851b4fe8e42719bb Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:42:30 -0400 Subject: [PATCH 35/63] Update main.yml --- roles/3-base-server/tasks/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/3-base-server/tasks/main.yml b/roles/3-base-server/tasks/main.yml index b77c032ef..877ab58e4 100644 --- a/roles/3-base-server/tasks/main.yml +++ b/roles/3-base-server/tasks/main.yml @@ -34,4 +34,3 @@ regexp='^STAGE=*' line='STAGE=3' state=present - From 4f74be6d3c7557e1343804cefa0540af5304e625 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:29:49 -0400 Subject: [PATCH 36/63] fill lines with ==='s --- roles/1-prep/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/1-prep/tasks/main.yml b/roles/1-prep/tasks/main.yml index 84ae926eb..fea4ea34f 100644 --- a/roles/1-prep/tasks/main.yml +++ b/roles/1-prep/tasks/main.yml @@ -1,6 +1,6 @@ # Preparations (Hardware Level) -- name: ...IS BEGINNING ================================== +- name: ...IS BEGINNING ============================================ command: echo - name: Get the uuidgen program @@ -89,7 +89,7 @@ when: first_run and usb_NUC6.stdout|int > 0 # this script can be sourced to get IIAB location -- name: Recording STAGE 1 HAS COMPLETED ================== +- name: Recording STAGE 1 HAS COMPLETED ============================ template: src=roles/1-prep/templates/iiab.env.j2 dest=/etc/iiab/iiab.env owner=root From b6386dffb8c332abb11a7426ca4f43772de00841 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:31:16 -0400 Subject: [PATCH 37/63] fill lines with ==='s --- roles/2-common/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/2-common/tasks/main.yml b/roles/2-common/tasks/main.yml index acaacc99f..c7af19941 100644 --- a/roles/2-common/tasks/main.yml +++ b/roles/2-common/tasks/main.yml @@ -1,6 +1,6 @@ # Common OS-Level Additions & Mods (that only need to be performed once) -- name: ...IS BEGINNING ================================== +- name: ...IS BEGINNING ========================================== command: echo #- include: iiab_ini.yml @@ -48,7 +48,7 @@ - include: udev.yml -- name: Recording STAGE 2 HAS COMPLETED ================== +- name: Recording STAGE 2 HAS COMPLETED ========================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=2' From 49c53759e510e79c50161b0a4c46ff7326ddbe20 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:32:31 -0400 Subject: [PATCH 38/63] fill lines with ==='s --- roles/3-base-server/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/3-base-server/tasks/main.yml b/roles/3-base-server/tasks/main.yml index e59553e9e..b77c032ef 100644 --- a/roles/3-base-server/tasks/main.yml +++ b/roles/3-base-server/tasks/main.yml @@ -1,5 +1,5 @@ # Base Server -- name: ...IS BEGINNING ================================== +- name: ...IS BEGINNING ===================================== command: echo - name: HTTPD @@ -29,7 +29,7 @@ state=restarted when: not installing -- name: Record STAGE 3 HAS COMPLETED ===================== +- name: Record STAGE 3 HAS COMPLETED ======================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=3' From c6597658738ea8916179574edc1b7c96bebc937e Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:34:22 -0400 Subject: [PATCH 39/63] fill lines with ==='s --- roles/5-xo-services/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/5-xo-services/tasks/main.yml b/roles/5-xo-services/tasks/main.yml index bc9c20653..58b750908 100644 --- a/roles/5-xo-services/tasks/main.yml +++ b/roles/5-xo-services/tasks/main.yml @@ -1,5 +1,5 @@ # XO Services -- name: ...IS BEGINNING ================================== +- name: ...IS BEGINNING ===================================== command: echo - name: ACTIVITY-SERVER @@ -20,7 +20,7 @@ when: idmgr_install tags: olpc, idmgr -- name: Recording STAGE 5 HAS COMPLETED ================== +- name: Recording STAGE 5 HAS COMPLETED ===================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=5' From 7330b9159e1b1e85d340b42f3a8cbac17f411a47 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:35:28 -0400 Subject: [PATCH 40/63] fill lines with ==='s --- roles/6-generic-apps/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/6-generic-apps/tasks/main.yml b/roles/6-generic-apps/tasks/main.yml index 9cf53a700..9c4113fc1 100644 --- a/roles/6-generic-apps/tasks/main.yml +++ b/roles/6-generic-apps/tasks/main.yml @@ -1,5 +1,5 @@ # Generic Apps -- name: ...IS BEGINNING ================================== +- name: ...IS BEGINNING ==================================== command: echo - name: CALIBRE @@ -44,7 +44,7 @@ when: wordpress_install tags: wordpress -- name: Recording STAGE 6 HAS COMPLETED ================== +- name: Recording STAGE 6 HAS COMPLETED ==================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=6' From f6d7357610bcae2dd3f640075b0720f3f736a7c6 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:37:06 -0400 Subject: [PATCH 41/63] fill lines with ==='s --- roles/7-edu-apps/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/7-edu-apps/tasks/main.yml b/roles/7-edu-apps/tasks/main.yml index ee98a0d2d..5f7f081d9 100644 --- a/roles/7-edu-apps/tasks/main.yml +++ b/roles/7-edu-apps/tasks/main.yml @@ -1,5 +1,5 @@ # Educational Apps -- name: ...IS BEGINNING ================================== +- name: ...IS BEGINNING ======================================== command: echo - name: KALITE @@ -38,7 +38,7 @@ when: sugarizer_install tags: sugarizer -- name: Recording STAGE 7 HAS COMPLETED ================== +- name: Recording STAGE 7 HAS COMPLETED ======================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=7' From da3a60ac8ac159db2fe137131af84de23f2f7314 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:38:09 -0400 Subject: [PATCH 42/63] fill lines with ==='s --- roles/8-mgmt-tools/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/8-mgmt-tools/tasks/main.yml b/roles/8-mgmt-tools/tasks/main.yml index 91413900b..ad22382ed 100644 --- a/roles/8-mgmt-tools/tasks/main.yml +++ b/roles/8-mgmt-tools/tasks/main.yml @@ -1,6 +1,6 @@ # Assessment and Monitoring Tools -- name: ...IS BEGINNING ================================== +- name: ...IS BEGINNING ====================================== command: echo - name: AWSTATS @@ -51,7 +51,7 @@ when: xovis_install and ansible_distribution != "CentOS" tags: xovis -- name: Recording STAGE 8 HAS COMPLETED ================== +- name: Recording STAGE 8 HAS COMPLETED ====================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=8' From 03fffd8c22c44a819aeca65679c7cae5d75f7ffe Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:39:35 -0400 Subject: [PATCH 43/63] fill lines with ==='s --- roles/9-local-addons/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/9-local-addons/tasks/main.yml b/roles/9-local-addons/tasks/main.yml index f518d6c81..3a13a1b37 100644 --- a/roles/9-local-addons/tasks/main.yml +++ b/roles/9-local-addons/tasks/main.yml @@ -1,9 +1,9 @@ # Local Add-ons -- name: ...IS BEGINNING ============================= +- name: ...IS BEGINNING ==================================== command: echo -- name: Recording STAGE 9 HAS COMPLETED ============= +- name: Recording STAGE 9 HAS COMPLETED ==================== lineinfile: dest=/etc/iiab/iiab.env regexp='^STAGE=*' line='STAGE=9' From c521520410430ea80bb8e9903d8f1e2fc9347051 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:42:30 -0400 Subject: [PATCH 44/63] Update main.yml --- roles/3-base-server/tasks/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/3-base-server/tasks/main.yml b/roles/3-base-server/tasks/main.yml index b77c032ef..877ab58e4 100644 --- a/roles/3-base-server/tasks/main.yml +++ b/roles/3-base-server/tasks/main.yml @@ -34,4 +34,3 @@ regexp='^STAGE=*' line='STAGE=3' state=present - From 27c74077c30b0301a79543fdf884f606524c053d Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:56:52 -0400 Subject: [PATCH 45/63] role: -> include_role: avoid pages of spam output --- iiab-steps.yml | 78 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 20 deletions(-) diff --git a/iiab-steps.yml b/iiab-steps.yml index 66c97721c..b514c3dc0 100644 --- a/iiab-steps.yml +++ b/iiab-steps.yml @@ -7,23 +7,61 @@ - vars/{{ ansible_local.local_facts.os_ver }}.yml - vars/local_vars.yml - roles: - - { role: 0-init, tags: ['0-init'] } - - { role: 1-prep, tags: ['1-prep','platform','base'], - when: ansible_local.local_facts.stage|int < 1 } - - { role: 2-common, tags: ['2-common','base'], - when: ansible_local.local_facts.stage|int < 2 } - - { role: 3-base-server, tags: ['3-base-server','base'], - when: ansible_local.local_facts.stage|int < 3 } - - { role: 4-server-options, tags: ['4-server-options'], - when: ansible_local.local_facts.stage|int < 4 } - - { role: 5-xo-services, tags: ['5-xo-services'], - when: ansible_local.local_facts.stage|int < 5 } - - { role: 6-generic-apps, tags: ['6-generic-apps'], - when: ansible_local.local_facts.stage|int < 6 } - - { role: 7-edu-apps, tags: ['7-edu-apps'], - when: ansible_local.local_facts.stage|int < 7 } - - { role: 8-mgmt-tools, tags: ['8-mgmt-tools'], - when: ansible_local.local_facts.stage|int < 8 } - - { role: 9-local-addons, tags: ['9-local-addons'], - when: ansible_local.local_facts.stage|int < 9 } + name: 0-init + include_role: + name: 0-init + tags: 0-init + + name: 1-prep + include_role: + name: 1-prep + when: ansible_local.local_facts.stage|int < 1 + tags: 1-prep, platform, base + + name: 2-common + include_role: + name: 2-common + when: ansible_local.local_facts.stage|int < 2 + tags: 2-common, base + + name: 3-base-server + include_role: + name: 3-base-server + when: ansible_local.local_facts.stage|int < 3 + tags: 3-base-server, base + + name: 4-server-options + include_role: + name: 4-server-options + when: ansible_local.local_facts.stage|int < 4 + tags: 4-server-options + + name: 5-xo-services + include_role: + name: 5-xo-services + when: ansible_local.local_facts.stage|int < 5 + tags: 5-xo-services + + name: 6-generic-apps + include_role: + name: 6-generic-apps + when: ansible_local.local_facts.stage|int < 6 + tags: 6-generic-apps + + name: 7-edu-apps + include_role: + name: 7-edu-apps + when: ansible_local.local_facts.stage|int < 7 + tags: 7-edu-apps + + name: 8-mgmt-tools + include_role: + name: 8-mgmt-tools + when: ansible_local.local_facts.stage|int < 8 + tags: 8-mgmt-tools + + name: 9-local-addons + include_role: + name: 9-local-addons + when: ansible_local.local_facts.stage|int < 9 + tags: 9-local-addons From f2cb3537272a949495ce13b1e9d3166f4e7ec35d Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 17:12:19 -0400 Subject: [PATCH 46/63] dashes added --- iiab-steps.yml | 98 +++++++++++++++++++++++++------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/iiab-steps.yml b/iiab-steps.yml index b514c3dc0..de325bd59 100644 --- a/iiab-steps.yml +++ b/iiab-steps.yml @@ -7,61 +7,61 @@ - vars/{{ ansible_local.local_facts.os_ver }}.yml - vars/local_vars.yml - name: 0-init - include_role: - name: 0-init - tags: 0-init + - name: 0-init + include_role: + name: 0-init + tags: 0-init - name: 1-prep - include_role: - name: 1-prep - when: ansible_local.local_facts.stage|int < 1 - tags: 1-prep, platform, base + - name: 1-prep + include_role: + name: 1-prep + when: ansible_local.local_facts.stage|int < 1 + tags: 1-prep, platform, base - name: 2-common - include_role: - name: 2-common - when: ansible_local.local_facts.stage|int < 2 - tags: 2-common, base + - name: 2-common + include_role: + name: 2-common + when: ansible_local.local_facts.stage|int < 2 + tags: 2-common, base - name: 3-base-server - include_role: - name: 3-base-server - when: ansible_local.local_facts.stage|int < 3 - tags: 3-base-server, base + - name: 3-base-server + include_role: + name: 3-base-server + when: ansible_local.local_facts.stage|int < 3 + tags: 3-base-server, base - name: 4-server-options - include_role: - name: 4-server-options - when: ansible_local.local_facts.stage|int < 4 - tags: 4-server-options + - name: 4-server-options + include_role: + name: 4-server-options + when: ansible_local.local_facts.stage|int < 4 + tags: 4-server-options - name: 5-xo-services - include_role: - name: 5-xo-services - when: ansible_local.local_facts.stage|int < 5 - tags: 5-xo-services + - name: 5-xo-services + include_role: + name: 5-xo-services + when: ansible_local.local_facts.stage|int < 5 + tags: 5-xo-services - name: 6-generic-apps - include_role: - name: 6-generic-apps - when: ansible_local.local_facts.stage|int < 6 - tags: 6-generic-apps + - name: 6-generic-apps + include_role: + name: 6-generic-apps + when: ansible_local.local_facts.stage|int < 6 + tags: 6-generic-apps - name: 7-edu-apps - include_role: - name: 7-edu-apps - when: ansible_local.local_facts.stage|int < 7 - tags: 7-edu-apps + - name: 7-edu-apps + include_role: + name: 7-edu-apps + when: ansible_local.local_facts.stage|int < 7 + tags: 7-edu-apps - name: 8-mgmt-tools - include_role: - name: 8-mgmt-tools - when: ansible_local.local_facts.stage|int < 8 - tags: 8-mgmt-tools + - name: 8-mgmt-tools + include_role: + name: 8-mgmt-tools + when: ansible_local.local_facts.stage|int < 8 + tags: 8-mgmt-tools - name: 9-local-addons - include_role: - name: 9-local-addons - when: ansible_local.local_facts.stage|int < 9 - tags: 9-local-addons + - name: 9-local-addons + include_role: + name: 9-local-addons + when: ansible_local.local_facts.stage|int < 9 + tags: 9-local-addons From 614a0e6c29f94aa6c754220e5601be2fa091032e Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 20:45:52 -0400 Subject: [PATCH 47/63] roles: -> tasks: for dynamic execution Since Ansible 2.3 / 2.4 per https://docs.ansible.com/ansible/2.4/playbooks_reuse_roles.html --- iiab-steps.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/iiab-steps.yml b/iiab-steps.yml index de325bd59..834dce951 100644 --- a/iiab-steps.yml +++ b/iiab-steps.yml @@ -7,6 +7,7 @@ - vars/{{ ansible_local.local_facts.os_ver }}.yml - vars/local_vars.yml + tasks: - name: 0-init include_role: name: 0-init From 1a020cedd3d92c9faac0c68067ccd1dc18dc6c45 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 20:46:43 -0400 Subject: [PATCH 48/63] Update iiab-steps.yml --- iiab-steps.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/iiab-steps.yml b/iiab-steps.yml index 834dce951..ce27ec00c 100644 --- a/iiab-steps.yml +++ b/iiab-steps.yml @@ -8,6 +8,7 @@ - vars/local_vars.yml tasks: + - name: 0-init include_role: name: 0-init From 2877d8f06c9e78ed1be645b5b250cc57ade9bf6f Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 21:05:43 -0400 Subject: [PATCH 49/63] roles: -> tasks: for dynamic execution (avoids pages of "skipping") --- iiab-steps.yml | 80 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 60 insertions(+), 20 deletions(-) diff --git a/iiab-steps.yml b/iiab-steps.yml index 66c97721c..ce27ec00c 100644 --- a/iiab-steps.yml +++ b/iiab-steps.yml @@ -7,23 +7,63 @@ - vars/{{ ansible_local.local_facts.os_ver }}.yml - vars/local_vars.yml - roles: - - { role: 0-init, tags: ['0-init'] } - - { role: 1-prep, tags: ['1-prep','platform','base'], - when: ansible_local.local_facts.stage|int < 1 } - - { role: 2-common, tags: ['2-common','base'], - when: ansible_local.local_facts.stage|int < 2 } - - { role: 3-base-server, tags: ['3-base-server','base'], - when: ansible_local.local_facts.stage|int < 3 } - - { role: 4-server-options, tags: ['4-server-options'], - when: ansible_local.local_facts.stage|int < 4 } - - { role: 5-xo-services, tags: ['5-xo-services'], - when: ansible_local.local_facts.stage|int < 5 } - - { role: 6-generic-apps, tags: ['6-generic-apps'], - when: ansible_local.local_facts.stage|int < 6 } - - { role: 7-edu-apps, tags: ['7-edu-apps'], - when: ansible_local.local_facts.stage|int < 7 } - - { role: 8-mgmt-tools, tags: ['8-mgmt-tools'], - when: ansible_local.local_facts.stage|int < 8 } - - { role: 9-local-addons, tags: ['9-local-addons'], - when: ansible_local.local_facts.stage|int < 9 } + tasks: + + - name: 0-init + include_role: + name: 0-init + tags: 0-init + + - name: 1-prep + include_role: + name: 1-prep + when: ansible_local.local_facts.stage|int < 1 + tags: 1-prep, platform, base + + - name: 2-common + include_role: + name: 2-common + when: ansible_local.local_facts.stage|int < 2 + tags: 2-common, base + + - name: 3-base-server + include_role: + name: 3-base-server + when: ansible_local.local_facts.stage|int < 3 + tags: 3-base-server, base + + - name: 4-server-options + include_role: + name: 4-server-options + when: ansible_local.local_facts.stage|int < 4 + tags: 4-server-options + + - name: 5-xo-services + include_role: + name: 5-xo-services + when: ansible_local.local_facts.stage|int < 5 + tags: 5-xo-services + + - name: 6-generic-apps + include_role: + name: 6-generic-apps + when: ansible_local.local_facts.stage|int < 6 + tags: 6-generic-apps + + - name: 7-edu-apps + include_role: + name: 7-edu-apps + when: ansible_local.local_facts.stage|int < 7 + tags: 7-edu-apps + + - name: 8-mgmt-tools + include_role: + name: 8-mgmt-tools + when: ansible_local.local_facts.stage|int < 8 + tags: 8-mgmt-tools + + - name: 9-local-addons + include_role: + name: 9-local-addons + when: ansible_local.local_facts.stage|int < 9 + tags: 9-local-addons From e5aa9652635e7bf6b5ad518a9dd56c528d565091 Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 21:58:29 -0400 Subject: [PATCH 50/63] tweak iiab-install's annc of which stage it's continuing with --- iiab-install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iiab-install b/iiab-install index 52f4575ca..086c86775 100755 --- a/iiab-install +++ b/iiab-install @@ -30,7 +30,7 @@ else echo "Entering debug mode" sed -i -e 's/^STAGE=.*/STAGE=2/' /etc/iiab/iiab.env elif [ ! $STAGE == 9 ]; then - echo "Restarting from STAGE $STAGE" + echo "Restarting *after* STAGE $STAGE (as soon as Stage 0 completes..Stage 9 will be last)" else # place keeper add read response # "offer 'Y' or stage number dialog box option to override" From 6187612355a71f7c4e973180ce9696810403a7d3 Mon Sep 17 00:00:00 2001 From: Adam Holt Date: Mon, 30 Oct 2017 23:55:24 -0400 Subject: [PATCH 51/63] 56 changes to include_tasks --- roles/0-init/tasks/main.yml | 4 +-- roles/1-prep/tasks/main.yml | 4 +-- roles/2-common/tasks/main.yml | 16 +++++------ roles/ajenti/tasks/main.yml | 2 +- roles/awstats/tasks/main.yml | 2 +- roles/dokuwiki/tasks/main.yml | 2 +- roles/httpd/tasks/main.yml | 2 +- roles/iiab-admin/tasks/main.yml | 4 +-- roles/kalite/tasks/main.yml | 10 +++---- roles/kiwix/tasks/main.yml | 2 +- roles/mysql/tasks/main.yml | 4 +-- roles/network/tasks/detected_network.yml | 2 +- roles/network/tasks/ifcfg_mods.yml | 8 +++--- roles/network/tasks/main.yml | 34 ++++++++++++------------ roles/network/tasks/squid.yml | 2 +- roles/network/tasks/static.yml | 2 +- roles/nextcloud/tasks/main.yml | 2 +- roles/owncloud/tasks/main.yml | 2 +- roles/rachel/tasks/main.yml | 2 +- roles/sugar-stats/tasks/main.yml | 2 +- roles/teamviewer/tasks/main.yml | 2 +- roles/wordpress/tasks/main.yml | 2 +- 22 files changed, 56 insertions(+), 56 deletions(-) diff --git a/roles/0-init/tasks/main.yml b/roles/0-init/tasks/main.yml index 31e8e2054..e7351e158 100644 --- a/roles/0-init/tasks/main.yml +++ b/roles/0-init/tasks/main.yml @@ -14,10 +14,10 @@ # we need to inialize the ini file and only write the location and version sections once and only # once to preserve the install date and git hash. -- include: roles/1-prep/tasks/iiab_ini.yml +- include_tasks: roles/1-prep/tasks/iiab_ini.yml when: first_run # Now load the computed vars -- include: roles/1-prep/tasks/computed_vars.yml +- include_tasks: roles/1-prep/tasks/computed_vars.yml - name: ...HAS COMPLETED =========================================== command: echo diff --git a/roles/1-prep/tasks/main.yml b/roles/1-prep/tasks/main.yml index fea4ea34f..a96e281f6 100644 --- a/roles/1-prep/tasks/main.yml +++ b/roles/1-prep/tasks/main.yml @@ -70,11 +70,11 @@ when: ansible_local.local_facts.os == "raspbian" ignore_errors: true -- include: prep.yml +- include_tasks: prep.yml when: first_run # Put conditional actions for hardware platforms here -- include: raspberry_pi_2.yml +- include_tasks: raspberry_pi_2.yml when: first_run and rpi_model != "none" - name: Check if the identifier for Intel's NUC6 builtin WiFi is present diff --git a/roles/2-common/tasks/main.yml b/roles/2-common/tasks/main.yml index c7af19941..ec15dcee5 100644 --- a/roles/2-common/tasks/main.yml +++ b/roles/2-common/tasks/main.yml @@ -3,22 +3,22 @@ - name: ...IS BEGINNING ========================================== command: echo -#- include: iiab_ini.yml +#- include_tasks: iiab_ini.yml # create the directory structure for IIAB -- include: fl.yml +- include_tasks: fl.yml -- include: xo.yml +- include_tasks: xo.yml when: xo_model != "none" or osbuilder is defined -- include: centos.yml +- include_tasks: centos.yml when: ansible_distribution == "CentOS" -- include: fedora.yml +- include_tasks: fedora.yml when: ansible_distribution == "Fedora" # the following installs common packages for both debian and fedora -- include: packages.yml +- include_tasks: packages.yml - sysctl: name=net.ipv4.ip_forward value=1 state=present - sysctl: name=net.ipv4.conf.default.rp_filter value=1 state=present @@ -43,10 +43,10 @@ mode=0644 backup=no -- include: net_mods.yml +- include_tasks: net_mods.yml when: not is_debuntu and not is_F18 -- include: udev.yml +- include_tasks: udev.yml - name: Recording STAGE 2 HAS COMPLETED ========================== lineinfile: dest=/etc/iiab/iiab.env diff --git a/roles/ajenti/tasks/main.yml b/roles/ajenti/tasks/main.yml index 93f7bacd0..789afbf31 100644 --- a/roles/ajenti/tasks/main.yml +++ b/roles/ajenti/tasks/main.yml @@ -37,7 +37,7 @@ mode=0744 state=file -- include: ajenti-wondershaper.yml +- include_tasks: ajenti-wondershaper.yml when: 'iiab_lan_iface != ""' # handler doesn't fire diff --git a/roles/awstats/tasks/main.yml b/roles/awstats/tasks/main.yml index f1feed18c..8a9cd37e3 100644 --- a/roles/awstats/tasks/main.yml +++ b/roles/awstats/tasks/main.yml @@ -1,4 +1,4 @@ -- include: install.yml +- include_tasks: install.yml when: awstats_install - name: Add AWStats to service list diff --git a/roles/dokuwiki/tasks/main.yml b/roles/dokuwiki/tasks/main.yml index 9841a32b6..5b2d738ce 100644 --- a/roles/dokuwiki/tasks/main.yml +++ b/roles/dokuwiki/tasks/main.yml @@ -1,5 +1,5 @@ - name: Include the install playbook - include: install.yml + include_tasks: install.yml when: dokuwiki_install - name: Add DokuWiki to service list diff --git a/roles/httpd/tasks/main.yml b/roles/httpd/tasks/main.yml index 2eb71b8ce..4319e141b 100644 --- a/roles/httpd/tasks/main.yml +++ b/roles/httpd/tasks/main.yml @@ -142,7 +142,7 @@ state=absent when: is_debuntu -- include: html.yml +- include_tasks: html.yml tags: - base diff --git a/roles/iiab-admin/tasks/main.yml b/roles/iiab-admin/tasks/main.yml index 4541f4027..5f609238b 100644 --- a/roles/iiab-admin/tasks/main.yml +++ b/roles/iiab-admin/tasks/main.yml @@ -1,9 +1,9 @@ -- include: admin-user.yml +- include_tasks: admin-user.yml tags: - base when: not no_admin is defined -- include: access.yml +- include_tasks: access.yml tags: - base diff --git a/roles/kalite/tasks/main.yml b/roles/kalite/tasks/main.yml index b0c02471d..74dd9229b 100644 --- a/roles/kalite/tasks/main.yml +++ b/roles/kalite/tasks/main.yml @@ -16,23 +16,23 @@ stat: path="{{ kalite_db_name }}" register: kalite_installed -- include: install-f18.yml +- include_tasks: install-f18.yml when: not kalite_installed.stat.exists and is_F18 -- include: install.yml +- include_tasks: install.yml when: kalite_installed is defined and not kalite_installed.stat.exists and not is_F18 - name: Ask systemd to reread the unit files shell: systemctl daemon-reload when: not kalite_installed.stat.exists -- include: setup-f18.yml +- include_tasks: setup-f18.yml when: not kalite_installed.stat.exists and is_F18 -- include: setup.yml +- include_tasks: setup.yml when: not kalite_installed.stat.exists and not is_F18 -- include: enable.yml +- include_tasks: enable.yml - name: Add kalite to service list ini_file: dest='{{ service_filelist }}' diff --git a/roles/kiwix/tasks/main.yml b/roles/kiwix/tasks/main.yml index c7409db31..9a1cfc2b0 100644 --- a/roles/kiwix/tasks/main.yml +++ b/roles/kiwix/tasks/main.yml @@ -20,7 +20,7 @@ get_url: url="{{ iiab_download_url }}/{{ kiwix_src_file }}" dest="{{ downloads_dir }}/{{ kiwix_src_file }}" when: internet_available -- include: kiwix_install.yml +- include_tasks: kiwix_install.yml when: kiwix_src_file is defined tags: - kiwix diff --git a/roles/mysql/tasks/main.yml b/roles/mysql/tasks/main.yml index ecc42815f..4afc6d0ab 100644 --- a/roles/mysql/tasks/main.yml +++ b/roles/mysql/tasks/main.yml @@ -45,12 +45,12 @@ tags: - download - - include: centos.yml + - include_tasks: centos.yml when: ansible_distribution == "CentOS" tags: - download - - include: fedora.yml + - include_tasks: fedora.yml when: ansible_distribution == "Fedora" tags: - download diff --git a/roles/network/tasks/detected_network.yml b/roles/network/tasks/detected_network.yml index f8e1e569a..14749388f 100644 --- a/roles/network/tasks/detected_network.yml +++ b/roles/network/tasks/detected_network.yml @@ -27,7 +27,7 @@ when: discovered_wan_iface != "none" - name: RedHat network detection - include: detected_redhat.yml + include_tasks: detected_redhat.yml when: is_redhat # WIRELESS -- if any wireless is detected as gateway, it becomes WAN diff --git a/roles/network/tasks/ifcfg_mods.yml b/roles/network/tasks/ifcfg_mods.yml index b98c9a019..fcc6df2ff 100644 --- a/roles/network/tasks/ifcfg_mods.yml +++ b/roles/network/tasks/ifcfg_mods.yml @@ -31,17 +31,17 @@ when: (num_lan_interfaces != "0" or iiab_wireless_lan_iface != "none") ## vars/ users should set user_wan_iface to avoid messy redetect -- include: redetect.yml +- include_tasks: redetect.yml when: discovered_wan_iface == "none" and user_wan_iface == "auto" # move gateway if not WAN # might have wifi info if wireless is used as uplink. -- include: edit_ifcfg.yml +- include_tasks: edit_ifcfg.yml when: has_wifi_gw == "none" and has_ifcfg_gw != "none" and has_ifcfg_gw != "/etc/sysconfig/network-scripts/ifcfg-WAN" # create ifcfg-WAN if missing # if we get here we have gateway but no ifcfg file -- include: create_ifcfg.yml +- include_tasks: create_ifcfg.yml when: iiab_wan_iface != "none" and not has_WAN and has_ifcfg_gw == "none" and xo_model == "none" and not iiab_demo_mode - name: Configuring LAN interface as iiab_lan_iface @@ -64,7 +64,7 @@ tags: - network -- include: enable_wan.yml +- include_tasks: enable_wan.yml when: not installing and not iiab_demo_mode # monitor-connection-files defaults to no with F21, F18-F20 defaults to yes diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index 0d8b2b8cc..869147c38 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -1,10 +1,10 @@ -- include: detected_network.yml +- include_tasks: detected_network.yml when: not installing tags: - network - network-discover -- include: computed_network.yml +- include_tasks: computed_network.yml when: not installing tags: - network @@ -42,41 +42,41 @@ ##### Start static ip address info for first run ##### -#- include: static.yml +#- include_tasks: static.yml # when: 'iiab_wan_iface != "none" and wan_ip != "dhcp"' ##### End static ip address info -- include: hosts.yml +- include_tasks: hosts.yml tags: - network -- include: named.yml +- include_tasks: named.yml tags: - named - network -- include: dhcpd.yml +- include_tasks: dhcpd.yml tags: - dhcpd - network -- include: squid.yml +- include_tasks: squid.yml tags: - squid - network when: squid_install -- include: wondershaper.yml +- include_tasks: wondershaper.yml tags: - wondershaper - network -- include: iptables.yml +- include_tasks: iptables.yml tags: - iptables - network -- include: avahi.yml +- include_tasks: avahi.yml tags: - network @@ -84,17 +84,17 @@ shell: systemctl daemon-reload when: not installing -- include: ifcfg_mods.yml +- include_tasks: ifcfg_mods.yml tags: - network when: is_redhat and not installing -- include: debian.yml +- include_tasks: debian.yml tags: - network when: is_debuntu and not is_rpi and not installing -- include: rpi_debian.yml +- include_tasks: rpi_debian.yml tags: - network when: is_debuntu and is_rpi and not installing @@ -110,20 +110,20 @@ tags: - network -- include: computed_services.yml +- include_tasks: computed_services.yml tags: - network -- include: enable_services.yml +- include_tasks: enable_services.yml tags: - network -- include: restart.yml +- include_tasks: restart.yml when: not installing tags: - network -- include: hostapd.yml +- include_tasks: hostapd.yml when: not installing tags: - network diff --git a/roles/network/tasks/squid.yml b/roles/network/tasks/squid.yml index 595a24e06..7b0a9388c 100644 --- a/roles/network/tasks/squid.yml +++ b/roles/network/tasks/squid.yml @@ -64,7 +64,7 @@ mode=0750 state=directory -- include: dansguardian.yml +- include_tasks: dansguardian.yml when: dansguardian_install - name: Stop Squid diff --git a/roles/network/tasks/static.yml b/roles/network/tasks/static.yml index 4168ab9a7..06ac8b391 100644 --- a/roles/network/tasks/static.yml +++ b/roles/network/tasks/static.yml @@ -4,7 +4,7 @@ template: src=network/ifcfg-WAN.j2 dest=/etc/sysconfig/network-scripts/ifcfg-WAN -- include: NM.yml +- include_tasks: NM.yml when: 'ansible_distribution_version <= "20" and wan_ip != "dhcp"' - name: Re-read network config files diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml index 06e8c9bfc..cd6b5dd9c 100644 --- a/roles/nextcloud/tasks/main.yml +++ b/roles/nextcloud/tasks/main.yml @@ -120,7 +120,7 @@ # Enable nextcloud by copying template to httpd config # following enables and disables -- include: nextcloud_enabled.yml +- include_tasks: nextcloud_enabled.yml - name: Add Nextcloud to service list ini_file: dest='{{ service_filelist }}' diff --git a/roles/owncloud/tasks/main.yml b/roles/owncloud/tasks/main.yml index 03e8fb872..12bcbdcc8 100644 --- a/roles/owncloud/tasks/main.yml +++ b/roles/owncloud/tasks/main.yml @@ -102,7 +102,7 @@ # Enable owncloud by copying template to httpd config -- include: owncloud_enabled.yml +- include_tasks: owncloud_enabled.yml when: owncloud_enabled - name: Add owncloud to service list diff --git a/roles/rachel/tasks/main.yml b/roles/rachel/tasks/main.yml index 898a212d5..f37843250 100644 --- a/roles/rachel/tasks/main.yml +++ b/roles/rachel/tasks/main.yml @@ -20,7 +20,7 @@ rachel_content_found: True when: rachel_content.stat.exists == true -- include: rachel_enabled.yml +- include_tasks: rachel_enabled.yml when: rachel_enabled and rachel_content_found - name: Add rachel to service list diff --git a/roles/sugar-stats/tasks/main.yml b/roles/sugar-stats/tasks/main.yml index c42d6ef7f..6f9f708dc 100644 --- a/roles/sugar-stats/tasks/main.yml +++ b/roles/sugar-stats/tasks/main.yml @@ -38,7 +38,7 @@ enabled=no when: not sugar_stats_enabled -- include: statistics-consolidation.yml +- include_tasks: statistics-consolidation.yml - name: Add sugar-stats to service list ini_file: dest='{{ service_filelist }}' diff --git a/roles/teamviewer/tasks/main.yml b/roles/teamviewer/tasks/main.yml index 9421a919c..7ea48de93 100644 --- a/roles/teamviewer/tasks/main.yml +++ b/roles/teamviewer/tasks/main.yml @@ -5,7 +5,7 @@ when: ansible_architecture == "armv7l" or not is_redhat - name: Install Teamviewer if intel - include: install.yml + include_tasks: install.yml when: teamviewer_install - name: Add teamviewer to service list diff --git a/roles/wordpress/tasks/main.yml b/roles/wordpress/tasks/main.yml index db4eb2c53..4a77b45f8 100644 --- a/roles/wordpress/tasks/main.yml +++ b/roles/wordpress/tasks/main.yml @@ -1,3 +1,3 @@ - name: Include the install playbook - include: install.yml + include_tasks: install.yml when: wordpress_install \ No newline at end of file From e3e1ecd1db15a85e4bfa77e94ca63dc6dca0517e Mon Sep 17 00:00:00 2001 From: A Holt Date: Tue, 31 Oct 2017 00:45:45 -0400 Subject: [PATCH 52/63] "Restarting *after* STAGE.." clarified --- iiab-install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iiab-install b/iiab-install index 086c86775..934885fe1 100755 --- a/iiab-install +++ b/iiab-install @@ -30,7 +30,7 @@ else echo "Entering debug mode" sed -i -e 's/^STAGE=.*/STAGE=2/' /etc/iiab/iiab.env elif [ ! $STAGE == 9 ]; then - echo "Restarting *after* STAGE $STAGE (as soon as Stage 0 completes..Stage 9 will be last)" + echo "Restarting *after* STAGE $STAGE..as soon as Stage 0 completes. Stage 9 comes last." else # place keeper add read response # "offer 'Y' or stage number dialog box option to override" From fccf3c63122781cfbf05f2d69a8e4c6c0b291e36 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 8 Oct 2017 14:42:55 -0500 Subject: [PATCH 53/63] move hostname handling from network role --- roles/1-prep/tasks/computed_vars.yml | 9 ++++++ roles/2-common/tasks/hostname.yml | 11 ++++++++ roles/2-common/tasks/main.yml | 7 +++++ roles/network/tasks/detected_network.yml | 11 -------- roles/network/tasks/main.yml | 35 +++--------------------- 5 files changed, 31 insertions(+), 42 deletions(-) create mode 100644 roles/2-common/tasks/hostname.yml diff --git a/roles/1-prep/tasks/computed_vars.yml b/roles/1-prep/tasks/computed_vars.yml index 28ba861d6..bbd7b8091 100644 --- a/roles/1-prep/tasks/computed_vars.yml +++ b/roles/1-prep/tasks/computed_vars.yml @@ -47,6 +47,15 @@ file: path=/tmp/heart-beat.txt state=absent +- name: no prior domain name + set_fact: + iiab_domain: "{{ iiab_domain }}" + iiab_hostname: "{{ iiab_hostname }}" + +# Now check FQDN +- include: roles/2-common/tasks/hostname.yml + when: not first_run and "iiab_hostname.iiab_domain" != ansible_fqdn + # Put all computed vars here so derive properly from any prior var file - name: If the TZ is not set in env, set it to UTC set_fact: local_tz='UTC' diff --git a/roles/2-common/tasks/hostname.yml b/roles/2-common/tasks/hostname.yml new file mode 100644 index 000000000..a3ae16870 --- /dev/null +++ b/roles/2-common/tasks/hostname.yml @@ -0,0 +1,11 @@ +- name: turn the crank for systemd + shell: hostnamectl set-hostname "{{ iiab_hostname }}.{{ iiab_domain }}" + when: is_debuntu + +- name: Configure /etc/sysconfig/network + template: src=roles/network/templates/network/sysconfig.network.j2 + dest=/etc/sysconfig/network + owner=root + group=root + mode=0644 + when: is_redhat diff --git a/roles/2-common/tasks/main.yml b/roles/2-common/tasks/main.yml index ec15dcee5..f7c0cc95b 100644 --- a/roles/2-common/tasks/main.yml +++ b/roles/2-common/tasks/main.yml @@ -11,6 +11,13 @@ - include_tasks: xo.yml when: xo_model != "none" or osbuilder is defined +# set FQDN for IIAB +- include_tasks: hostname.yml + tags: + - network + - domain + - hostname + - include_tasks: centos.yml when: ansible_distribution == "CentOS" diff --git a/roles/network/tasks/detected_network.yml b/roles/network/tasks/detected_network.yml index 14749388f..1f51e039e 100644 --- a/roles/network/tasks/detected_network.yml +++ b/roles/network/tasks/detected_network.yml @@ -1,14 +1,3 @@ -- name: Checking iiab_domain_name - shell: "cat /etc/sysconfig/iiab_domain_name" - register: prior_domain - when: not first_run - -# above always registers -- name: Checking for prior domain name - set_fact: - iiab_domain: "{{ prior_domain.stdout }}" - when: not first_run and prior_domain.stdout != "lan" and prior_domain.stdout != "" - - name: iiab_wan_device shell: "cat /etc/sysconfig/iiab_wan_device" register: prior_gw diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index 869147c38..725faa361 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -10,37 +10,6 @@ - network - network-discover -- name: Set hostname - template: dest=/etc/hostname - src=network/hostname.j2 - owner=root - mode=0644 - tags: - - network - - domain - -- name: Configure /etc/sysconfig/network - template: src=network/sysconfig.network.j2 - dest=/etc/sysconfig/network - owner=root - group=root - mode=0644 - tags: - - network - - domain - -- name: Create iiab_domain_name flag - template: src=network/{{ item }}.j2 - dest=/etc/sysconfig/{{ item }} - mode=0644 - with_items: - - iiab_domain_name - register: domainname - tags: - - network - - domain - - ##### Start static ip address info for first run ##### #- include_tasks: static.yml # when: 'iiab_wan_iface != "none" and wan_ip != "dhcp"' @@ -49,16 +18,20 @@ - include_tasks: hosts.yml tags: - network + - hostname + - domain - include_tasks: named.yml tags: - named - network + - domain - include_tasks: dhcpd.yml tags: - dhcpd - network + - domain - include_tasks: squid.yml tags: From c3b9067ffeab5391102f5ab288c1fe7a9b8ca6b0 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 15 Oct 2017 15:08:08 -0500 Subject: [PATCH 54/63] backport of 46c36b3e3542ffe5609ab5cc10a60de7335d6cd9 backport of c837cde92304cfaf4a44c31dfb40bbadfd05fe04 backport of a0102669d2d842163d17d61e254dbd0ba8a3ea92 touch up backport of a55c0555b6fb92a6b6b239a9dce2fde2100e7ae5 --- roles/1-prep/tasks/computed_vars.yml | 51 +++++++++++++++++-- roles/network/tasks/detected_network.yml | 4 +- roles/network/tasks/enable_services.yml | 14 +++-- roles/network/tasks/main.yml | 23 ++++++--- .../templates/gateway/iiab-gen-iptables | 9 ++-- 5 files changed, 79 insertions(+), 22 deletions(-) diff --git a/roles/1-prep/tasks/computed_vars.yml b/roles/1-prep/tasks/computed_vars.yml index bbd7b8091..f9fb64852 100644 --- a/roles/1-prep/tasks/computed_vars.yml +++ b/roles/1-prep/tasks/computed_vars.yml @@ -47,14 +47,51 @@ file: path=/tmp/heart-beat.txt state=absent -- name: no prior domain name +- name: set FQDN set_fact: - iiab_domain: "{{ iiab_domain }}" - iiab_hostname: "{{ iiab_hostname }}" + iiab_fqdn: "{{ iiab_hostname }}.{{ iiab_domain }}" + FQDN_changed: False + +- name: FQDN changed + set_fact: + FQDN_changed: True + when: iiab_fqdn != ansible_fqdn # Now check FQDN - include: roles/2-common/tasks/hostname.yml - when: not first_run and "iiab_hostname.iiab_domain" != ansible_fqdn + when: not first_run and FQDN_changed + +# Discover do we have a gateway? -- if ansible detects gateway, becomes WAN candidate +- name: Finding gateway + set_fact: + discovered_wan_iface: "{{ ansible_default_ipv4.alias }}" + when: 'ansible_default_ipv4.gateway is defined' + +- name: Verify gateway present + shell: ping -c4 "{{ ansible_default_ipv4.gateway }}" &> /dev/null ; echo $? + when: discovered_wan_iface != "none" + register: gw_active_test + +- name: Recording gateway response + set_fact: + gw_active: True + when: discovered_wan_iface != "none" and gw_active_test.stdout == "0" + +- name: Test for internet access + get_url: url="{{ iiab_download_url }}/heart-beat.txt" dest=/tmp/heart-beat.txt + ignore_errors: True +# async: 10 +# poll: 2 + register: internet_access_test + +- name: Set internet_available true if wget succeeded + set_fact: + internet_available: True + when: not internet_access_test|failed and not disregard_network + +- name: Cleanup internet test file + file: path=/tmp/heart-beat.txt + state=absent # Put all computed vars here so derive properly from any prior var file - name: If the TZ is not set in env, set it to UTC @@ -190,3 +227,9 @@ value: '{{ gw_active }}' - option: 'internet_available' value: '{{ internet_available }}' + - option: 'first_run' + value: '{{ first_run }}' + - option: 'local_tz' + value: '{{ local_tz }}' + - option: 'FQDN_changed' + value: '{{ FQDN_changed }}' diff --git a/roles/network/tasks/detected_network.yml b/roles/network/tasks/detected_network.yml index 1f51e039e..e38c68411 100644 --- a/roles/network/tasks/detected_network.yml +++ b/roles/network/tasks/detected_network.yml @@ -1,7 +1,7 @@ - name: iiab_wan_device - shell: "cat /etc/sysconfig/iiab_wan_device" - register: prior_gw + shell: grep IIAB_WAN_DEVICE /etc/iiab/iiab.env | awk -F "=" '{print $2}' when: not first_run + register: prior_gw - name: Checking for old device gateway interface for device test set_fact: diff --git a/roles/network/tasks/enable_services.yml b/roles/network/tasks/enable_services.yml index 308a3056f..a23dddab4 100644 --- a/roles/network/tasks/enable_services.yml +++ b/roles/network/tasks/enable_services.yml @@ -50,9 +50,11 @@ when: not dansguardian_enabled and dansguardian_install - name: Create xs_httpcache flag - shell: echo 1 > /etc/sysconfig/xs_httpcache_on - creates=/etc/sysconfig/xs_httpcache_on - when: squid_enabled + lineinfile: dest=/etc/iiab/iiab.env + regexp='^HTTPCACHE_ON=*' + line='HTTPCACHE_ON=True' + state=present + when: squid_enabled and squid_install - name: Enable Squid service service: name={{ proxy }} @@ -85,8 +87,10 @@ when: not squid_enabled and squid_install - name: Remove xs_httpcache flag - file: path=/etc/sysconfig/xs_httpcache_on - state=absent + lineinfile: dest=/etc/iiab/iiab.env + regexp='^HTTPCACHE_ON=*' + line='HTTPCACHE_ON=False' + state=present when: not squid_enabled - name: Enable Wondershaper service diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index 725faa361..b21af9868 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -72,17 +72,26 @@ - network when: is_debuntu and is_rpi and not installing -- name: Create IIAB network flags - template: src=network/{{ item }}.j2 - dest=/etc/sysconfig/{{ item }} - mode=0644 - with_items: - - iiab_wan_device - - iiab_lan_device +- name: Record iiab_wan_device + lineinfile: dest=/etc/iiab/iiab.env + regexp='^IIAB_WAN_DEVICE=*' + line='IIAB_WAN_DEVICE="{{ iiab_wan_iface }}"' + state=present when: not installing tags: - network +- name: Record iiab_lan_device + lineinfile: dest=/etc/iiab/iiab.env + regexp='^IIAB_LAN_DEVICE=*' + line='IIAB_LAN_DEVICE="{{ iiab_lan_iface }}"' + state=present + when: not installing + tags: + - network + +#### end network layout +#### start services - include_tasks: computed_services.yml tags: - network diff --git a/roles/network/templates/gateway/iiab-gen-iptables b/roles/network/templates/gateway/iiab-gen-iptables index b45295883..ecdefc47a 100755 --- a/roles/network/templates/gateway/iiab-gen-iptables +++ b/roles/network/templates/gateway/iiab-gen-iptables @@ -1,4 +1,5 @@ #!/bin/bash -x +source /etc/iiab/iiab.env {% if is_debuntu %} IPTABLES=/sbin/iptables IPTABLES_DATA=/etc/iptables.up.rules @@ -6,8 +7,8 @@ IPTABLES_DATA=/etc/iptables.up.rules IPTABLES=/usr/sbin/iptables IPTABLES_DATA=/etc/sysconfig/iptables {% endif %} -LANIF=`cat /etc/sysconfig/iiab_lan_device` -WANIF=`cat /etc/sysconfig/iiab_wan_device` +LANIF=$IIAB_LAN_DEVICE +WANIF=$IIAB_WAN_DEVICE MODE=`grep iiab_network_mode_applied /etc/iiab/iiab.ini | gawk '{print $3}'` clear_fw() { @@ -33,7 +34,7 @@ $IPTABLES -A INPUT -p tcp --dport 5984 -j DROP $IPTABLES -A INPUT -p udp --dport 5984 -j DROP } -if [ "x$WANIF" == "x" ] || [ "$MODE" == 'Appliance' ]; then +if [ "x$WANIF" == "xnone" ] || [ "$MODE" == 'Appliance' ]; then clear_fw # save the rule set {% if is_debuntu %} @@ -112,7 +113,7 @@ if [ "$block_DNS" == "True" ];then $IPTABLES -t nat -A PREROUTING -i $lan -p udp --dport 53 ! -d {{ lan_ip }} -j DNAT --to {{ lan_ip }}:53 fi -if [ -f /etc/sysconfig/xs_httpcache_on ]; then +if [ "$HTTPCACHE_ON" == "True" ]; then $IPTABLES -t nat -A PREROUTING -i $lan -p tcp --dport 80 ! -d 172.18.96.1 -j DNAT --to 172.18.96.1:3128 fi From a8764282dcae9afa8a2ef19e68a7eb1557961152 Mon Sep 17 00:00:00 2001 From: Adam Holt Date: Tue, 31 Oct 2017 03:04:04 -0400 Subject: [PATCH 55/63] use include_vars in 0-init --- 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 e7351e158..528bf3aa9 100644 --- a/roles/0-init/tasks/main.yml +++ b/roles/0-init/tasks/main.yml @@ -1,7 +1,7 @@ # Initialize - name: ...IS BEGINNING ============================================ - command: echo + include_vars: roles/1-prep/defaults/main.yml - name: Determine if runansible was run stat: path=/etc/iiab/iiab.env From 8d2a184bbb6c59842572bf6cf211aedc31bfadee Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 31 Oct 2017 05:10:46 -0400 Subject: [PATCH 56/63] move network package install --- roles/3-base-server/tasks/main.yml | 24 +++++++++++++ roles/network/tasks/dansguardian.yml | 6 ++-- roles/network/tasks/dhcpd.yml | 3 +- roles/network/tasks/enable_services.yml | 1 + roles/network/tasks/main.yml | 23 ------------- roles/network/tasks/named.yml | 46 ++++++++++++------------- roles/network/tasks/squid.yml | 14 ++++---- roles/network/tasks/wondershaper.yml | 6 ++-- 8 files changed, 62 insertions(+), 61 deletions(-) diff --git a/roles/3-base-server/tasks/main.yml b/roles/3-base-server/tasks/main.yml index 877ab58e4..6729c5597 100644 --- a/roles/3-base-server/tasks/main.yml +++ b/roles/3-base-server/tasks/main.yml @@ -20,6 +20,30 @@ # has no "when: XXXXX_install" flag tags: base, mysql +- include_tasks: roles/network/tasks/named.yml + tags: + - named + - network + - domain + +- include_tasks: roles/network/tasks/dhcpd.yml + tags: + - dhcpd + - network + - domain + +- include_tasks: roles/network/tasks/squid.yml + tags: + - squid + - network + when: squid_install + +- include_tasks: roles/network/tasks/wondershaper.yml + tags: + - wondershaper + - network + when: wondershaper_install + - name: Make sure there is a content directory file: dest={{ doc_root }}/local_content state=directory diff --git a/roles/network/tasks/dansguardian.yml b/roles/network/tasks/dansguardian.yml index 64610759d..2d4cebc40 100644 --- a/roles/network/tasks/dansguardian.yml +++ b/roles/network/tasks/dansguardian.yml @@ -7,7 +7,7 @@ - download - name: Copy DansGuardian config file - template: src=squid/dansguardian.conf.j2 + template: src=roles/network/templates/squid/dansguardian.conf.j2 dest=/etc/dansguardian/dansguardian.conf owner=dansguardian group=dansguardian @@ -15,7 +15,7 @@ when: ansible_distribution == "Fedora" - name: Copy DansGuardian config file - template: src=squid/dansguardian.conf.debian.j2 + template: src=roles/network/templates/squid/dansguardian.conf.debian.j2 dest=/etc/dansguardian/dansguardian.conf owner=dansguardian group=dansguardian @@ -23,7 +23,7 @@ when: is_debuntu - name: Copy DansGuardian config file for CentOS - template: src=squid/dansguardian.conf.centos.j2 + template: src=roles/network/templates/squid/dansguardian.conf.centos.j2 dest=/etc/dansguardian/dansguardian.conf owner=dansguardian group=vscan diff --git a/roles/network/tasks/dhcpd.yml b/roles/network/tasks/dhcpd.yml index b26ecf73c..8ef5306f3 100644 --- a/roles/network/tasks/dhcpd.yml +++ b/roles/network/tasks/dhcpd.yml @@ -23,8 +23,7 @@ group=root mode={{ item.mode }} with_items: - - { src: 'dhcp/dhcpd-iiab.conf.j2', dest: '/etc/dhcpd-iiab.conf', mode: '0644' } - - { src: 'dhcp/dhcpd.service', dest: '/etc/systemd/system/dhcpd.service', mode: '0644' } + - { src: 'roles/network/templates/dhcp/dhcpd.service', dest: '/etc/systemd/system/dhcpd.service', mode: '0644' } - name: Create dhcpd needed files command: touch /var/lib/dhcpd/dhcpd.leases diff --git a/roles/network/tasks/enable_services.yml b/roles/network/tasks/enable_services.yml index a23dddab4..59b051c64 100644 --- a/roles/network/tasks/enable_services.yml +++ b/roles/network/tasks/enable_services.yml @@ -17,6 +17,7 @@ mode={{ item.mode }} with_items: - { src: 'dhcp/dhcpd-env.j2' , dest: '/etc/sysconfig/dhcpd' , mode: '0644' } + - { src: 'dhcp/dhcpd-iiab.conf.j2', dest: '/etc/dhcpd-iiab.conf', mode: '0644' } when: dhcpd_enabled - name: Copy named file diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index b21af9868..05b7a6b18 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -21,29 +21,6 @@ - hostname - domain -- include_tasks: named.yml - tags: - - named - - network - - domain - -- include_tasks: dhcpd.yml - tags: - - dhcpd - - network - - domain - -- include_tasks: squid.yml - tags: - - squid - - network - when: squid_install - -- include_tasks: wondershaper.yml - tags: - - wondershaper - - network - - include_tasks: iptables.yml tags: - iptables diff --git a/roles/network/tasks/named.yml b/roles/network/tasks/named.yml index 182a58f88..07b58ec17 100644 --- a/roles/network/tasks/named.yml +++ b/roles/network/tasks/named.yml @@ -41,37 +41,37 @@ group=root mode={{ item.mode }} with_items: - - { src: 'named/named-iiab.conf.j2', dest: '/etc/named-iiab.conf', owner: "root" , mode: '0644' } - - { src: 'named/named.j2', dest: '/etc/sysconfig/named', owner: "root" , mode: '0644' } - - { src: 'named/named', dest: '/etc/sysconfig/olpc-scripts/domain_config.d/named', owner: "root" , mode: '0644' } - - { src: 'named/localdomain.zone', dest: '/var/named-iiab/localdomain.zone',owner: "{{ dns_user }}" , mode: '0644' } - - { src: 'named/localhost.zone', dest: '/var/named-iiab/localhost.zone', owner: "{{ dns_user }}" , mode: '0644' } - - { src: 'named/named.broadcast', dest: '/var/named-iiab/named.broadcast', owner: "{{ dns_user }}" , mode: '0644'} - - { src: 'named/named.ip6.local', dest: '/var/named-iiab/named.ip6.local' , owner: "{{ dns_user }}" , mode: '0644'} - - { src: 'named/named.local', dest: '/var/named-iiab/named.local' , owner: "{{ dns_user }}" , mode: '0644'} - - { src: 'named/named.rfc1912.zones', dest: '/var/named-iiab/named.rfc1912.zones' , owner: "{{ dns_user }}" , mode: '0644'} - - { src: 'named/named.root', dest: '/var/named-iiab/named.root' , owner: "{{ dns_user }}" , mode: '0644'} - - { src: 'named/named.root.hints', dest: '/var/named-iiab/named.root.hints' , owner: "{{ dns_user }}" , mode: '0644'} - - { src: 'named/named.zero', dest: '/var/named-iiab/named.zero' , owner: "{{ dns_user }}" , mode: '0644'} - - { src: 'named/school.external.zone.db', dest: '/var/named-iiab/school.external.zone.db' , owner: "{{ dns_user }}" , mode: '0644'} - - { src: 'named/school.internal.zone.16.in-addr.db.j2', dest: '/var/named-iiab/school.internal.zone.16.in-addr.db' , owner: "{{ dns_user }}" , mode: '0644'} - - { src: 'named/school.internal.zone.32.in-addr.db.j2', dest: '/var/named-iiab/school.internal.zone.32.in-addr.db' , owner: "{{ dns_user }}" , mode: '0644'} - - { src: 'named/school.internal.zone.48.in-addr.db.j2', dest: '/var/named-iiab/school.internal.zone.48.in-addr.db' , owner: "{{ dns_user }}" , mode: '0644'} + - { src: 'roles/network/templates/named/named-iiab.conf.j2', dest: '/etc/named-iiab.conf', owner: "root" , mode: '0644' } + - { src: 'roles/network/templates/named/named.j2', dest: '/etc/sysconfig/named', owner: "root" , mode: '0644' } + - { src: 'roles/network/templates/named/named', dest: '/etc/sysconfig/olpc-scripts/domain_config.d/named', owner: "root" , mode: '0644' } + - { src: 'roles/network/templates/named/localdomain.zone', dest: '/var/named-iiab/localdomain.zone',owner: "{{ dns_user }}" , mode: '0644' } + - { src: 'roles/network/templates/named/localhost.zone', dest: '/var/named-iiab/localhost.zone', owner: "{{ dns_user }}" , mode: '0644' } + - { src: 'roles/network/templates/named/named.broadcast', dest: '/var/named-iiab/named.broadcast', owner: "{{ dns_user }}" , mode: '0644'} + - { src: 'roles/network/templates/named/named.ip6.local', dest: '/var/named-iiab/named.ip6.local' , owner: "{{ dns_user }}" , mode: '0644'} + - { src: 'roles/network/templates/named/named.local', dest: '/var/named-iiab/named.local' , owner: "{{ dns_user }}" , mode: '0644'} + - { src: 'roles/network/templates/named/named.rfc1912.zones', dest: '/var/named-iiab/named.rfc1912.zones' , owner: "{{ dns_user }}" , mode: '0644'} + - { src: 'roles/network/templates/named/named.root', dest: '/var/named-iiab/named.root' , owner: "{{ dns_user }}" , mode: '0644'} + - { src: 'roles/network/templates/named/named.root.hints', dest: '/var/named-iiab/named.root.hints' , owner: "{{ dns_user }}" , mode: '0644'} + - { src: 'roles/network/templates/named/named.zero', dest: '/var/named-iiab/named.zero' , owner: "{{ dns_user }}" , mode: '0644'} + - { src: 'roles/network/templates/named/school.external.zone.db', dest: '/var/named-iiab/school.external.zone.db' , owner: "{{ dns_user }}" , mode: '0644'} + - { src: 'roles/network/templates/named/school.internal.zone.16.in-addr.db.j2', dest: '/var/named-iiab/school.internal.zone.16.in-addr.db' , owner: "{{ dns_user }}" , mode: '0644'} + - { src: 'roles/network/templates/named/school.internal.zone.32.in-addr.db.j2', dest: '/var/named-iiab/school.internal.zone.32.in-addr.db' , owner: "{{ dns_user }}" , mode: '0644'} + - { src: 'roles/network/templates/named/school.internal.zone.48.in-addr.db.j2', dest: '/var/named-iiab/school.internal.zone.48.in-addr.db' , owner: "{{ dns_user }}" , mode: '0644'} # the following two files are not writeable by named, but bind 9.4 cannot discover that fact correctly - - { src: 'named/school.internal.zone.db', dest: '/var/named-iiab/school.internal.zone.db' , owner: "root" , mode: '0644'} - - { src: 'named/school.local.zone.db', dest: '/var/named-iiab/school.local.zone.db' , owner: "root" , mode: '0644'} - - { src: 'named/school.internal.zone.in-addr.db.j2', dest: '/var/named-iiab/school.internal.zone.in-addr.db' , owner: "{{ dns_user }}" , mode: '0644'} - - { src: 'named/dummy', dest: '/var/named-iiab/data/dummy' , owner: "{{ dns_user }}" , mode: '0644'} - - { src: 'named/named.blackhole', dest: '/var/named-iiab/named.blackhole' , owner: "{{ dns_user }}" , mode: '0644'} + - { src: 'roles/network/templates/named/school.internal.zone.db', dest: '/var/named-iiab/school.internal.zone.db' , owner: "root" , mode: '0644'} + - { src: 'roles/network/templates/named/school.local.zone.db', dest: '/var/named-iiab/school.local.zone.db' , owner: "root" , mode: '0644'} + - { src: 'roles/network/templates/named/school.internal.zone.in-addr.db.j2', dest: '/var/named-iiab/school.internal.zone.in-addr.db' , owner: "{{ dns_user }}" , mode: '0644'} + - { src: 'roles/network/templates/named/dummy', dest: '/var/named-iiab/data/dummy' , owner: "{{ dns_user }}" , mode: '0644'} + - { src: 'roles/network/templates/named/named.blackhole', dest: '/var/named-iiab/named.blackhole' , owner: "{{ dns_user }}" , mode: '0644'} - name: Substitute our unit file which uses $OPTIONS from sysconfig - template: src=named/{{ dns_service }}.service + template: src=roles/network/templates/named/{{ dns_service }}.service dest=/etc/systemd/system/{{ dns_service }}.service mode=0644 - name: The dns-jail redirect requires the named.blackhole,disabling recursion # in named-iiab.conf, and the redirection of 404 error documents to / - template: src=named/dns-jail.conf dest=/etc/{{ apache_config_dir }}/ + template: src=roles/network/templates/named/dns-jail.conf dest=/etc/{{ apache_config_dir }}/ when: dns_jail_enabled - name: Separate enabling required for Debian diff --git a/roles/network/tasks/squid.yml b/roles/network/tasks/squid.yml index 7b0a9388c..a82163ab3 100644 --- a/roles/network/tasks/squid.yml +++ b/roles/network/tasks/squid.yml @@ -19,32 +19,32 @@ group={{ item.group }} mode={{ item.mode }} with_items: - - src: 'squid/squid.sysconfig' + - src: 'roles/network/templates/squid/squid.sysconfig' dest: '/etc/sysconfig/squid' owner: 'root' group: 'root' mode: '0755' - - src: 'squid/sites.whitelist.txt' + - src: 'roles/network/templates/squid/sites.whitelist.txt' dest: '/etc/{{ proxy }}/sites.whitelist.txt' owner: '{{ proxy_user }}' group: '{{ proxy_user }}' mode: '0644' - - src: 'squid/allowregex.rules' + - src: 'roles/network/templates/squid/allowregex.rules' dest: '/etc/{{ proxy }}/allowregex.rules' owner: '{{ proxy_user }}' group: '{{ proxy_user }}' mode: '0644' - - src: 'squid/denyregex.rules' + - src: 'roles/network/templates/squid/denyregex.rules' dest: '/etc/{{ proxy }}/denyregex.rules' owner: '{{ proxy_user }}' group: '{{ proxy_user }}' mode: '0644' - - src: 'squid/dstaddress.rules' + - src: 'roles/network/templates/squid/dstaddress.rules' dest: '/etc/{{ proxy }}/dstaddress.rules' owner: '{{ proxy_user }}' group: '{{ proxy_user }}' mode: '0644' - - src: 'squid/iiab-httpcache.j2' + - src: 'roles/network/templates/squid/iiab-httpcache.j2' dest: '/usr/bin/iiab-httpcache' owner: 'root' group: 'root' @@ -64,7 +64,7 @@ mode=0750 state=directory -- include_tasks: dansguardian.yml +- include_tasks: roles/network/tasks/dansguardian.yml when: dansguardian_install - name: Stop Squid diff --git a/roles/network/tasks/wondershaper.yml b/roles/network/tasks/wondershaper.yml index 5fec75b3b..04c66bdf5 100644 --- a/roles/network/tasks/wondershaper.yml +++ b/roles/network/tasks/wondershaper.yml @@ -1,12 +1,12 @@ - name: Copy Wondershaper service script template: backup=yes - src=wondershaper/wondershaper.service + src=roles/network/templates/wondershaper/wondershaper.service dest=/etc/systemd/system/wondershaper.service mode=0644 - name: Copy Wondershaper script template: backup=yes - src=wondershaper/wondershaper.j2 + src=roles/network/templates/wondershaper/wondershaper.j2 dest=/usr/bin/wondershaper owner=root group=root @@ -20,7 +20,7 @@ state=directory - name: Copy Wondershaper config script - template: src=wondershaper/wondershaper.conf + template: src=roles/network/templates/wondershaper/wondershaper.conf dest=/etc/conf.d/wondershaper.conf owner=root group=root From 9679bc459247f53d13520ba9026aaabc3c0c9bed Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 31 Oct 2017 10:49:56 -0400 Subject: [PATCH 57/63] network detection replace first_run with iiab_stage --- roles/network/tasks/detected_network.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/roles/network/tasks/detected_network.yml b/roles/network/tasks/detected_network.yml index e38c68411..177270553 100644 --- a/roles/network/tasks/detected_network.yml +++ b/roles/network/tasks/detected_network.yml @@ -1,19 +1,19 @@ - name: iiab_wan_device shell: grep IIAB_WAN_DEVICE /etc/iiab/iiab.env | awk -F "=" '{print $2}' - when: not first_run + when: iiab_stage|int > 4 register: prior_gw - name: Checking for old device gateway interface for device test set_fact: - device_gw: "{{ prior_gw.stdout }}" - device_gw2: "{{ prior_gw.stdout }}" - when: not first_run and prior_gw is defined and prior_gw.stdout != "" + device_gw: "{{ prior_gw.stdout }}" + device_gw2: "{{ prior_gw.stdout }}" + when: iiab_stage|int > 4 and prior_gw is defined and prior_gw.stdout != "" - name: Setting WAN if detected set_fact: - iiab_wan_iface: "{{ discovered_wan_iface }}" - device_gw: "{{ discovered_wan_iface }}" - when: discovered_wan_iface != "none" + iiab_wan_iface: "{{ discovered_wan_iface }}" + device_gw: "{{ discovered_wan_iface }}" + when: ansible_default_ipv4.gateway is defined - name: RedHat network detection include_tasks: detected_redhat.yml From 0173826582036b00338d2d4318d1e61fe3400dc1 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 31 Oct 2017 11:10:33 -0400 Subject: [PATCH 58/63] computed_vars cleaning --- roles/1-prep/tasks/computed_vars.yml | 63 +++++++--------------------- 1 file changed, 16 insertions(+), 47 deletions(-) diff --git a/roles/1-prep/tasks/computed_vars.yml b/roles/1-prep/tasks/computed_vars.yml index f9fb64852..0d5b68dd6 100644 --- a/roles/1-prep/tasks/computed_vars.yml +++ b/roles/1-prep/tasks/computed_vars.yml @@ -6,76 +6,45 @@ # set top level variables from local facts for convenience - set_fact: - xo_model: '{{ ansible_local.local_facts.xo_model }}' - phplib_dir: '{{ ansible_local.local_facts.phplib_dir }}' - iiab_stage: '{{ ansible_local.local_facts.stage }}' + xo_model: '{{ ansible_local.local_facts.xo_model }}' + phplib_dir: '{{ ansible_local.local_facts.phplib_dir }}' + iiab_stage: '{{ ansible_local.local_facts.stage }}' - name: Set exFAT enabled for XO laptops set_fact: exFAT_enabled: True when: xo_model != "none" -# Discover do we have a gateway? -- if ansible detects gateway, becomes WAN candidate -- name: Finding gateway - set_fact: - discovered_wan_iface: "{{ ansible_default_ipv4.alias }}" - when: 'ansible_default_ipv4.gateway is defined' - -- name: Verify gateway present - shell: ping -c4 "{{ ansible_default_ipv4.gateway }}" &> /dev/null ; echo $? - when: discovered_wan_iface != "none" - register: gw_active_test - -- name: Recording gateway response - set_fact: - gw_active: True - when: discovered_wan_iface != "none" and gw_active_test.stdout == "0" - -- name: Test for internet access - get_url: url="{{ iiab_download_url }}/heart-beat.txt" dest=/tmp/heart-beat.txt - ignore_errors: True -# async: 10 -# poll: 2 - register: internet_access_test - -- name: Set internet_available true if wget succeeded - set_fact: - internet_available: True - when: not internet_access_test|failed and not disregard_network - -- name: Cleanup internet test file - file: path=/tmp/heart-beat.txt - state=absent - - name: set FQDN set_fact: - iiab_fqdn: "{{ iiab_hostname }}.{{ iiab_domain }}" - FQDN_changed: False + iiab_fqdn: "{{ iiab_hostname }}.{{ iiab_domain }}" + FQDN_changed: False - name: FQDN changed set_fact: - FQDN_changed: True + FQDN_changed: True when: iiab_fqdn != ansible_fqdn -# Now check FQDN -- include: roles/2-common/tasks/hostname.yml - when: not first_run and FQDN_changed +- name: Now check FQDN + include_tasks: roles/2-common/tasks/hostname.yml + when: FQDN_changed # Discover do we have a gateway? -- if ansible detects gateway, becomes WAN candidate - name: Finding gateway set_fact: - discovered_wan_iface: "{{ ansible_default_ipv4.alias }}" - when: 'ansible_default_ipv4.gateway is defined' + discovered_wan_iface: "{{ ansible_default_ipv4.alias }}" + iiab_wan_iface: "{{ discovered_wan_iface }}" + when: ansible_default_ipv4.gateway is defined - name: Verify gateway present - shell: ping -c4 "{{ ansible_default_ipv4.gateway }}" &> /dev/null ; echo $? + shell: ping -c4 "{{ ansible_default_ipv4.gateway }}" | grep icmp_seq=4 | wc -l when: discovered_wan_iface != "none" register: gw_active_test - name: Recording gateway response set_fact: - gw_active: True - when: discovered_wan_iface != "none" and gw_active_test.stdout == "0" + gw_active: True + when: discovered_wan_iface != "none" and gw_active_test.stdout == "1" - name: Test for internet access get_url: url="{{ iiab_download_url }}/heart-beat.txt" dest=/tmp/heart-beat.txt @@ -86,7 +55,7 @@ - name: Set internet_available true if wget succeeded set_fact: - internet_available: True + internet_available: True when: not internet_access_test|failed and not disregard_network - name: Cleanup internet test file From 7c825cb38aa58035f59fb9ed7defd65b4d44e68e Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 31 Oct 2017 12:13:17 -0400 Subject: [PATCH 59/63] vnstat lan_iface hack --- roles/vnstat/tasks/main.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/roles/vnstat/tasks/main.yml b/roles/vnstat/tasks/main.yml index 97ddea6c7..d8e1778d7 100644 --- a/roles/vnstat/tasks/main.yml +++ b/roles/vnstat/tasks/main.yml @@ -14,6 +14,18 @@ owner=root group=root +- name: Checking if lan_iface is set 1 + include_vars: roles/network/defaults/main.yml + when: not iiab_lan_iface is defined + +- name: Checking if lan_iface is set 2 + include_tasks: roles/network/tasks/detected_network.yml + when: not iiab_lan_iface is defined + +#- name: Checking if lan_iface is set 3 +# include_tasks: roles/network/tasks/computed_network.yml +# when: not iiab_lan_iface is defined + - name: Create database for WAN to collect vnStat data shell: /usr/bin/vnstat -i {{ iiab_wan_iface }} From 67317900d23d37c1d5cc0a9723fc04656a1820fa Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 31 Oct 2017 12:13:50 -0500 Subject: [PATCH 60/63] steps -> stages --- iiab-install | 2 +- iiab-steps.yml => iiab-stages.yml | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename iiab-steps.yml => iiab-stages.yml (100%) diff --git a/iiab-install b/iiab-install index 934885fe1..c2b35864c 100755 --- a/iiab-install +++ b/iiab-install @@ -1,6 +1,6 @@ #!/bin/bash -e # running from a git repo -PLAYBOOK="iiab-steps.yml" +PLAYBOOK="iiab-stages.yml" INVENTORY="ansible_hosts" CWD=`pwd` # Add cmdline options for passing to ansible diff --git a/iiab-steps.yml b/iiab-stages.yml similarity index 100% rename from iiab-steps.yml rename to iiab-stages.yml From d9896d5ec1883bac9cfd9d161bb66034a3d4c5de Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 31 Oct 2017 13:02:41 -0500 Subject: [PATCH 61/63] move is_rpi to computed_vars.yml for 0-init --- roles/1-prep/tasks/computed_vars.yml | 12 ++++++++---- roles/1-prep/tasks/main.yml | 7 ------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/roles/1-prep/tasks/computed_vars.yml b/roles/1-prep/tasks/computed_vars.yml index 0d5b68dd6..9e4e7fdf4 100644 --- a/roles/1-prep/tasks/computed_vars.yml +++ b/roles/1-prep/tasks/computed_vars.yml @@ -1,7 +1,4 @@ -# get local vars from scripts in /etc/ansible/facts.d -# on first run, this will generate UUID - -- name: re-read facts +- name: re-read local_facts.facts from /etc/ansible/facts.d setup: filter=ansible_local # set top level variables from local facts for convenience @@ -10,6 +7,13 @@ phplib_dir: '{{ ansible_local.local_facts.phplib_dir }}' iiab_stage: '{{ ansible_local.local_facts.stage }}' +# Networking uses a different file for the rpi +- name: Discover if this is a rpi -- assume if so it is running raspbian + set_fact: + rpi_model: "rpi" + is_rpi: "True" + when: ansible_local.local_facts.os == "raspbian" + - name: Set exFAT enabled for XO laptops set_fact: exFAT_enabled: True diff --git a/roles/1-prep/tasks/main.yml b/roles/1-prep/tasks/main.yml index a96e281f6..cff1ba0a7 100644 --- a/roles/1-prep/tasks/main.yml +++ b/roles/1-prep/tasks/main.yml @@ -63,13 +63,6 @@ when: not is_debuntu and selinux_disabled is defined and selinux_disabled.changed ## DISCOVER PLATFORMS ###### -- name: Discover if this is an rpi -- assume it is running Raspbian if so - set_fact: - rpi_model: "rpi" - is_rpi: "True" - when: ansible_local.local_facts.os == "raspbian" - ignore_errors: true - - include_tasks: prep.yml when: first_run From da730566de196c0fd24dacedcfcc0bab5eb036ab Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 31 Oct 2017 13:08:42 -0500 Subject: [PATCH 62/63] remove first_run from 1-prep main.yml --- roles/1-prep/tasks/main.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/roles/1-prep/tasks/main.yml b/roles/1-prep/tasks/main.yml index cff1ba0a7..05010b77a 100644 --- a/roles/1-prep/tasks/main.yml +++ b/roles/1-prep/tasks/main.yml @@ -50,13 +50,13 @@ - name: Disable AppArmor -- on by default in Ubuntu service: name=apparmor enabled=False state=stopped - when: first_run and is_ubuntu + when: is_ubuntu ignore_errors: true - name: Disable SELinux on next boot selinux: state=disabled register: selinux_disabled - when: first_run and not is_debuntu + when: not is_debuntu - name: Disable SELinux for this session (if needed) command: setenforce Permissive @@ -64,7 +64,6 @@ ## DISCOVER PLATFORMS ###### - include_tasks: prep.yml - when: first_run # Put conditional actions for hardware platforms here - include_tasks: raspberry_pi_2.yml @@ -74,12 +73,11 @@ shell: "lsusb | grep 8087:0a2b | wc |awk '{print $1}'" register: usb_NUC6 ignore_errors: true - when: first_run - name: Download the firmware for built-in WiFi on NUC6 get_url: dest=/lib/firmware url={{ iiab_download_url }}/iwlwifi-8000C-13.ucode - when: first_run and usb_NUC6.stdout|int > 0 + when: usb_NUC6.stdout|int > 0 # this script can be sourced to get IIAB location - name: Recording STAGE 1 HAS COMPLETED ============================ From 9cf49ccafc66f0bc77538cfa0009d0e45e75edd3 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Tue, 31 Oct 2017 13:13:09 -0500 Subject: [PATCH 63/63] update syntax in 1-prep iiab_ini.yml --- roles/1-prep/tasks/iiab_ini.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/1-prep/tasks/iiab_ini.yml b/roles/1-prep/tasks/iiab_ini.yml index c78970507..a1b4cb046 100755 --- a/roles/1-prep/tasks/iiab_ini.yml +++ b/roles/1-prep/tasks/iiab_ini.yml @@ -25,10 +25,10 @@ - option: 'arch' value: '{{ ansible_architecture }}' - option: 'iiab_branch' - value: '{{ ansible_local["local_facts"]["iiab_branch"] }}' + value: '{{ ansible_local.local_facts.iiab_branch }}' - option: 'iiab_commit' - value: '{{ ansible_local["local_facts"]["iiab_commit"] }}' + value: '{{ ansible_local.local_facts.iiab_commit }}' - option: 'install_date' - value: '{{ ansible_date_time["iso8601"] }}' + value: '{{ ansible_date_time.iso8601 }}' - option: 'install_xo' value: '{{ xo_model }}'