From c865505c5a899ee5795a114958a7c0c16c27d36c Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 28 Oct 2017 13:30:27 -0500 Subject: [PATCH 01/25] 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/25] 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/25] 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/25] 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/25] 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/25] 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/25] 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/25] 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/25] 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/25] 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/25] 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 13/25] 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 14/25] 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 15/25] 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 16/25] 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 17/25] 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 4ea786b8ec53191621eb39148ac420126d8c1e1a Mon Sep 17 00:00:00 2001 From: A Holt Date: Mon, 30 Oct 2017 16:34:22 -0400 Subject: [PATCH 18/25] 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 19/25] 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 20/25] 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 21/25] 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 22/25] 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 23/25] 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 24/25] 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 25/25] 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