UCSD - Application Stack with Custom Button

Version 10
    Task NameMy Application
    Description
    1. Provide drop down for catalog item to select different applications to be installed
    Prerequisites
    1. Tested on 4.1.0.3B
    CategoryWorkflow
    ComponentsvSphere 5.x
    User Inputs
    1. Select application
    Output

    Instructions for Regular Workflow Use:

    1. Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
    2. Unzip the file on your computer. Should end up with a .WFD file.
    3. Log in to UCS Director as a user that has "system-admin" privileges.
    4. Navigate to "Policies-->Orchestration" and click on "Import".
    5. Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
    6. Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
    7. Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
    8. Click "Submit".
    9. A new folder should appear in "Policies-->Orchestration" that contains the imported workflow. You will now need to update the included tasks with information about the specific environment.

     

    Catalog Ordering (User)

    ==================

     

    Screen Shot 2014-06-04 at 11.04.52 AM.png

     

    Select VDC

     

    Screen Shot 2014-06-04 at 11.05.13 AM.png

     

    Select the application

     

    Screen Shot 2014-06-04 at 11.05.23 AM.png

     

    Screen Shot 2014-06-04 at 11.05.31 AM.png

     

     

    Catalog Creation (Admin)

    ===================

     

    Create catalog item with prepared image (template)

    Screen Shot 2014-06-04 at 11.06.18 AM.png

     

    Select Post Provisioning Workflow

    Screen Shot 2014-06-04 at 11.06.27 AM.png

    VM context is set in two places (Workflow Global and VIX task):

     

    Screen Shot 2016-03-03 at 10.18.17 PM.png

     

    Screen Shot 2016-03-03 at 10.18.38 PM.png

     

    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

     

    Screen Shot 2014-06-04 at 11.18.53 AM.png

    Custom "My Application" Button for user

    =============================

     

    Create new Action/add to existing action

     

    Screen Shot 2014-06-04 at 11.26.51 AM.png

     

    Item to add/extend

    Screen Shot 2014-06-04 at 11.27.00 AM.png

    Screen Shot 2014-06-04 at 11.27.35 AM.png

     

    Action needs to be added to the VDC!

     

    User perspective - new button

     

    Screen Shot 2014-06-04 at 11.28.25 AM.png

     

     

     

     

     

     

    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