AO Peer One-hit Silent Installer Script

Version 6
    Share This:

    The script below can be used to perform a complete AO peer installation (e.g. AM, Repo, CDP, OCP) with a single command. This can be very useful for initial installation, testing different configurations, rebuilding test environments, or performing upgrades across multiple environments.

     

    This script also does the following:

    • Unsets the DISPLAY environment variable to avoid AWT errors with some Linux distros.
    • Creates a user under which to run the AO components (default is "orchestrator").
    • Changes ownership of all AO component files to the above user.
    • Sets each component to launch as the above user.
    • Creates symlinks into init.d.
    • Configures the start and stop priorities for chkconfig so the services start on boot.
    • Enables the use of the "service" command for starting and stopping components (e.g. "service baocdp stop").

     

    You must provide the fully configured silent install files for each component that you wish to install. Also note that once the CDP has been installed, you still need to manually create additional peers in Grid Manager before you can install them.

     

    Example silent installation scripts have been attached to this document as a zip file. The basic items that must be changed for your environment are marked with "##"; you may also wish to change other items such as port numbers.

     

    Update 22nd November 2017: The script still works with AO 7.9.x, though there's no support for installing an external RSSO automatically. You can use the embedded RSSO by setting the options files appropriately, or use an existing, external instance of RSSO. Also, we're still using the old SysV-style init scripts, where most recent Linux distros have moved to systemd. Getting the systemd unit files to work correctly needs a bit of work so, in the meantime, below is a very basic unit file if you're in dire need of one. Note that it doesn't handle unexpected service termination in a clever way and might require "systemctl stop baocdp" before a start in order to set the correct unit status.

     

    # Systemd unit file for Atrium Orchestrator CDP
    [Unit]
    Description=BMC Atrium Orchestrator CDP
    After=syslog.target network.target
    
    [Service]
    Type=oneshot
    RemainAfterExit=True
    
    ExecStart=/opt/bmc/BAO/CDP/bin/bao.sh start
    ExecStop=/opt/bmc/BAO/CDP/bin/bao.sh stop
    
    # Note: don't use the "RUN_AS_USER" in bao.sh if the User and Group are set in this file
    User=orchestrator
    Group=orchestrator
    
    [Install]
    WantedBy=multi-user.target
    

     

    This file is placed under /etc/systemd/system as, for example, baocdp.service and then run (as root or via sudo):

    systemctl enable baocdp
    systemctl start baocdp
    

     

    History

    v1.01 (29th Feb 2012): If set, use IATEMPDIR to find the installation log-file

    v1.02 (16th Jul 2013): Explicitly use /sbin folder for service/chkconfig. Updated binary installer filename to latest 7.6.02 version.

    v1.03 (22nd Nov 2017): Hacky support for the default folders in 7.9 whilst keeping service names in lower-case.

     

    #!/bin/bash
    #
    # Purpose: Automate the installation of multiple AO components on a single peer.
    #
    # Author: Gordon Mckeown - gordon_mckeown@bmc.com
    #
    # This script is provided "as is" with no warranty, expressed or implied.
    # Use at your own risk.
    #
    # Version: 1.03
    
    AO_SERVER_INSTALLER=./linux_bao_server_installer_7_9_01_003.sh
    AO_SILENT="-i silent"
    SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
    unset LAX_DEBUG
    unset DISPLAY
    INSTALL_BASE=/opt/bmc/BAO
    AO_USER="orchestrator"
    
    if [ -z "$IATEMPDIR" ]; then
            IATEMPDIR=/tmp
    fi
    
    installComponent() {
    # Parameters:
    #     $1 = Name of options file
    #     $2 = ID for the app (used to define the init script names)
    #     $3 = Directory name
    #     $4 = Start priority for service
    #     $5 = Kill priority for service
    
         OPTIONS=$1
         APPID=$2
         DIRNAME=$3
         STARTPRI=$4
         KILLPRI=$5
    
         CMD_LINE="$AO_SERVER_INSTALLER $AO_SILENT -DOPTIONS_FILE=$SCRIPT_DIR/$OPTIONS"
         echo -e "\n\n"; echo $CMD_LINE
         $CMD_LINE
         RC=$?
         echo Return code was $RC
    
         if [ "$RC" -eq "1" ] || [ "$RC" -eq "0" ]; then
              echo "Installer returned with a good exit code."
         else
              echo "Installer returned with an error code. Abort!"
              grep -B 1 SEVERE $IATEMPDIR/BAO_install_log.txt | tail -n 5
              exit -1
         fi
    
         sed -i.bak -e"s/\(RUN_AS_USER=\).*/\1$AO_USER/" -e"s/\(# chkconfig: \).*/\102345 $STARTPRI $KILLPRI/" $INSTALL_BASE/$DIRNAME/bin/bao.sh
         ln -s $INSTALL_BASE/$DIRNAME/bin/bao.sh /etc/init.d/$APPID
         chown -R $AO_USER.$AO_USER $INSTALL_BASE/$DIRNAME
         /sbin/chkconfig $APPID on
         /sbin/service $APPID start
    }
    
    # Add user under which the AO daemons will run
    
    id $AO_USER &> /dev/null
    if [ "$?" -eq "0" ]; then
         echo "User $AO_USER already exists. No need to create it."
    else
         echo "Adding user $AO_USER."
         useradd $AO_USER
    fi
    
    echo "Creating install base directory and setting ownership..."
    mkdir -p $INSTALL_BASE
    chown $AO_USER:$AO_USER $INSTALL_BASE
    
    installComponent prod-grid1-cdp1-repo.txt baorepo REPO 96 97                 # Install RSSO/Repository
    installComponent prod-grid1-cdp1-cdp.txt baocdp CDP 97 96                    # Install CDP
    
    echo -e "\n\nInstallation completed.\n"