Commit 9a580929 authored by Kristopher Ruzic's avatar Kristopher Ruzic

Revert base-setup, move startup script to ansible install

parent c97a705e
......@@ -12,7 +12,7 @@ fi
source /tmp/function-common
function download_playbook {
DFILE="/opt/slapos.playbook/"
DFILE="/tmp/tmpplaybook$(basename $0).$$/"
TFILE="archive.tar.gz"
mkdir -p $DFILE
cd $DFILE
......
......@@ -2,40 +2,19 @@
PLAYBOOK_REPOSITORY_URL=https://lab.nexedi.cn/rafael/slapos.playbook/repository/archive.tar.gz?ref=master
PLAYBOOK_FILE=erp5-standalone.yml
STARTUP_FILE=/usr/local/bin/erp5-startup
EXE_PATH="`dirname \"$0\"`"
echo "Running from $EXE_PATH"
#### First run of this script ####
if [ -f $STARTUP_FILE ]; then
# let the user know
echo "Script has been run previously, use the script in /usr/local/bin unless upgrading"
else
# save the startup script to /usr/local/bin
# and mark it as executable
# temporary download url
wget --no-check-certificate https://lab.nexedi.cn/krruzic/slapos.playbook/raw/master/install/erp5-startup -O $STARTUP_FILE
chmod -x $STARTUP_FILE
# add as the second to last line (last line is `exit 0`)
sed -i -e '$i \bash /usr/local/bin/erp5-startup &\n' /etc/rc.local
echo "Script added to startup"
fi
#### Setup Ansible and load few libraries #####
BASE_SETUP_SCRIPT_MD5=e2c9b43ccff6e606ad25cd1df0e2705f
mkdir -p /opt/slapos.playbook/
wget --no-check-certificate https://deploy.nexedi.cn/base-setup -O /opt/slapos.playbook/base-setup
wget --no-check-certificate https://deploy.nexedi.cn/base-setup -O /tmp/base-setup
if [ "`md5sum /opt/slapos.playbook/base-setup | cut -f1 -d\ `" != "$BASE_SETUP_SCRIPT_MD5" ]; then
echo "ERROR: base-setup has wrong md5 `md5sum /opt/slapos.playbook/base-setup | cut -f1 -d\ ` != $BASE_SETUP_SCRIPT_MD5"
if [ "`md5sum /tmp/base-setup | cut -f1 -d\ `" != "$BASE_SETUP_SCRIPT_MD5" ]; then
echo "ERROR: base-setup has wrong md5 `md5sum /tmp/base-setup | cut -f1 -d\ ` != $BASE_SETUP_SCRIPT_MD5"
exit 1
fi
source /opt/slapos.playbook/base-setup
source /tmp/base-setup
download_playbook $PLAYBOOK_REPOSITORY_URL
......
#!/bin/bash
# Reruns the ansible playbook, does nothing else
PLAYBOOK_ROOT=/opt/slapos.playbook/playbook/
PLAYBOOK_FILE=erp5-standalone.yml
source /opt/slapos.playbook/base-setup
cd $PLAYBOOK_ROOT # cd into the playbook directory
echo "Starting Ansible playbook:"
ansible-playbook $PLAYBOOK_FILE -i hosts --connection=local
ansible-playbook $PLAYBOOK_FILE -i hosts --connection=local
......@@ -14,3 +14,12 @@
- name: Request ERP5 Cluster
shell: cat /tmp/playbook-request-erp5-cluster | slapos console
- name: Add startup script
copy: src=erp5-startup dest=/usr/local/bin/erp5-startup mode=755
- name: Add to rc.local
shell: sed -i -e '$i \bash /usr/local/bin/erp5-startup &\n' /etc/rc.local
- name: Move playbooks to permanent location
shell: cp
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment