diff --git a/iiab-install b/iiab-install index 8e16c53bd..7ede032ab 100755 --- a/iiab-install +++ b/iiab-install @@ -3,15 +3,6 @@ # Add cmdline options for passing to ansible # Todo add proper shift to gobble up --debug --reinstall -if [ "$1" != "--debug" ] && [ "$1" != "--reinstall" ] && [ "$1" != "" ]; then - echo "Use './iiab-install' for regular installs, or to continue an install." - echo "Use './iiab-install --reinstall' to force running all Stages 0-9." - echo "Use './iiab-install --debug' to run Stage 0, followed by Stages 3-9." - echo "Use './runtags' to run a single Stage or Tag or Role." - echo "Use './iiab-network' to run Network sections." - exit 1 -fi - PLAYBOOK="iiab-stages.yml" INVENTORY="ansible_hosts" ARGS="" @@ -23,12 +14,27 @@ MIN_ANSIBLE_VER=2.4.1.0 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 +echo "Placed /etc/ansible/facts.d/local_facts.fact into position." + if [ ! -f $PLAYBOOK ]; then echo "EXITING: IIAB Playbook not found." echo "Please run 'iiab-install' from /opt/iiab/iiab (top level of git repo)." exit 1 fi +if [ "$1" != "--debug" ] && [ "$1" != "--reinstall" ] && [ "$1" != "" ]; then + echo "Use './iiab-install' for regular installs, or to continue an install." + echo "Use './iiab-install --reinstall' to force running all Stages 0-9." + echo "Use './iiab-install --debug' to run Stage 0, followed by Stages 3-9." + echo "Use './runtags' to run a single Stage or Tag or Role." + echo "Use './iiab-network' to run Network sections." + exit 1 +fi + # Subroutine compares software version numbers. Generates rare false positives # like "1.0 > 1" and "2.4.0 > 2.4". Avoid risks by structuring conditionals w/ # a consistent # of decimal points e.g. "if version_gt w.x.y.z a.b.c.d; then" @@ -61,12 +67,6 @@ if version_gt $MIN_ANSIBLE_VER $CURR_ANSIBLE_VER; then exit 1 fi -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 -echo "Placed /etc/ansible/facts.d/local_facts.fact into position." - # Stage 0 will always be run. From there on up to Stage 9 we keep a counter # (in /etc/iiab/iiab.env) of the highest completed Stage. Avoid repetition! STAGE=0 diff --git a/roles/2-common/tasks/hostname.yml b/roles/0-init/tasks/hostname.yml similarity index 71% rename from roles/2-common/tasks/hostname.yml rename to roles/0-init/tasks/hostname.yml index 4726ec306..b929e18f1 100644 --- a/roles/2-common/tasks/hostname.yml +++ b/roles/0-init/tasks/hostname.yml @@ -18,10 +18,10 @@ group=root mode=0644 -- name: Re-configuring httpd - not initial install - include_tasks: roles/httpd/tasks/main.yml - when: iiab_stage|int > 3 +#- name: Re-configuring httpd - not initial install +# include_tasks: roles/httpd/tasks/main.yml +# when: iiab_stage|int > 3 -- name: Re-configuring rest of networking - not initial install - include_tasks: roles/network/tasks/main.yml - when: iiab_stage|int > 4 +#- name: Re-configuring rest of networking - not initial install +# include_tasks: roles/network/tasks/main.yml +# when: iiab_stage|int > 4 diff --git a/roles/0-init/tasks/main.yml b/roles/0-init/tasks/main.yml index dd80cc686..0c9d0b27a 100644 --- a/roles/0-init/tasks/main.yml +++ b/roles/0-init/tasks/main.yml @@ -199,7 +199,7 @@ value: '{{ FQDN_changed }}' - name: Now changing FQDN - include_tasks: roles/2-common/tasks/hostname.yml + include_tasks: hostname.yml when: FQDN_changed - name: STAGE 0 HAS COMPLETED ====================================== diff --git a/roles/network/tasks/computed_network.yml b/roles/network/tasks/computed_network.yml index 19cd1048a..6b3eba538 100644 --- a/roles/network/tasks/computed_network.yml +++ b/roles/network/tasks/computed_network.yml @@ -6,19 +6,19 @@ user_wan_iface: "{{ discovered_wan_iface }}" when: discovered_wan_iface != "none" and xo_model != "none" and has_ifcfg_gw == "none" -- name: Checking for NetworkManager-config-server - shell: rpm -qa | grep NetworkManager-config-server | wc -l - register: strict_networking_check +#- name: Checking for NetworkManager-config-server +# shell: rpm -qa | grep NetworkManager-config-server | wc -l +# register: strict_networking_check -- name: Found Checking for NetworkManager-config-server - set_fact: - strict_networking: True - when: strict_networking_check == "1" +#- name: Found Checking for NetworkManager-config-server +# set_fact: +# strict_networking: True +# when: strict_networking_check == "1" -- name: Use restricted network features - set_fact: - iiab_demo_mode: True - when: teamviewer_install and not strict_networking +#- name: Use restricted network features +# set_fact: +# iiab_demo_mode: True +# when: teamviewer_install and not strict_networking - name: XO laptop wants USB WiFi interface as AP mode set_fact: diff --git a/roles/network/tasks/dhcpd.yml b/roles/network/tasks/dhcpd.yml index f5612df22..3896c6381 100644 --- a/roles/network/tasks/dhcpd.yml +++ b/roles/network/tasks/dhcpd.yml @@ -17,7 +17,13 @@ createhome=no when: is_debuntu -- name: Configure dhcpd +- name: Disable stock dhcp_service + service: name={{ dhcp_service }} + enabled=no + state=stopped + when: is_debuntu + +- name: Install systemd unit file to /etc/systemd/system/dhcpd.service template: src={{ item.src }} dest={{ item.dest }} owner=root diff --git a/roles/network/tasks/enable_services.yml b/roles/network/tasks/enable_services.yml index 6e53c08cb..e8e272a78 100644 --- a/roles/network/tasks/enable_services.yml +++ b/roles/network/tasks/enable_services.yml @@ -1,9 +1,3 @@ -- name: Disable stock dhcp_service - service: name={{ dhcp_service }} - enabled=no - state=stopped - when: dhcpd_install and first_run and is_debuntu - - name: Disable dhcpd service service: name=dhcpd enabled=no diff --git a/roles/network/tasks/restart.yml b/roles/network/tasks/restart.yml index 62eed3108..49fff4e68 100644 --- a/roles/network/tasks/restart.yml +++ b/roles/network/tasks/restart.yml @@ -10,6 +10,7 @@ - name: Stop Squid service service: name={{ proxy }} state=stopped + async: 120 when: squid_install - name: Stop DansGuardian diff --git a/scripts/local_facts.fact b/scripts/local_facts.fact index 67c274826..1735a2b60 100755 --- a/scripts/local_facts.fact +++ b/scripts/local_facts.fact @@ -5,7 +5,7 @@ VERSION_ID=`grep VERSION_ID /etc/*elease | cut -d= -f2` VERSION_ID=${VERSION_ID//\"/} VERSION_ID=${VERSION_ID%%.*} OS_VER=$OS-$VERSION_ID -DHCPCD=`which dhcpcd` +DHCPCD_PATH=`which dhcpcd` case $OS_VER in "fedora-18" | \ @@ -53,6 +53,11 @@ else STAGE=0 fi ANSIBLE_VERSION=$(ansible --version|head -n 1|cut -f 2 -d " ") + +if [ ! x$DHCPCD_PATH = x ] +then + DHCPCD=`systemctl is-enabled dhcpcd` +fi cat <