mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
Startup (#85)
* 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:
parent
0f9d25ab7c
commit
dfe68e63fa
16 changed files with 66 additions and 36 deletions
|
|
@ -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 }}'
|
||||
|
|
|
|||
|
|
@ -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 }}
|
||||
|
|
|
|||
|
|
@ -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 }}
|
||||
|
|
|
|||
|
|
@ -1,65 +0,0 @@
|
|||
#!/bin/bash
|
||||
OS=`grep ^ID= /etc/*release|cut -d= -f2`
|
||||
OS=${OS//\"/}
|
||||
|
||||
# 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
|
||||
|
||||
# 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
|
||||
|
||||
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"}
|
||||
EOF
|
||||
|
|
@ -32,3 +32,4 @@
|
|||
value: '{{ ansible_date_time["iso8601"] }}'
|
||||
- option: 'install_xo'
|
||||
value: '{{ xo_model }}'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue