Commit c93ce0f7 authored by Ioannis Tsafaras's avatar Ioannis Tsafaras
Browse files

Script for creating service VM image

parent 4fd66b54
#!/bin/bash
# Log file path
LOGFILE="/root/ansible-vm-init.log"
log(){
message=$1
echo "$(date): $message" >> $LOGFILE
}
start(){
# Initialize VM with ansible
log "Initializing VM with ansible"
ansible-playbook -i "localhost," -c local /var/www/okeanos-LoD/webapp/ansible/playbooks/image-configure.yml --tags "image-configure" >> $LOGFILE 2>&1
retVal=$?
if [ $retVal -eq 0 ]
then
log "Ansible VM initialization successful"
rm /etc/init.d/ansible-vm-init
update-rc.d ansible-vm-init remove
else
log "Ansible VM initialization failed with return value $retVal"
fi
return 0
}
case "$1" in
start)
start
;;
*)
echo "Usage: $0 start"
esac
#!/bin/bash
# Setup default site
/var/www/okeanos-LoD/webapp/image/setup_default_site.sh &&
# Copy and enable run-once init script
cp /var/www/okeanos-LoD/webapp/image/ansible-vm-init /etc/init.d/ &&
update-rc.d ansible-vm-init start 3 &&
# Run snf-image-creator
snf-image-creator /
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