User Actions for Common Fleet Patching and Provisioning Tasks
You can use Fleet Patching and Provisioning user actions to perform many tasks, such as installing and configuring any type of software and running scripts.
Deploying a Web Server
The following procedure demonstrates automated deployment of Apache Web Server using Fleet Patching and Provisioning:
- Create a script to install Apache Web server, as follows:
- On the Fleet Patching and Provisioning Server, download and extract the Apache Web server installation kit.
- Create the script to install, configure, and start the Apache Web server.
- Register the script as a user action with Fleet Patching and Provisioning by running the following command on the Fleet Patching and Provisioning Server:
rhpctl useraction -useraction apachestart -actionscript /user1/useractions/apacheinstall.sh -post -optype ADD_WORKINGCOPY -onerror ABORT
The preceding command adds the
apachestart
user action for the action script stored in the specified directory. As per the specified properties, the user action runs after theADD_WORKINGCOPY
operation and aborts if there is any error. - Create an image type and associate the user action with the image type, as follows:
rhpctl add imagetype -imagetype apachetype -basetype SOFTWARE -useraction "apachestart"
The preceding command creates a new image type called
apachetype
, a derivative of the basic image type,SOFTWARE
, with an associated user actionapachestart
. - Create a gold image of the image type, as follows:
rhpctl import image -image apacheinstall -path /user1/apache2219_kit/ -imagetype apachetype
The preceding command creates a gold image,
apacheinstall
, with the script for Apache Web server installation, in the specified path, based on theimagetype
you created earlier.To view the properties of this image, run the
rhpctl query image -image apacheinstall
command. - Deploy a working copy of the gold image on the target, as follows:
rhpctl add workingcopy -workingcopy apachecopy -image apacheinstall -path /user1/apacheinstallloc -sudouser user1 -sudopath /usr/local/bin/sudo -node node1 -user user1 -useractiondata "/user1/apachehome:1080:2.2.19"
Fleet Patching and Provisioning provisions the software to the target and runs the
apachestart
script specified in the user action. You can provide the Apache Web server configuration details such as port number with theuseractiondata
option. If the target is a Fleet Patching and Provisioning Client, then you need not specifysudo
credentials.
Registering Multiple Scripts Using a Single User Action
Run multiple scripts as part of a user action plug-in by registering a wrapper script and bundled custom scripts. The wrapper script extracts the bundled scripts, which are copied under the directory of the wrapper script, and then runs those extracted scripts as necessary, similar to the following procedure:
- The following command creates a user action called
ohadd_ua
, and associates a wrapper script,wc_add.sh
, with a zip file containing other scripts:rhpctl add useraction -useraction ohadd_ua -actionscript /scratch/crsusr/wc_add.sh -actionfile /scratch/crsusr/pack.zip -pre -runscope ALLNODES -optype ADD_WORKINGCOPY
The wrapper script,
wc_add.sh
, extracts thepack.zip
file into the script path, a temporary path to which the user action scripts are copied. The wrapper script can invoke any scripts contained in the file. - The following command creates an image type,
sw_ua
, for theohadd_ua
user action:rhpctl add imagetype -imagetype sw_ua -useractions ohadd_ua -basetype SOFTWARE
- The following command creates an image called
swimgua
from the software specified in the path:rhpctl import image -image swimgua -path /tmp/custom_sw -imagetype sw_ua
- The following command adds a working copy called
wcua
and runs thewc_add.sh
script:rhpctl add workingcopy -workingcopy wcua -image swimgua -client targetcluster
Parent topic: Oracle Fleet Patching and Provisioning Use Cases