06-04-2014 07:59 AM - edited 03-01-2019 06:29 AM
Task Name | My Application |
Description |
|
Prerequisites |
|
Category | Workflow |
Components | vSphere 5.x |
User Inputs |
|
Output |
Instructions for Regular Workflow Use:
Catalog Ordering (User)
==================
Select VDC
Select the application
Catalog Creation (Admin)
===================
Create catalog item with prepared image (template)
Select Post Provisioning Workflow
VM context is set in two places (Workflow Global and VIX task):
Preparation of Image
================
1) Have vmware tools installed
2) Copy the RedHat iso to the /opt directory
i.e
rhel-server-6.2-x86_64-dvd.iso
3) Add this to the /etc/yum.conf file
[rhel-cd]
name=Red Hat Enterprise Linux $releasever - $basearch - CD
baseurl=file:///mnt/disk/Server/
enabled=1
gpgcheck=0
4) Create this file /usr/local/etc/MyApplication
#!/bin/bash
#
# Orf Gelbrich
# 6-2-2014
#
# Install My application
#
date >> /tmp/myapplication.log
echo "==============================" >> /tmp/myapplication.log
if [ "$1" = "mount" ] ; then
echo $1 >> /tmp/myapplication.log
mkdir -p /mnt/disk
cd /opt
mount -o loop /opt/rhel-server-6.2-x86_64-dvd.iso /mnt/disk
fi
if [ "$1" = "umount" ] ; then
echo $1 >> /tmp/myapplication.log
umount /mnt/disk
fi
if [ "$1" = "install" -a "$2" = "httpd" ] ; then
echo $1 $2 >> /tmp/myapplication.log
yes | yum install $2
service iptables save >> /tmp/myapplication.log
service iptables stop >> /tmp/myapplication.log
chkconfig iptables off >> /tmp/myapplication.log
chkconfig httpd on >> /tmp/myapplication.log
echo "MyApplication..." >> /var/www/error/noindex.html
echo `hostname` >> /var/www/error/noindex.html
echo "..." >> /var/www/error/noindex.html
date >> /var/www/error/noindex.html
fi
if [ "$1" = "httpd" -a "$2" = "start" ] ; then
echo $1 $2 >> /tmp/myapplication.log
service $1 start
fi
if [ "$1" = "httpd" -a "$2" = "stop" ] ; then
echo $1 $2 >> /tmp/myapplication.log
service $1 stop
fi
if [ "$1" = "install" -a "$2" = "ftpd" ] ; then
echo $1 $2 >> /tmp/myapplication.log
echo server >> /tmp/myapplication.log
yes | yum install vsftpd.x86_64
service iptables save >> /tmp/myapplication.log
service iptables stop >> /tmp/myapplication.log
chkconfig iptables off >> /tmp/myapplication.log
chkconfig vsftpd on >> /tmp/myapplication.log
fi
if [ "$1" = "ftpd" -a "$2" = "start" ] ; then
echo $1 $2 >> /tmp/myapplication.log
service vsftpd start
fi
if [ "$1" = "ftpd" -a "$2" = "stop" ] ; then
echo $1 $2 >> /tmp/myapplication.log
service vsftpd stop
fi
if [ "$1" = "install" -a "$2" = "ftp" ] ; then
echo $1 $2 >> /tmp/myapplication.log
echo client >> /tmp/myapplication.log
yes | yum install ftp.x86_64
fi
if [ "$1" = "install" -a "$2" = "telnet" ] ; then
echo $1 $2 >> /tmp/myapplication.log
echo client >> /tmp/myapplication.log
yes | yum install telnet.x86_64
fi
if [ "$1" = "install" -a "$2" = "samba" ] ; then
echo $1 $2 >> /tmp/myapplication.log
yes | yum install samba*
fi
if [ "$1" = "samba" -a "$2" = "start" ] ; then
echo $1 $2 >> /tmp/myapplication.log
service smb start
fi
if [ "$1" = "samba" -a "$2" = "stop" ] ; then
echo $1 $2 >> /tmp/myapplication.log
service smb stop
fi
if [ "$1" = "install" -a "$2" = "tftp" ] ; then
echo $1 $2 >> /tmp/myapplication.log
echo client >> /tmp/myapplication.log
yes | yum install tftp.x86_64
fi
if [ "$1" = "install" -a "$2" = "tftpd" ] ; then
echo $1 $2 >> /tmp/myapplication.log
yes | yum install tftp-server.x86_64
fi
if [ "$1" = "tftpd" -a "$2" = "start" ] ; then
echo $1 $2 >> /tmp/myapplication.log
/sbin/chkconfig --level 345 xinetd on
/sbin/chkconfig --level 345 tftp on
fi
if [ "$1" = "tftpd" -a "$2" = "stop" ] ; then
echo $1 $2 >> /tmp/myapplication.log
/sbin/chkconfig --level 345 tftp off
fi
if [ "$1" = "install" -a "$2" = "postgresql" ] ; then
echo $1 $2 >> /tmp/myapplication.log
yes | yum install postgresql*
fi
if [ "$1" = "postgresql" -a "$2" = "start" ] ; then
echo $1 $2 >> /tmp/myapplication.log
/sbin/chkconfig --level 345 postgresql on
service postgresql initdb
service postgresql start
fi
if [ "$1" = "postgresql" -a "$2" = "stop" ] ; then
echo $1 $2 >> /tmp/myapplication.log
/sbin/chkconfig --level 345 postgresql off
service postgresql stop
fi
Testing
======
Order a web server and http to the IP of the newly created server
Custom "My Application" Button for user
=============================
Create new Action/add to existing action
Item to add/extend
Action needs to be added to the VDC!
User perspective - new button
Trouble Shooting
=============
tail -f /tmp/myapplication.log
mount
Wed Jun 4 08:47:01 PDT 2014
==============================
mount
Wed Jun 4 08:47:17 PDT 2014
==============================
install httpd
Wed Jun 4 08:47:29 PDT 2014
==============================
httpd start
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: