1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00
* move local_facts, test for it, cp if necess

* got os wrong -- not OS

* change /etc/*release, vars/filenames

* add os_ver

* add os_ver to iiab.env

* remove uuid generation for local_facts

* next

* delete debugging lines

* fetch the uuid, and put it in ini file

* be more specific about uuid

* need braces in set_fact

* hyphen in OS-version

* go back to OS.yml based upon os_ver

* remove debug

* oops VERSION_ID->OS_VER

* issure error message when OS not in case statement
This commit is contained in:
georgejhunt 2017-07-04 13:07:47 -07:00 committed by GitHub
parent 0f9d25ab7c
commit dfe68e63fa
16 changed files with 66 additions and 36 deletions

53
scripts/local_facts.fact Executable file
View file

@ -0,0 +1,53 @@
#!/bin/bash
OS=`grep ^ID= /etc/*elease|cut -d= -f2`
OS=${OS//\"/}
VERSION_ID=`grep VERSION_ID /etc/*elease | cut -d= -f2`
VERSION_ID=${VERSION_ID//\"/}
VERSION_ID=${VERSION_ID%%.*}
OS_VER=$OS-$VERSION_ID
case $OS_VER in
"fedora-18" | \
"fedora-22" | \
"debian-8" | \
"debian-9" | \
"ubuntu-16" | \
"centos-7" | \
"raspbian-8") break
;;
*) OS_VER="OS_not_supported"
;;
esac
# get current version
BRANCH=`git rev-parse --abbrev-ref HEAD`
COMMIT=`git rev-parse --verify HEAD`
if [ -d /usr/lib64/php ]
then
PHPLIB_DIR=/usr/lib64/php
else
if [ -d /usr/lib/php5 ]; then
PHPLIB_DIR=/usr/lib/php5
else
PHPLIB_DIR=/usr/lib/php
fi
fi
if [ -f /proc/device-tree/mfg-data/MN ]
then
XO_VERSION=`cat /proc/device-tree/mfg-data/MN`
else
XO_VERSION="none"
fi
ANSIBLE_VERSION=$(ansible --version|head -n 1|cut -f 2 -d " ")
cat <<EOF
{"phplib_dir" : "$PHPLIB_DIR",
"iiab_branch" : "$BRANCH",
"iiab_commit" : "$COMMIT",
"xo_model" : "$XO_VERSION",
"ansble_version" : "$ANSIBLE_VERSION",
"os" : "$OS",
"os_ver" : "$OS_VER}
EOF