From 5aa4e20119a6273ff9648613987fa2beef7df2c9 Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 2 Nov 2018 18:02:44 -0400 Subject: [PATCH 1/8] Update iiab_ini.yml --- roles/0-init/tasks/iiab_ini.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/0-init/tasks/iiab_ini.yml b/roles/0-init/tasks/iiab_ini.yml index dcd7b06a3..346eab369 100644 --- a/roles/0-init/tasks/iiab_ini.yml +++ b/roles/0-init/tasks/iiab_ini.yml @@ -1,12 +1,12 @@ # workaround for fact that auto create does not work on iiab_ini_file (/etc/iiab/iiab.ini) - name: Create {{ iiab_ini_file }} file: - dest: "{{ iiab_ini_file }}" + path: "{{ iiab_ini_file }}" state: touch -- name: Add location section to config file +- name: Add 'location' variable values to {{ iiab_ini_file }} ini_file: - dest: "{{ iiab_ini_file }}" + path: "{{ iiab_ini_file }}" section: location option: "{{ item.option }}" value: "{{ item.value }}" @@ -18,7 +18,7 @@ - name: Add 'version' variable values to {{ iiab_ini_file }} ini_file: - dest: "{{ iiab_ini_file }}" + path: "{{ iiab_ini_file }}" section: version option: "{{ item.option }}" value: "{{ item.value }}" From 9dcdb749155d912759da29ac31d272fbb5452b81 Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 2 Nov 2018 18:17:44 -0400 Subject: [PATCH 2/8] Update fl.yml --- roles/0-init/tasks/fl.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/0-init/tasks/fl.yml b/roles/0-init/tasks/fl.yml index f8d93144c..3f9c8c584 100644 --- a/roles/0-init/tasks/fl.yml +++ b/roles/0-init/tasks/fl.yml @@ -1,4 +1,4 @@ -- name: Create various library directories +- name: Create 21 directories with ownership root:root and permissions 0755 (3 in /etc, 3 in {{ iiab_base }} and 15 in /library) # iiab_base is /opt/iiab file: path: "{{ item }}" owner: root @@ -7,6 +7,8 @@ state: directory with_items: - /etc/iiab + - /etc/sysconfig/olpc-scripts/ + - /etc/sysconfig/olpc-scripts/setup.d/installed/ - "{{ yum_packages_dir }}" - "{{ pip_packages_dir }}" - "{{ downloads_dir }}" @@ -25,10 +27,8 @@ - "{{ doc_root }}/common/images" - "{{ doc_root }}/common/assets" - "{{ doc_root }}/common/services" - - /etc/sysconfig/olpc-scripts/ - - /etc/sysconfig/olpc-scripts/setup.d/installed/ -- name: Create symlink from webfonts to fonts +- name: Symlink from {{ doc_root }}/common/webfonts to {{ doc_root }}/common/fonts file: src: "{{ doc_root }}/common/fonts" path: "{{ doc_root }}/common/webfonts" From 2af06529eafd6cecc89b554c11b71c2d6eae31d6 Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 2 Nov 2018 18:29:55 -0400 Subject: [PATCH 3/8] Update hostname.yml --- roles/0-init/tasks/hostname.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/roles/0-init/tasks/hostname.yml b/roles/0-init/tasks/hostname.yml index 56c8e8e9b..3e64c3637 100644 --- a/roles/0-init/tasks/hostname.yml +++ b/roles/0-init/tasks/hostname.yml @@ -1,21 +1,21 @@ -- name: Is ubuntu-18 server +- name: Does /etc/cloud/cloud.cfg exist i.e. is this ubuntu-18 server? stat: path: /etc/cloud/cloud.cfg register: U18_server -- name: Edit cloud.cfg yaml +- name: Put 'preserve_hostname: true' in /etc/cloud/cloud.cfg (ubuntu-18 server) lineinfile: - dest: /etc/cloud/cloud.cfg + path: /etc/cloud/cloud.cfg regexp: '^preserve_hostname*' line: 'preserve_hostname: true' state: present when: U18_server is defined and U18_server.stat.exists -- name: Turn the crank for systemd (debuntu) +- name: 'Turn the crank for systemd: hostnamectl set-hostname "{{ iiab_hostname }}.{{ iiab_domain }}" (debuntu)' shell: hostnamectl set-hostname "{{ iiab_hostname }}.{{ iiab_domain }}" when: is_debuntu -- name: Configure /etc/sysconfig/network (redhat) +- name: Install /etc/sysconfig/network from template (redhat) template: src: roles/network/templates/network/sysconfig.network.j2 dest: /etc/sysconfig/network @@ -24,9 +24,9 @@ mode: 0644 when: is_redhat -- name: Configure short hostname in /etc/hosts +- name: Put hostnames "127.0.0.1 localhost.localdomain localhost box {{ iiab_hostname }}" in /etc/hosts lineinfile: - dest: /etc/hosts + path: /etc/hosts regexp: '^127\.0\.0\.1' line: '127.0.0.1 localhost.localdomain localhost box {{ iiab_hostname }}' owner: root From f318d3bf19afc9d2948b25429a29693674441cac Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 2 Nov 2018 19:06:29 -0400 Subject: [PATCH 4/8] Update main.yml --- roles/0-init/tasks/main.yml | 42 ++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/roles/0-init/tasks/main.yml b/roles/0-init/tasks/main.yml index d4903c189..cf11061cd 100644 --- a/roles/0-init/tasks/main.yml +++ b/roles/0-init/tasks/main.yml @@ -5,7 +5,7 @@ path: "{{ iiab_env_file }}" register: NewInstall -- name: Setting first run flag +- name: Set first_run flag set_fact: first_run: True when: not NewInstall.stat.exists @@ -36,30 +36,30 @@ # nobridge: True when: ansible_local.local_facts.os == "raspbian" -- name: Set exFAT enabled for XO laptops +- name: Set exFAT_enabled if xo_model != "none" 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 +- name: "Do we have a gateway? If so set discovered_wan_iface: {{ ansible_default_ipv4.alias }}, iiab_wan_iface: {{ discovered_wan_iface }}" set_fact: discovered_wan_iface: "{{ ansible_default_ipv4.alias }}" iiab_wan_iface: "{{ discovered_wan_iface }}" when: ansible_default_ipv4.gateway is defined -- name: Verify gateway present +- name: Verify gateway active (using ping) 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 +- name: If so, set gw_active set_fact: gw_active: True when: discovered_wan_iface != "none" and gw_active_test.stdout == "1" -- name: Test for Internet access +- name: Test for Internet access ({{ iiab_download_url }}/heart-beat.txt) get_url: url: "{{ iiab_download_url }}/heart-beat.txt" dest: /tmp/heart-beat.txt @@ -70,12 +70,12 @@ # poll: 2 register: internet_access_test -- name: Set internet_available true if wget succeeded +- name: Set internet_available if download succeeded and not disregard_network set_fact: internet_available: True when: not internet_access_test.failed and not disregard_network -- name: Remove Internet test file +- name: Remove downloaded Internet test file /tmp/heart-beat.txt file: path: /tmp/heart-beat.txt state: absent @@ -84,17 +84,17 @@ - name: If the TZ is not set in env, set it to UTC include_tasks: tz.yml -- name: Set port 80 for Admin Console +- name: Set port 80 for Admin Console if not adm_cons_force_ssl set_fact: gui_port: 80 when: not adm_cons_force_ssl -- name: Set port 443 for Admin Console +- name: Set port 443 for Admin Console if adm_cons_force_ssl set_fact: gui_port: 443 when: adm_cons_force_ssl -- name: Require MySQL to be on (mandatory in Stage 3!) +- name: Turn on both vars for MySQL (mandatory in Stage 3!) set_fact: mysql_install: True mysql_enabled: True @@ -103,18 +103,18 @@ # when: elgg_enabled or rachel_enabled or owncloud_enabled or phpmyadmin_enabled or wordpress_enabled or iiab_menu_install # Late 2017: Had commented out MongoDB on a trial basis, for a more basic/lightweight Sugarizer, per https://github.com/iiab/iiab/pull/427 -- name: Turn on vars for MongoDB if Sugarizer enabled +- name: Turn on both vars for MongoDB if sugarizer_enabled set_fact: mongodb_install: True mongodb_enabled: True when: sugarizer_enabled # There might be other db's -- name: Turn on vars for PostgreSQL if Moodle or Pathagar enabled +- name: Turn on both vars for PostgreSQL if moodle_enabled or pathagar_enabled set_fact: postgresql_install: True postgresql_enabled: True - when: moodle_enabled or (pathagar is defined and pathagar_enabled) + when: moodle_enabled or (pathagar_enabled is defined and pathagar_enabled) #- name: Turn on vars for Docker if SchoolTool is to be installed # set_fact: @@ -122,12 +122,12 @@ # docker_enabled: True # when: schooltool_enabled or schooltool_install -- name: Set python_path (redhat) +- name: "Set python_path: /lib/python2.7/site-packages/ (redhat)" set_fact: python_path: /lib/python2.7/site-packages/ when: is_redhat -- name: Set python_path (debuntu) +- name: "Set python_path: /usr/local/lib/python2.7/dist-packages/ (debuntu)" set_fact: python_path: /usr/local/lib/python2.7/dist-packages/ when: is_debuntu @@ -135,28 +135,28 @@ # For various reasons the mysql service cannot be enabled on Fedora 20, but # 'mariadb', which is its real name can. On Fedora 18 we need to use 'mysqld'. -- name: Set mysql_service to mariadb by default +- name: "Set mysql_service: mariadb by default" set_fact: mysql_service: mariadb -- name: Set mysql_service to mysqld etc (Fedora 18) +- name: "Set mysql_service: mysqld etc (Fedora 18)" set_fact: mysql_service: mysqld no_NM_reload: True is_F18: True when: (ansible_distribution_release == "based on Fedora 18" or ansible_distribution_version == "18") and ansible_distribution == "Fedora" -- name: Set mysql_service to mysql (debuntu) +- name: "Set mysql_service: mysql (debuntu)" set_fact: mysql_service: mysql when: is_debuntu -- name: Set FQDN +- name: "Set iiab_fqdn: {{ iiab_hostname }}.{{ iiab_domain }}" set_fact: iiab_fqdn: "{{ iiab_hostname }}.{{ iiab_domain }}" FQDN_changed: False -- name: FQDN changed +- name: Set FQDN_changed when iiab_fqdn != ansible_fqdn ({{ ansible_fqdn }}) set_fact: FQDN_changed: True when: iiab_fqdn != ansible_fqdn From ea424929e701ee4707e37b63a98f69a8ce01866f Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 2 Nov 2018 19:17:27 -0400 Subject: [PATCH 5/8] Update first_run.yml --- roles/0-init/tasks/first_run.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/0-init/tasks/first_run.yml b/roles/0-init/tasks/first_run.yml index 0c3b01281..ff349424d 100644 --- a/roles/0-init/tasks/first_run.yml +++ b/roles/0-init/tasks/first_run.yml @@ -1,5 +1,5 @@ - name: Create the directory structure for IIAB include_tasks: fl.yml -- name: Write iiab_ini.yml for the first time +- name: Run iiab_ini.yml, creating {{ iiab_ini_file }} include_tasks: iiab_ini.yml From de5f3c5cd228ce68f7490c3eda56c1291a402d32 Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 2 Nov 2018 19:20:35 -0400 Subject: [PATCH 6/8] Update first_run.yml --- roles/0-init/tasks/first_run.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/0-init/tasks/first_run.yml b/roles/0-init/tasks/first_run.yml index ff349424d..3a8fa2770 100644 --- a/roles/0-init/tasks/first_run.yml +++ b/roles/0-init/tasks/first_run.yml @@ -1,5 +1,5 @@ -- name: Create the directory structure for IIAB +- name: Create IIAB directory structure include_tasks: fl.yml -- name: Run iiab_ini.yml, creating {{ iiab_ini_file }} +- name: Create {{ iiab_ini_file }} include_tasks: iiab_ini.yml From 7539cc295941342a877a5672c74fc111b90bce64 Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 2 Nov 2018 19:21:28 -0400 Subject: [PATCH 7/8] Update main.yml --- 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 cf11061cd..bbdd59d89 100644 --- a/roles/0-init/tasks/main.yml +++ b/roles/0-init/tasks/main.yml @@ -12,7 +12,7 @@ # 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. -- name: Write iiab_ini.yml for the first time +- name: Create IIAB directory structure and {{ iiab_ini_file }}, if first_run include_tasks: first_run.yml when: first_run From 380963d417400f4e5b37891e027ba6b951c952cc Mon Sep 17 00:00:00 2001 From: A Holt Date: Fri, 2 Nov 2018 19:24:15 -0400 Subject: [PATCH 8/8] Update main.yml --- 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 bbdd59d89..59cd5d2ed 100644 --- a/roles/0-init/tasks/main.yml +++ b/roles/0-init/tasks/main.yml @@ -49,7 +49,7 @@ iiab_wan_iface: "{{ discovered_wan_iface }}" when: ansible_default_ipv4.gateway is defined -- name: Verify gateway active (using ping) +- name: "Verify gateway active: ping -c4 {{ ansible_default_ipv4.gateway }}" shell: ping -c4 "{{ ansible_default_ipv4.gateway }}" | grep icmp_seq=4 | wc -l when: discovered_wan_iface != "none" register: gw_active_test