mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +00:00
Merge pull request #303 from jvonau/avoid_1-prep
Avoid 1 prep - speeds up runtags
This commit is contained in:
commit
40414f691b
20 changed files with 138 additions and 151 deletions
|
@ -8,5 +8,6 @@
|
||||||
- vars/local_vars.yml
|
- vars/local_vars.yml
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
|
- { role: 0-init, tags: ['init'] }
|
||||||
- { role: 1-prep, tags: ['prep','platform','base'] }
|
- { role: 1-prep, tags: ['prep','platform','base'] }
|
||||||
- { role: openvpn, tags: ['openvpn'] }
|
- { role: openvpn, tags: ['openvpn'] }
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
- /etc/iiab/config_vars.yml
|
- /etc/iiab/config_vars.yml
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- { role: 1-prep, tags: ['prep','platform','base'] }
|
- { role: 0-init, tags: ['init'] }
|
||||||
- { role: 4-server-options, tags: ['options'] }
|
- { role: 4-server-options, tags: ['options'] }
|
||||||
- { role: 5-xo-services, tags: ['xo-services'] }
|
- { role: 5-xo-services, tags: ['xo-services'] }
|
||||||
- { role: 6-generic-apps, tags: ['generic-apps'] }
|
- { role: 6-generic-apps, tags: ['generic-apps'] }
|
||||||
|
|
|
@ -3,15 +3,17 @@
|
||||||
if [ -f /etc/iiab/iiab.env ]
|
if [ -f /etc/iiab/iiab.env ]
|
||||||
then
|
then
|
||||||
. /etc/iiab/iiab.env
|
. /etc/iiab/iiab.env
|
||||||
cd $XSCE_DIR
|
cd $IIAB_DIR
|
||||||
else
|
else
|
||||||
echo /etc/iiab/iiab.env is missing. Playbook has not been run.
|
echo /etc/iiab/iiab.env is missing. Playbook has not been run.
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CWD=`pwd`
|
||||||
|
|
||||||
if [ ! -f iiab-network.yml ]
|
if [ ! -f iiab-network.yml ]
|
||||||
then
|
then
|
||||||
echo "XSCE Playbook not found."
|
echo "IIAB Playbook not found."
|
||||||
echo "Please run this command from the top level of the git repo."
|
echo "Please run this command from the top level of the git repo."
|
||||||
echo "Exiting."
|
echo "Exiting."
|
||||||
exit
|
exit
|
||||||
|
@ -22,7 +24,7 @@ then
|
||||||
touch /etc/iiab/config_vars.yml
|
touch /etc/iiab/config_vars.yml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export ANSIBLE_LOG_PATH="$XSCE_DIR/iiab-network.log"
|
export ANSIBLE_LOG_PATH="$CWD/iiab-network.log"
|
||||||
ansible-playbook -i ansible_hosts iiab-network.yml --connection=local
|
ansible-playbook -i ansible_hosts iiab-network.yml --connection=local
|
||||||
echo "" >> iiab-network.log
|
echo "" >> iiab-network.log
|
||||||
ls -la /etc/sys*/net*/ifcfg* >> iiab-network.log
|
ls -la /etc/sys*/net*/ifcfg* >> iiab-network.log
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
- /etc/iiab/config_vars.yml
|
- /etc/iiab/config_vars.yml
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- { role: 1-prep, tags: ['prep','platform','base'] }
|
- { role: 0-init, tags: ['network'] }
|
||||||
- { role: network, tags: ['network','base'] }
|
- { role: network, tags: ['network','base'] }
|
||||||
|
|
1
iiab.yml
1
iiab.yml
|
@ -9,6 +9,7 @@
|
||||||
- /etc/iiab/config_vars.yml
|
- /etc/iiab/config_vars.yml
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
|
- { role: 0-init, tags: ['init'] }
|
||||||
- { role: 1-prep, tags: ['prep','platform','base'] }
|
- { role: 1-prep, tags: ['prep','platform','base'] }
|
||||||
- { role: 2-common, tags: ['common','base'] }
|
- { role: 2-common, tags: ['common','base'] }
|
||||||
- { role: 3-base-server, tags: ['base'] }
|
- { role: 3-base-server, tags: ['base'] }
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
PLAYBOOK="iiab-base.yml"
|
PLAYBOOK="iiab-base.yml"
|
||||||
INVENTORY="ansible_hosts"
|
INVENTORY="ansible_hosts"
|
||||||
|
CWD=`pwd`
|
||||||
|
|
||||||
if [ ! -f $PLAYBOOK ]
|
if [ ! -f $PLAYBOOK ]
|
||||||
then
|
then
|
||||||
|
@ -14,5 +15,5 @@ fi
|
||||||
sed -i -e "s/openvpn_install: False/openvpn_install: True/" vars/local_vars.yml
|
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
|
sed -i -e "s/openvpn_enabled: False/openvpn_enabled: True/" vars/local_vars.yml
|
||||||
|
|
||||||
export ANSIBLE_LOG_PATH="$XSCE_DIR/iiab-install.log"
|
export ANSIBLE_LOG_PATH="$CWD/iiab-install.log"
|
||||||
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local
|
ansible-playbook -i $INVENTORY $PLAYBOOK --connection=local
|
||||||
|
|
1
roles/0-init/defaults/main.yml
Symbolic link
1
roles/0-init/defaults/main.yml
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
/opt/iiab/iiab/roles/1-prep/defaults/main.yml
|
15
roles/0-init/tasks/main.yml
Normal file
15
roles/0-init/tasks/main.yml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
- name: Determine if runansible was run
|
||||||
|
stat: path=/etc/iiab/iiab.env
|
||||||
|
register: NewInstall
|
||||||
|
|
||||||
|
- name: Setting first run flag
|
||||||
|
set_fact:
|
||||||
|
first_run: True
|
||||||
|
when: not NewInstall.stat.exists
|
||||||
|
|
||||||
|
# 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
|
||||||
|
when: first_run
|
||||||
|
# Now load the computed vars
|
||||||
|
- include: roles/1-prep/tasks/computed_vars.yml
|
|
@ -6,49 +6,26 @@ gui_version: 2
|
||||||
# These are defaults for boolean routines,
|
# These are defaults for boolean routines,
|
||||||
first_run: False
|
first_run: False
|
||||||
installing: False
|
installing: False
|
||||||
NUC6_firmware_needed: False
|
discovered_wan_iface: "none"
|
||||||
exFAT_enabled: False
|
gw_active: "none"
|
||||||
no_NM_reload: False
|
|
||||||
has_WAN: False
|
|
||||||
wireless_lan_present: False
|
|
||||||
strict_networking: False
|
|
||||||
iiab_demo_mode: False
|
|
||||||
gw_active: False
|
|
||||||
gui_static_wan: False
|
|
||||||
internet_available: False
|
internet_available: False
|
||||||
is_F18: False
|
is_F18: False
|
||||||
|
no_NM_reload: False
|
||||||
|
exFAT_enabled: False
|
||||||
|
gui_port: 80
|
||||||
|
|
||||||
|
# Set default for discovered hardware
|
||||||
|
rpi_model: none
|
||||||
|
is_rpi: False
|
||||||
|
xo_model: none
|
||||||
|
rtc_id: ds3231
|
||||||
|
NUC6_firmware_needed: False
|
||||||
|
|
||||||
|
# used in 2-common xo.yml
|
||||||
|
wifi_id: none
|
||||||
|
|
||||||
is_F20: False
|
is_F20: False
|
||||||
is_F21: False
|
is_F21: False
|
||||||
is_F22: False
|
is_F22: False
|
||||||
is_F23: False
|
is_F23: False
|
||||||
is_F24: False
|
is_F24: False
|
||||||
|
|
||||||
# Set default for discovered hardware
|
|
||||||
driver_name: nl80211
|
|
||||||
rpi_model: none
|
|
||||||
is_rpi: False
|
|
||||||
xo_model: none
|
|
||||||
rtc_id: ds3231
|
|
||||||
|
|
||||||
# Set defaults for discovery process as strings
|
|
||||||
wifi1: "not found-1"
|
|
||||||
wifi2: "not found-2"
|
|
||||||
discovered_wan_iface: "none"
|
|
||||||
discovered_lan_iface: "none"
|
|
||||||
discovered_wireless_iface: "none"
|
|
||||||
iiab_wireless_lan_iface: "none"
|
|
||||||
iiab_lan_iface: "none"
|
|
||||||
iiab_wan_iface: "none"
|
|
||||||
device_gw: "none"
|
|
||||||
has_ifcfg_gw: "none"
|
|
||||||
has_wifi_gw: "none"
|
|
||||||
ap_device: "none"
|
|
||||||
device_gw2: ""
|
|
||||||
|
|
||||||
gui_port: 80
|
|
||||||
|
|
||||||
# must keep roles/iiab-admin/defaults/main.yml sync'd
|
|
||||||
admin_console_path: "{{ iiab_base }}/admin_console"
|
|
||||||
cmdsrv_path: "{{ iiab_base }}/iiab_cmdsrv"
|
|
||||||
iiab_cmdsrv_dbname : "iiab_cmdsrv.0.2.db"
|
|
||||||
wifi_id: none
|
|
||||||
|
|
|
@ -14,6 +14,38 @@
|
||||||
exFAT_enabled: True
|
exFAT_enabled: True
|
||||||
when: xo_model != "none"
|
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: add version section
|
- name: add version section
|
||||||
ini_file: dest='{{ iiab_config_file }}'
|
ini_file: dest='{{ iiab_config_file }}'
|
||||||
section=runtime
|
section=runtime
|
||||||
|
@ -36,6 +68,10 @@
|
||||||
value: '{{ ansible_swaptotal_mb }}'
|
value: '{{ ansible_swaptotal_mb }}'
|
||||||
- option: 'product_id'
|
- option: 'product_id'
|
||||||
value: '{{ ansible_product_uuid }}'
|
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
|
# 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
|
- name: If the TZ is not set in env, set it to UTC
|
||||||
|
|
|
@ -1,21 +1,3 @@
|
||||||
- name: Determine if runansible was run
|
|
||||||
stat: path=/etc/iiab/iiab.env
|
|
||||||
register: NewInstall
|
|
||||||
|
|
||||||
- name: Setting first run flag
|
|
||||||
set_fact:
|
|
||||||
first_run: True
|
|
||||||
when: NewInstall.stat.exists is defined and not NewInstall.stat.exists
|
|
||||||
|
|
||||||
# we need to inialize the ini file
|
|
||||||
- include: iiab_ini.yml
|
|
||||||
when: first_run
|
|
||||||
|
|
||||||
- name: Set flag for fedora 18
|
|
||||||
set_fact:
|
|
||||||
is_F18: True
|
|
||||||
when: ansible_distribution_release == "based on Fedora 18" or ansible_distribution_version == "18"
|
|
||||||
|
|
||||||
- name: get the uuidgen program
|
- name: get the uuidgen program
|
||||||
package: name=uuid-runtime
|
package: name=uuid-runtime
|
||||||
state=present
|
state=present
|
||||||
|
@ -84,11 +66,7 @@
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- include: prep.yml
|
- include: prep.yml
|
||||||
|
when: first_run
|
||||||
- include: computed_vars.yml
|
|
||||||
|
|
||||||
- include: detected_network.yml
|
|
||||||
when: not installing
|
|
||||||
|
|
||||||
# Put conditional actions for hardware platforms here
|
# Put conditional actions for hardware platforms here
|
||||||
- include: raspberry_pi_2.yml
|
- include: raspberry_pi_2.yml
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# This is a configuration file for XSCE
|
# This is a configuration file for XSCE
|
||||||
# It can sourced in a shell script or read into an application
|
# It can sourced in a shell script or read into an application
|
||||||
XSCE_BASE_PATH={{ iiab_base }}
|
IIAB_BASE_PATH={{ iiab_base }}
|
||||||
XSCE_DIR={{ iiab_dir }}
|
IIAB_DIR={{ iiab_dir }}
|
||||||
OS={{ ansible_local.local_facts.os }}
|
OS={{ ansible_local.local_facts.os }}
|
||||||
OS_VER={{ ansible_local.local_facts.os_ver }}
|
OS_VER={{ ansible_local.local_facts.os_ver }}
|
||||||
WWWROOT={{ doc_root }}
|
WWWROOT={{ doc_root }}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
- include: iiab_ini.yml
|
#- include: iiab_ini.yml
|
||||||
|
|
||||||
# create the directory structure for XSCE
|
# create the directory structure for XSCE
|
||||||
- include: fl.yml
|
- include: fl.yml
|
||||||
|
|
|
@ -1,10 +1,36 @@
|
||||||
---
|
---
|
||||||
|
# Defaults for network detection
|
||||||
|
wireless_lan_present: False
|
||||||
|
strict_networking: False
|
||||||
|
iiab_demo_mode: False
|
||||||
|
gui_static_wan: False
|
||||||
|
|
||||||
|
# Set defaults for discovery process as strings
|
||||||
|
wifi1: "not found-1"
|
||||||
|
wifi2: "not found-2"
|
||||||
|
discovered_lan_iface: "none"
|
||||||
|
discovered_wireless_iface: "none"
|
||||||
|
#Redhat
|
||||||
|
iiab_lan_iface: "none"
|
||||||
|
iiab_wan_iface: "none"
|
||||||
|
iiab_wireless_lan_iface: "none"
|
||||||
|
device_gw: "none"
|
||||||
|
device_gw2: ""
|
||||||
|
has_WAN: False
|
||||||
|
has_ifcfg_gw: "none"
|
||||||
|
has_wifi_gw: "none"
|
||||||
|
ap_device: "none"
|
||||||
|
#Debian
|
||||||
|
dhcpcd_result: ""
|
||||||
|
wan_in_interfaces: False
|
||||||
|
|
||||||
# The values here are default local variables.
|
# The values here are default local variables.
|
||||||
gui_wan_iface: "unset"
|
gui_wan_iface: "unset"
|
||||||
gui_static_wan_ip: "unset"
|
gui_static_wan_ip: "unset"
|
||||||
gui_desired_network_role: Gateway
|
gui_desired_network_role: Gateway
|
||||||
wondershaper_dspeed: "4096"
|
wondershaper_dspeed: "4096"
|
||||||
wondershaper_upspeed: "1024"
|
wondershaper_upspeed: "1024"
|
||||||
|
|
||||||
# WiFi
|
# WiFi
|
||||||
host_ssid: IIAB
|
host_ssid: IIAB
|
||||||
hostapd_wait: 10
|
hostapd_wait: 10
|
||||||
|
@ -15,6 +41,7 @@ host_country_code: US
|
||||||
hostapd_secure: True
|
hostapd_secure: True
|
||||||
hostapd_password: "iiab2017"
|
hostapd_password: "iiab2017"
|
||||||
driver_name: nl80211
|
driver_name: nl80211
|
||||||
|
|
||||||
network_config_dir: /etc/network/interfaces.d
|
network_config_dir: /etc/network/interfaces.d
|
||||||
iiab_network_mode: "Gateway"
|
iiab_network_mode: "Gateway"
|
||||||
dns_jail_enabled: False
|
dns_jail_enabled: False
|
||||||
|
|
|
@ -155,7 +155,7 @@
|
||||||
|
|
||||||
- name: Add location section to config file
|
- name: Add location section to config file
|
||||||
ini_file: dest='{{ iiab_config_file }}'
|
ini_file: dest='{{ iiab_config_file }}'
|
||||||
section=network
|
section=computed_network
|
||||||
option='{{ item.option }}'
|
option='{{ item.option }}'
|
||||||
value='{{ item.value }}'
|
value='{{ item.value }}'
|
||||||
with_items:
|
with_items:
|
||||||
|
|
|
@ -20,40 +20,6 @@
|
||||||
device_gw2: "{{ prior_gw.stdout }}"
|
device_gw2: "{{ prior_gw.stdout }}"
|
||||||
when: not first_run and prior_gw is defined and prior_gw.stdout != ""
|
when: not first_run and prior_gw is defined and prior_gw.stdout != ""
|
||||||
|
|
||||||
#pause checking
|
|
||||||
|
|
||||||
# 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 -c2 "{{ ansible_default_ipv4.gateway }}" &> /dev/null ; echo $?
|
|
||||||
register: gw_active_test
|
|
||||||
when: discovered_wan_iface != "none"
|
|
||||||
|
|
||||||
- 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: Setting wan if detected
|
- name: Setting wan if detected
|
||||||
set_fact:
|
set_fact:
|
||||||
iiab_wan_iface: "{{ discovered_wan_iface }}"
|
iiab_wan_iface: "{{ discovered_wan_iface }}"
|
||||||
|
@ -193,14 +159,10 @@
|
||||||
|
|
||||||
- name: Add location section to config file
|
- name: Add location section to config file
|
||||||
ini_file: dest='{{ iiab_config_file }}'
|
ini_file: dest='{{ iiab_config_file }}'
|
||||||
section=network
|
section=detected_network
|
||||||
option='{{ item.option }}'
|
option='{{ item.option }}'
|
||||||
value='{{ item.value }}'
|
value='{{ item.value }}'
|
||||||
with_items:
|
with_items:
|
||||||
- option: 'gw_active'
|
|
||||||
value: '{{ gw_active }}'
|
|
||||||
- option: 'internet_available'
|
|
||||||
value: '{{ internet_available }}'
|
|
||||||
- option: 'has_ifcfg_gw'
|
- option: 'has_ifcfg_gw'
|
||||||
value: '{{ has_ifcfg_gw }}'
|
value: '{{ has_ifcfg_gw }}'
|
||||||
- option: 'discovered_wan_iface'
|
- option: 'discovered_wan_iface'
|
|
@ -1,3 +1,9 @@
|
||||||
|
- include: detected_network.yml
|
||||||
|
when: not installing
|
||||||
|
tags:
|
||||||
|
- network
|
||||||
|
- network-discover
|
||||||
|
|
||||||
- include: computed_network.yml
|
- include: computed_network.yml
|
||||||
when: not installing
|
when: not installing
|
||||||
tags:
|
tags:
|
||||||
|
|
37
runansible
37
runansible
|
@ -1,4 +1,8 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
PLAYBOOK="iiab.yml"
|
||||||
|
INVENTORY="ansible_hosts"
|
||||||
|
# Pass cmdline options for ansible
|
||||||
|
ARGS="$@"
|
||||||
|
|
||||||
# copy var files to /etc/iiab for subsequent use
|
# copy var files to /etc/iiab for subsequent use
|
||||||
mkdir -p /etc/iiab
|
mkdir -p /etc/iiab
|
||||||
|
@ -28,13 +32,14 @@ fi
|
||||||
if [ -f /etc/iiab/iiab.env ]
|
if [ -f /etc/iiab/iiab.env ]
|
||||||
then
|
then
|
||||||
. /etc/iiab/iiab.env
|
. /etc/iiab/iiab.env
|
||||||
cd $XSCE_DIR
|
cd $IIAB_DIR
|
||||||
else
|
else
|
||||||
XSCE_DIR=/opt/iiab/iiab
|
IIAB_DIR=/opt/iiab/iiab
|
||||||
mkdir -p /etc/iiab
|
mkdir -p /etc/iiab
|
||||||
fi
|
fi
|
||||||
|
CWD=`pwd`
|
||||||
|
|
||||||
if [ ! -f iiab.yml ]
|
if [ ! -f $PLAYBOOK ]
|
||||||
then
|
then
|
||||||
echo "IIAB Playbook not found."
|
echo "IIAB Playbook not found."
|
||||||
echo "Please run this command from the top level of the git repo."
|
echo "Please run this command from the top level of the git repo."
|
||||||
|
@ -47,34 +52,10 @@ if [ ! -f /etc/ansible/facts.d/local_facts.fact ]; then
|
||||||
fi
|
fi
|
||||||
cp ./scripts/local_facts.fact /etc/ansible/facts.d/local_facts.fact
|
cp ./scripts/local_facts.fact /etc/ansible/facts.d/local_facts.fact
|
||||||
|
|
||||||
PLAYBOOK="iiab.yml"
|
|
||||||
INVENTORY="ansible_hosts"
|
|
||||||
CWD=`pwd`
|
|
||||||
echo "Running local playbooks! "
|
echo "Running local playbooks! "
|
||||||
|
|
||||||
XSDOMAIN=""
|
|
||||||
|
|
||||||
# Pass in Existing Domain
|
export ANSIBLE_LOG_PATH="$CWD/iiab-install.log"
|
||||||
if [ -f /etc/sysconfig/xs_domain_name ]
|
|
||||||
then
|
|
||||||
XSDOMAIN=`cat /etc/sysconfig/xs_domain_name`
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Or accept Domain on command line
|
|
||||||
if [ x"$1" != x ]
|
|
||||||
then
|
|
||||||
XSDOMAIN=$1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Pass in git location
|
|
||||||
if [ x"$XSDOMAIN" != x ]
|
|
||||||
then
|
|
||||||
ARGS="--extra-vars '{\"iiab_domain\":\"$XSDOMAIN\"}'"
|
|
||||||
else
|
|
||||||
ARGS=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
export ANSIBLE_LOG_PATH="$XSCE_DIR/iiab-install.log"
|
|
||||||
ansible -m setup -i $INVENTORY localhost --connection=local >> /dev/null
|
ansible -m setup -i $INVENTORY localhost --connection=local >> /dev/null
|
||||||
|
|
||||||
ansible-playbook -i $INVENTORY $PLAYBOOK ${ARGS} --connection=local
|
ansible-playbook -i $INVENTORY $PLAYBOOK ${ARGS} --connection=local
|
||||||
|
|
23
runtags
23
runtags
|
@ -1,20 +1,19 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
PLAYBOOK="iiab.yml"
|
||||||
# copy var files to /etc/iiab for subsequent use
|
INVENTORY="ansible_hosts"
|
||||||
|
# Pass cmdline options for ansible
|
||||||
#./install-init
|
|
||||||
|
|
||||||
# if not the first run, repo location is here
|
|
||||||
|
|
||||||
if [ -f /etc/iiab/iiab.env ]
|
if [ -f /etc/iiab/iiab.env ]
|
||||||
then
|
then
|
||||||
. /etc/iiab/iiab.env
|
. /etc/iiab/iiab.env
|
||||||
cd $XSCE_DIR
|
cd $IIAB_DIR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f iiab.yml ]
|
CWD=`pwd`
|
||||||
|
|
||||||
|
if [ ! -f $PLAYBOOK ]
|
||||||
then
|
then
|
||||||
echo "XSCE Playbook not found."
|
echo "IIAB Playbook not found."
|
||||||
echo "Please run this command from the top level of the git repo."
|
echo "Please run this command from the top level of the git repo."
|
||||||
echo "Exiting."
|
echo "Exiting."
|
||||||
exit
|
exit
|
||||||
|
@ -36,7 +35,7 @@ found="N"
|
||||||
|
|
||||||
for tag in $tags
|
for tag in $tags
|
||||||
do
|
do
|
||||||
if [ "$tag" == "prep" ]
|
if [ "$tag" == "init" ]
|
||||||
then
|
then
|
||||||
found="Y"
|
found="Y"
|
||||||
fi
|
fi
|
||||||
|
@ -48,8 +47,8 @@ taglist=$1
|
||||||
|
|
||||||
if [ "$found" == "N" ]
|
if [ "$found" == "N" ]
|
||||||
then
|
then
|
||||||
taglist="prep,"$taglist
|
taglist="init,"$taglist
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export ANSIBLE_LOG_PATH="$XSCE_DIR/iiab-debug.log"
|
export ANSIBLE_LOG_PATH="$CWD/iiab-debug.log"
|
||||||
ansible-playbook -i ansible_hosts iiab.yml --connection=local --tags="""$taglist"""
|
ansible-playbook -i ansible_hosts iiab.yml --connection=local --tags="""$taglist"""
|
||||||
|
|
Loading…
Reference in a new issue