mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Merge pull request #2579 from holta/lint-for-release-2
Lint for release: scripts/local_facts.fact & remove legacy "tags:" from 6 remaining files (.yml's)
This commit is contained in:
commit
15f598c121
7 changed files with 101 additions and 85 deletions
|
@ -9,10 +9,10 @@
|
||||||
- /etc/iiab/iiab_state.yml
|
- /etc/iiab/iiab_state.yml
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- { role: 0-init, tags: ['0-init'] }
|
- { role: 0-init }
|
||||||
- { role: 4-server-options, tags: ['4-server-options'] }
|
- { role: 4-server-options }
|
||||||
- { role: 5-xo-services, tags: ['5-xo-services'] }
|
- { role: 5-xo-services }
|
||||||
- { role: 6-generic-apps, tags: ['6-generic-apps'] }
|
- { role: 6-generic-apps }
|
||||||
- { role: 7-edu-apps, tags: ['7-edu-apps'] }
|
- { role: 7-edu-apps }
|
||||||
- { role: 8-mgmt-tools, tags: ['8-mgmt-tools'] }
|
- { role: 8-mgmt-tools }
|
||||||
- { role: 9-local-addons, tags: ['9-local-addons'] }
|
- { role: 9-local-addons }
|
||||||
|
|
|
@ -9,11 +9,11 @@
|
||||||
- /etc/iiab/iiab_state.yml
|
- /etc/iiab/iiab_state.yml
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- { role: 0-init, tags: ['0-init'] }
|
- { role: 0-init }
|
||||||
- { role: 4-server-options, tags: ['4-server-options'] }
|
- { role: 4-server-options }
|
||||||
- { role: 5-xo-services, tags: ['5-xo-services'] }
|
- { role: 5-xo-services }
|
||||||
- { role: 6-generic-apps, tags: ['6-generic-apps'] }
|
- { role: 6-generic-apps }
|
||||||
- { role: 7-edu-apps, tags: ['7-edu-apps'] }
|
- { role: 7-edu-apps }
|
||||||
- { role: 8-mgmt-tools, tags: ['8-mgmt-tools'] }
|
- { role: 8-mgmt-tools }
|
||||||
- { role: 9-local-addons, tags: ['9-local-addons'] }
|
- { role: 9-local-addons }
|
||||||
- { role: network, tags: ['network'] }
|
- { role: network }
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
- /etc/iiab/iiab_state.yml
|
- /etc/iiab/iiab_state.yml
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- { role: 0-init, tags: ['network'] }
|
- { role: 0-init }
|
||||||
- { role: network, tags: ['network','base'] }
|
- { role: network }
|
||||||
|
|
|
@ -14,63 +14,52 @@
|
||||||
- name: 0-init
|
- name: 0-init
|
||||||
include_role:
|
include_role:
|
||||||
name: 0-init
|
name: 0-init
|
||||||
tags: 0-init
|
|
||||||
|
|
||||||
- name: 1-prep
|
- name: 1-prep
|
||||||
include_role:
|
include_role:
|
||||||
name: 1-prep
|
name: 1-prep
|
||||||
when: ansible_local.local_facts.stage|int < 1
|
when: ansible_local.local_facts.stage|int < 1
|
||||||
tags: 1-prep, platform, base
|
|
||||||
|
|
||||||
- name: 2-common
|
- name: 2-common
|
||||||
include_role:
|
include_role:
|
||||||
name: 2-common
|
name: 2-common
|
||||||
when: ansible_local.local_facts.stage|int < 2
|
when: ansible_local.local_facts.stage|int < 2
|
||||||
tags: 2-common, base
|
|
||||||
|
|
||||||
- name: 3-base-server
|
- name: 3-base-server
|
||||||
include_role:
|
include_role:
|
||||||
name: 3-base-server
|
name: 3-base-server
|
||||||
when: ansible_local.local_facts.stage|int < 3
|
when: ansible_local.local_facts.stage|int < 3
|
||||||
tags: 3-base-server, base
|
|
||||||
|
|
||||||
- name: 4-server-options
|
- name: 4-server-options
|
||||||
include_role:
|
include_role:
|
||||||
name: 4-server-options
|
name: 4-server-options
|
||||||
when: ansible_local.local_facts.stage|int < 4
|
when: ansible_local.local_facts.stage|int < 4
|
||||||
tags: 4-server-options
|
|
||||||
|
|
||||||
- name: 5-xo-services
|
- name: 5-xo-services
|
||||||
include_role:
|
include_role:
|
||||||
name: 5-xo-services
|
name: 5-xo-services
|
||||||
when: ansible_local.local_facts.stage|int < 5
|
when: ansible_local.local_facts.stage|int < 5
|
||||||
tags: 5-xo-services
|
|
||||||
|
|
||||||
- name: 6-generic-apps
|
- name: 6-generic-apps
|
||||||
include_role:
|
include_role:
|
||||||
name: 6-generic-apps
|
name: 6-generic-apps
|
||||||
when: ansible_local.local_facts.stage|int < 6
|
when: ansible_local.local_facts.stage|int < 6
|
||||||
tags: 6-generic-apps
|
|
||||||
|
|
||||||
- name: 7-edu-apps
|
- name: 7-edu-apps
|
||||||
include_role:
|
include_role:
|
||||||
name: 7-edu-apps
|
name: 7-edu-apps
|
||||||
when: ansible_local.local_facts.stage|int < 7
|
when: ansible_local.local_facts.stage|int < 7
|
||||||
tags: 7-edu-apps
|
|
||||||
|
|
||||||
- name: 8-mgmt-tools
|
- name: 8-mgmt-tools
|
||||||
include_role:
|
include_role:
|
||||||
name: 8-mgmt-tools
|
name: 8-mgmt-tools
|
||||||
when: ansible_local.local_facts.stage|int < 8
|
when: ansible_local.local_facts.stage|int < 8
|
||||||
tags: 8-mgmt-tools
|
|
||||||
|
|
||||||
- name: 9-local-addons
|
- name: 9-local-addons
|
||||||
include_role:
|
include_role:
|
||||||
name: 9-local-addons
|
name: 9-local-addons
|
||||||
when: ansible_local.local_facts.stage|int < 9
|
when: ansible_local.local_facts.stage|int < 9
|
||||||
tags: 9-local-addons
|
|
||||||
|
|
||||||
- name: Network
|
- name: Network
|
||||||
include_role:
|
include_role:
|
||||||
name: network
|
name: network
|
||||||
tags: network
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
- /etc/iiab/local_vars.yml
|
- /etc/iiab/local_vars.yml
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- { role: 0-init, tags: ['0-init'] }
|
- { role: 0-init }
|
||||||
- { role: sshd, tags: ['sshd'] }
|
- { role: sshd }
|
||||||
- { role: iiab-admin, tags: ['iiab-admin'] }
|
- { role: iiab-admin }
|
||||||
- { role: openvpn, tags: ['openvpn'] }
|
- { role: openvpn }
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
- /etc/iiab/iiab_state.yml
|
- /etc/iiab/iiab_state.yml
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- { role: 0-init, tags: ['0-init'] }
|
- { role: 0-init }
|
||||||
- { role: "{{ role_to_run }}", tags: ['run'] }
|
- { role: "{{ role_to_run }}" }
|
||||||
|
|
|
@ -1,25 +1,47 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# upgrades return found, clean installs return 0
|
# 2020-10-19: Most of the 12 variables require a command[*] to be run to
|
||||||
# interruptions return last stage number recorded (1-9)
|
# establish the var's value. WE DISPLAY ALL ERRORS / DIAGNOSTICS AND CONTINUE.
|
||||||
if [ -f /etc/iiab/iiab.env ]; then
|
#
|
||||||
source /etc/iiab/iiab.env
|
# [*] DOESN'T MATTER WHAT COMMAND: so long as it fails with Return Code != 0
|
||||||
STAGE=$STAGE
|
# If statements then use that RC to force the var to these default values...
|
||||||
else
|
|
||||||
STAGE=0
|
|
||||||
fi
|
|
||||||
|
|
||||||
OS=`grep ^ID= /etc/*elease|cut -d= -f2`
|
STAGE=0
|
||||||
OS=${OS//\"/}
|
OS="none"
|
||||||
|
VERSION_ID="none" # This var's combined with the above, before being output
|
||||||
|
IIAB_BRANCH="none"
|
||||||
|
IIAB_COMMIT="none"
|
||||||
|
PHPLIB_DIR="none"
|
||||||
|
XO_MODEL="none"
|
||||||
|
RPI_MODEL="none"
|
||||||
|
ANSIBLE_VERSION="none"
|
||||||
|
DHCPCD="none" # The last 3 conditioned on string output not RC. SEE BELOW.
|
||||||
|
NETWORK_MANAGER="none"
|
||||||
|
SYSTEMD_NETWORKD="none"
|
||||||
|
|
||||||
|
|
||||||
|
# STAGE variable is for ./iiab-install which runs Ansible with iiab-stages.yml
|
||||||
|
# - fresh installs start at STAGE 0
|
||||||
|
# - interrupted installs record the last completed STAGE (1-9)
|
||||||
|
#
|
||||||
|
# We initialize it to '0' (zero) to cover the following 2 possibs: (1) iiab.env
|
||||||
|
# doesn't exist, or (2) iiab.env exists but fails to set STAGE=<something>
|
||||||
|
source /etc/iiab/iiab.env || true # STAGE var auto-set, so no "if" required.
|
||||||
|
|
||||||
|
if tmp=$(grep ^ID= /etc/*elease); then
|
||||||
|
OS=$(echo $tmp | cut -d= -f2)
|
||||||
|
OS=${OS//\"/} # Remove all '"'
|
||||||
|
fi
|
||||||
if [ -f /etc/rpi-issue ]; then
|
if [ -f /etc/rpi-issue ]; then
|
||||||
OS="raspbian"
|
OS="raspbian"
|
||||||
fi
|
fi
|
||||||
VERSION_ID=`grep VERSION_ID /etc/*elease | cut -d= -f2`
|
|
||||||
VERSION_ID=${VERSION_ID//\"/}
|
if tmp=$(grep ^VERSION_ID= /etc/*elease); then
|
||||||
VERSION_ID=${VERSION_ID%%.*}
|
VERSION_ID=$(echo $tmp | cut -d= -f2)
|
||||||
|
VERSION_ID=${VERSION_ID//\"/} # Remove all '"'
|
||||||
|
VERSION_ID=${VERSION_ID%%.*} # Remove all '.' & stuff to the right of em
|
||||||
|
fi
|
||||||
OS_VER=$OS-$VERSION_ID
|
OS_VER=$OS-$VERSION_ID
|
||||||
DHCPCD_PATH=`which dhcpcd`
|
|
||||||
NM_PATH=`which NetworkManager`
|
|
||||||
|
|
||||||
# Previously supported Linux distributions / versions:
|
# Previously supported Linux distributions / versions:
|
||||||
#"fedora-18" | \
|
#"fedora-18" | \
|
||||||
|
@ -44,56 +66,61 @@ case $OS_VER in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# get current version
|
# These next 2 help indicate what version of IIAB
|
||||||
BRANCH=`git rev-parse --abbrev-ref HEAD`
|
tmp=$(git rev-parse --abbrev-ref HEAD) &&
|
||||||
COMMIT=`git rev-parse --verify HEAD`
|
IIAB_BRANCH=$tmp
|
||||||
|
|
||||||
|
tmp=$(git rev-parse --verify HEAD) &&
|
||||||
|
IIAB_COMMIT=$tmp
|
||||||
|
|
||||||
if [ -d /usr/lib64/php ]; then
|
if [ -d /usr/lib64/php ]; then
|
||||||
PHPLIB_DIR=/usr/lib64/php
|
PHPLIB_DIR=/usr/lib64/php
|
||||||
else
|
elif [ -d /usr/lib/php5 ]; then
|
||||||
if [ -d /usr/lib/php5 ]; then
|
PHPLIB_DIR=/usr/lib/php5
|
||||||
PHPLIB_DIR=/usr/lib/php5
|
elif [ -d /usr/lib/php ]; then
|
||||||
else
|
PHPLIB_DIR=/usr/lib/php
|
||||||
PHPLIB_DIR=/usr/lib/php
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /proc/device-tree/mfg-data/MN ]; then
|
tmp=$(cat /proc/device-tree/mfg-data/MN) &&
|
||||||
XO_VERSION=`cat /proc/device-tree/mfg-data/MN`
|
XO_MODEL=$tmp
|
||||||
else
|
|
||||||
XO_VERSION="none"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f /proc/device-tree/model ]; then
|
tmp=$(cat /proc/device-tree/model) &&
|
||||||
RPI_VERSION=`cat /proc/device-tree/model`
|
RPI_MODEL=$tmp
|
||||||
else
|
|
||||||
RPI_VERSION="none"
|
|
||||||
fi
|
|
||||||
|
|
||||||
ANSIBLE_VERSION=$(ansible --version|head -n 1|cut -f 2 -d " ")
|
tmp=$(ansible --version) &&
|
||||||
|
ANSIBLE_VERSION=$(echo $tmp | head -n 1 | cut -f 2 -d " ")
|
||||||
|
|
||||||
|
|
||||||
|
# THESE LAST 3 ARE DIFFEENT as "systemctl is-enabled" unhelpfully returns the
|
||||||
|
# same rerror code (i.e. 1) REGARDLESS whether service is (A) disabled or
|
||||||
|
# (B) doesn't exist. SO WE TEST THE STRING OUTPUT INSTEAD OF THE RETURN CODE.
|
||||||
|
|
||||||
|
tmp=$(systemctl is-enabled dhcpcd)
|
||||||
|
[[ $tmp != "" ]] &&
|
||||||
|
DHCPCD=$tmp
|
||||||
|
#[[ $tmp ]] && DHCPCD=$tmp # Short Ain't Sweet (less understandable)
|
||||||
|
|
||||||
|
# Debian family only, as is_redhat would use NetworkManager as the service name
|
||||||
|
tmp=$(systemctl is-enabled network-manager)
|
||||||
|
[[ $tmp != "" ]] &&
|
||||||
|
NETWORK_MANAGER=$tmp
|
||||||
|
|
||||||
|
tmp=$(systemctl is-enabled systemd-networkd)
|
||||||
|
[[ $tmp != "" ]] &&
|
||||||
|
SYSTEMD_NETWORKD=$tmp
|
||||||
|
|
||||||
if [ ! x$DHCPCD_PATH = x ]; then
|
|
||||||
DHCPCD=`systemctl is-enabled dhcpcd`
|
|
||||||
fi
|
|
||||||
# the check is debian family only is_redhat would use NetworkManager as the
|
|
||||||
# service name.
|
|
||||||
if [ ! x$NM_PATH = x ]; then
|
|
||||||
NM=`systemctl is-enabled network-manager`
|
|
||||||
fi
|
|
||||||
SYSD_NETD=`systemctl is-enabled systemd-networkd`
|
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
{"phplib_dir" : "$PHPLIB_DIR",
|
{"phplib_dir" : "$PHPLIB_DIR",
|
||||||
"stage" : "$STAGE",
|
"stage" : "$STAGE",
|
||||||
"dhcpcd" : "$DHCPCD",
|
"dhcpcd" : "$DHCPCD",
|
||||||
"network_manager" : "$NM",
|
"network_manager" : "$NETWORK_MANAGER",
|
||||||
"systemd_networkd" : "$SYSD_NETD",
|
"systemd_networkd" : "$SYSTEMD_NETWORKD",
|
||||||
"iiab_branch" : "$BRANCH",
|
"iiab_branch" : "$IIAB_BRANCH",
|
||||||
"iiab_commit" : "$COMMIT",
|
"iiab_commit" : "$IIAB_COMMIT",
|
||||||
"xo_model" : "$XO_VERSION",
|
"xo_model" : "$XO_MODEL",
|
||||||
"rpi_model" : "$RPI_VERSION",
|
"rpi_model" : "$RPI_MODEL",
|
||||||
"ansible_version" : "$ANSIBLE_VERSION",
|
"ansible_version" : "$ANSIBLE_VERSION",
|
||||||
"os" : "$OS",
|
"os" : "$OS",
|
||||||
"os_ver" : "$OS_VER"}
|
"os_ver" : "$OS_VER"}
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue