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

View file

@ -4,7 +4,7 @@
vars_files:
- vars/default_vars.yml
- vars/{{ ansible_distribution }}.yml
- vars/{{ ansible_local.local_facts.os_ver }}.yml
- vars/local_vars.yml
- /etc/iiab/config_vars.yml

View file

@ -4,7 +4,7 @@
vars_files:
- vars/default_vars.yml
- vars/{{ ansible_distribution }}.yml
- vars/{{ ansible_local.local_facts.os_ver }}.yml
- vars/local_vars.yml
- /etc/iiab/config_vars.yml

View file

@ -4,7 +4,7 @@
vars_files:
- vars/default_vars.yml
- vars/{{ ansible_distribution }}.yml
- vars/{{ ansible_local.local_facts.os_ver }}.yml
- vars/local_vars.yml
- /etc/iiab/config_vars.yml

View file

@ -4,7 +4,7 @@
vars_files:
- vars/default_vars.yml
- vars/{{ ansible_distribution}}.yml
- vars/{{ ansible_local.local_facts.os_ver}}.yml
- vars/local_vars.yml
- /etc/iiab/config_vars.yml

View file

@ -30,5 +30,7 @@
value: '{{ ansible_local["local_facts"]["iiab_commit"] }}'
- option: 'install_date'
value: '{{ ansible_date_time["iso8601"] }}'
- option: 'Universal Unique ID (uuid)'
value: '{{ uuid }}'
- option: 'install_xo'
value: '{{ xo_model }}'

View file

@ -3,11 +3,44 @@
is_F18: True
when: ansible_distribution_release == "based on Fedora 18" or ansible_distribution_version == "18"
- name: abort if the OS is not supported
debug: msg="{{ ansible_local.local_facts.os }} Operating System is not supported"
when: ansible_local.local_facts.os_ver == "OS_not_supported"
# there may be a stop execution, but I did not find it
- pause:
when: ansible_local.local_facts.os_ver == "OS_not_supported"
- name: get the uuidgen program
package: name=uuid-runtime
state=present
when: is_debuntu
- name: Test for UUID file
stat: path=/etc/iiab/uuid
register: uuid_file
- name: Create folder to hold uuid
file: path=/etc/iiab state=directory
when: not uuid_file.stat.exists
- name: If no uuid exists, create one
shell: uuidgen
register: uuid_response
when: not uuid_file.stat.exists
- name: Put the uuid in place
shell: echo {{ uuid_response.stdout_lines[0] }} > /etc/iiab/uuid
when: not uuid_file.stat.exists
- name: get the uuid
command: cat /etc/iiab/uuid
register: stored_uuid
- name: get the value into a variable
set_fact:
uuid={{ stored_uuid.stdout_lines[0] }}
# for rpi, without rtc, we need time as soon as possible
- name: Install chrony package
package: name={{ item }}

View file

@ -2,5 +2,6 @@
# It can sourced in a shell script or read into an application
XSCE_BASE_PATH={{ iiab_base }}
XSCE_DIR={{ iiab_dir }}
OS={{ ansible_distribution }}
OS={{ ansible_local.local_facts.os }}
OS_VER={{ ansible_local.local_facts.os_ver }}
WWWROOT={{ doc_root }}

View file

@ -32,3 +32,4 @@
value: '{{ ansible_date_time["iso8601"] }}'
- option: 'install_xo'
value: '{{ xo_model }}'

View file

@ -33,6 +33,11 @@ then
exit
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
PLAYBOOK="iiab.yml"
INVENTORY="ansible_hosts"
CWD=`pwd`

View file

@ -1,16 +1,23 @@
#!/bin/bash
OS=`grep ^ID= /etc/*release|cut -d= -f2`
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
# enable this install config to be tracked
if [ ! -f /etc/iiab/uuid ]; then
uuidgen > /etc/iiab/uuid
fi
UUID=`cat /etc/iiab/uuid`
source /etc/iiab/iiab.env
cd $XSCE_DIR
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`
@ -33,33 +40,14 @@ else
XO_VERSION="none"
fi
if [ -f /etc/iiab/iiab.env ]
then
. /etc/iiab/iiab.env
if [ -z $BASE_VERSION ]
then
BASE_VERSION="0"
fi
BASE="$BASE_VERSION"
else
BASE="0"
fi
if [ -f /.preload ]
then
PRELOAD="True"
else
PRELOAD="False"
fi
ANSIBLE_VERSION=$(ansible --version|head -n 1|cut -f 2 -d " ")
cat <<EOF
{"phplib_dir" : "$PHPLIB_DIR",
"iiab_branch" : "$BRANCH",
"iiab_commit" : "$COMMIT",
"iiab_uuid" : "$UUID",
"xo_model" : "$XO_VERSION",
"iiab_base_ver" : "$BASE",
"ansble_version" : "$ANSIBLE_VERSION",
"os" : "$OS",
"iiab_preload" : "$PRELOAD"}
"os_ver" : "$OS_VER}
EOF