E37467
This commit is contained in:
parent
022d6aa4f8
commit
4e06b1eb56
@ -1,2 +1,7 @@
|
|||||||
---
|
---
|
||||||
message: "This node is using common data"
|
message: "This node is using common data"
|
||||||
|
controlm::controlm_agent::agent2server_port: 17005
|
||||||
|
controlm::controlm_agent::server2agent_port: 17006
|
||||||
|
controlm::controlm_agent::tracker_port: 17035
|
||||||
|
controlm::controlm_agent::server_host: ctmgnpappla013
|
||||||
|
controlm::controlm_agent::primary_server_host: ctmgnpappla013.optus.com.au
|
||||||
|
BIN
site-modules/.DS_Store
vendored
BIN
site-modules/.DS_Store
vendored
Binary file not shown.
BIN
site-modules/controlm/.DS_Store
vendored
Normal file
BIN
site-modules/controlm/.DS_Store
vendored
Normal file
Binary file not shown.
96
site-modules/controlm/README.md
Normal file
96
site-modules/controlm/README.md
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
This installs the Optus standard controlm.
|
||||||
|
|
||||||
|
All hiera is managed in the approproate pp file under manifests and the various child .pp files use inherit to see the variables.
|
||||||
|
|
||||||
|
# CONTROLM AGENT
|
||||||
|
All hiera has defaults. You will probably only need to set servers if anything.
|
||||||
|
|
||||||
|
## Software and patches
|
||||||
|
The install script installs the main software and the patches as I couldn't get the patch script to run properly after the main install script. Patches are defaulted to the current ones or set in heira
|
||||||
|
controlm::controlm_agent::patch_files:
|
||||||
|
- file1
|
||||||
|
- file2
|
||||||
|
|
||||||
|
|
||||||
|
## Servers
|
||||||
|
if the client is in a different domain to the server (eg client is nix.au.singtelgroup.net and server is optus.com.au) then need FQDN as below, else can use short form in both
|
||||||
|
```
|
||||||
|
controlm::controlm_agent::primary_server_host: ctmgnpappla012.optus.com.au
|
||||||
|
controlm::controlm_agent::server_host: ctmgnpappla012
|
||||||
|
```
|
||||||
|
Note that you need to be able to contact the host[s] on the server2agent port listed in controlm_agent.pp for the install to work.
|
||||||
|
|
||||||
|
All DEV (DEV,PPT, SIT, GNP etc) must use ctmgnpappla012 as the control-m server, all PRD non BCC Agents must use ctmprdappla003.
|
||||||
|
|
||||||
|
|
||||||
|
## Admins
|
||||||
|
You need accounts for the admins and schedulers as below, subbing PRD for GNP in prd:
|
||||||
|
```
|
||||||
|
isnd_linux::profiles::soe::login_accounts::groups:
|
||||||
|
- 'ocaus01\ACL-GNP-CTRLM-rwx-SMT-ADMIN':
|
||||||
|
additional_groups:
|
||||||
|
- controlm
|
||||||
|
- 'ocaus01\ACL-GNP-CTRLM-rx-SMT-SCHED':
|
||||||
|
additional_groups:
|
||||||
|
- controlm
|
||||||
|
|
||||||
|
tpiam::profiles::sudoers:
|
||||||
|
ocaus01aclgnpctrlmrwxsmtadmin:
|
||||||
|
runas_users:
|
||||||
|
- ctmagent
|
||||||
|
commands: all_commands
|
||||||
|
ocaus01aclgnpctrlmrxsmtsched:
|
||||||
|
runas_users:
|
||||||
|
- ctmagent
|
||||||
|
commands: all_commands include controlm::controlm_agent::users
|
||||||
|
|
||||||
|
```
|
||||||
|
## To reinstall
|
||||||
|
```
|
||||||
|
userdel -r ctmagent
|
||||||
|
yum remove ctmagent_core_clean
|
||||||
|
rm -rf /apps/bmc
|
||||||
|
```
|
||||||
|
# ctm.sh fails
|
||||||
|
If puppet complains about ctm.sh, be sure everything is running as root properly. The install should do this, but exec is never reliable
|
||||||
|
```
|
||||||
|
[root@bdpprdedgla001 scripts_optus]# pwd
|
||||||
|
/apps/bmc/ctm/scripts_optus
|
||||||
|
[root@bdpprdedgla001 scripts_optus]# ./ctm.sh stop
|
||||||
|
Stopping Control-M Agent
|
||||||
|
Killing Control-M/Agent Listener pid:23639
|
||||||
|
2018-01-09 11:06:33 Listener process stopped
|
||||||
|
Killing Control-M/Agent Tracker pid:23693
|
||||||
|
2018-01-09 11:06:34 Tracker process stopped
|
||||||
|
```
|
||||||
|
it might complain, so if it does, do as it says:
|
||||||
|
```
|
||||||
|
[root@bdpprdedgla002 scripts_optus]# ./ctm.sh stop
|
||||||
|
Stopping Control-M Agent
|
||||||
|
The agent is currently running as 'ctmagent'
|
||||||
|
You need to login as 'ctmagent' and run this command again
|
||||||
|
```
|
||||||
|
so su - ctmagent, run the stop command and then as root
|
||||||
|
```
|
||||||
|
[root@bdpprdedgla001 scripts_optus]# ./ctm.sh mode_full
|
||||||
|
Sudo mode is disabled
|
||||||
|
|
||||||
|
/apps/bmc/ctm/exe/vault/su_bmc ownership set to ctmagent
|
||||||
|
/apps/bmc/ctm/exe/vault/su_bmc setuid bit was reset
|
||||||
|
/apps/bmc/ctm/sysout permissions set to 755 without sticky bit
|
||||||
|
/apps/bmc/ctm/sysout setgid bit was reset
|
||||||
|
/apps/bmc/ctm/non-root deleted
|
||||||
|
|
||||||
|
Non-root mode was disabled.
|
||||||
|
|
||||||
|
[root@bdpprdedgla001 scripts_optus]# ./ctm.sh start
|
||||||
|
|
||||||
|
|
||||||
|
Starting the agent as 'root' user
|
||||||
|
|
||||||
|
Control-M/Agent Listener started. pid: 10838
|
||||||
|
Control-M/Agent Tracker started. pid: 10892
|
||||||
|
|
||||||
|
Control-M/Agent started successfully.
|
||||||
|
Control-M Agent Started
|
||||||
|
```
|
4
site-modules/controlm/files/controlm.csh
Normal file
4
site-modules/controlm/files/controlm.csh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
setenv PATH ${PATH}:/apps/bmc/ctm/exe:/apps/bmc/ctm/scripts:/apps/bmc/ctm/scripts_optus
|
||||||
|
setenv CONTROLM /apps/bmc/ctm
|
||||||
|
setenv LD_LIBRARY_PATH /apps/bmc/ctm/exe
|
||||||
|
|
7
site-modules/controlm/files/controlm.sh
Normal file
7
site-modules/controlm/files/controlm.sh
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
CONTROLM=/apps/bmc/ctm
|
||||||
|
export CONTROLM
|
||||||
|
PATH=${PATH}:/apps/bmc/ctm/exe:/apps/bmc/ctm/scripts:/apps/bmc/ctm/scripts_optus
|
||||||
|
export PATH
|
||||||
|
LD_LIBRARY_PATH=/apps/bmc/ctm/exe
|
||||||
|
export LD_LIBRARY_PATH
|
||||||
|
|
11
site-modules/controlm/files/controlm_agent_install.sh
Normal file
11
site-modules/controlm/files/controlm_agent_install.sh
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cd /apps/bmc/
|
||||||
|
sudo -u ctmagent /apps/bmc/software/version_9/setup.sh -silent /apps/bmc/ctm/ctm_silentinstall_optus.xml
|
||||||
|
RESULT=$?
|
||||||
|
echo "exit status $RESULT"
|
||||||
|
/bin/date > /apps/bmc/ctm/controlm_agent_install.hasrun
|
||||||
|
echo "exit status $RESULT" >> /apps/bmc/ctm/controlm_agent_install.hasrun
|
||||||
|
echo "do not remove this file unless you want to rerun the install" >> /apps/bmc/ctm/controlm_agent_install.hasrun
|
||||||
|
chmod 444 /apps/bmc/ctm/controlm_agent_install.hasrun
|
||||||
|
exit $RESULT
|
||||||
|
|
49
site-modules/controlm/files/ctm.sh
Normal file
49
site-modules/controlm/files/ctm.sh
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Startup Script for Control-M Agent Daemons
|
||||||
|
# Creation Date: 2016-09-09
|
||||||
|
# Created By: David Stephenson
|
||||||
|
# Version: 1.0
|
||||||
|
|
||||||
|
# chkconfig: 2345 99 05
|
||||||
|
# description: Controlm agent
|
||||||
|
|
||||||
|
|
||||||
|
CTM_Dir=/apps/bmc/ctm
|
||||||
|
CTM_OWNER=ctmagent
|
||||||
|
CTM_GROUP=controlm
|
||||||
|
|
||||||
|
chown $CTM_OWNER:$CTM_GROUP $CTM_Dir/proclog/*.log
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
'start')
|
||||||
|
cd $CTM_Dir/scripts
|
||||||
|
./start-ag -u $CTM_OWNER -p ALL -s
|
||||||
|
if [ "$?" = 0 ] ; then
|
||||||
|
touch /var/lock/subsys/ctm
|
||||||
|
echo "Control-M Agent Started"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
'stop')
|
||||||
|
cd $CTM_Dir/scripts
|
||||||
|
echo "Stopping Control-M Agent"
|
||||||
|
./shut-ag -u $CTM_OWNER -p ALL
|
||||||
|
RETVAL=$?
|
||||||
|
echo
|
||||||
|
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ctm;
|
||||||
|
;;
|
||||||
|
'mode_user')
|
||||||
|
cd $CTM_Dir/scripts
|
||||||
|
./set_agent_mode -u $CTM_OWNER -o 1
|
||||||
|
;;
|
||||||
|
'mode_full')
|
||||||
|
cd $CTM_Dir/scripts
|
||||||
|
./set_agent_mode -u $CTM_OWNER -o 2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: /<install-dir>/ctm.sh { start | stop }"
|
||||||
|
echo "or, if using sudo...."
|
||||||
|
echo "Usage: sudo -u root ./ctm.sh { start | stop | mode_user | mode_full }"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
exit 0
|
||||||
|
|
39
site-modules/controlm/files/setup_patch.sh
Executable file
39
site-modules/controlm/files/setup_patch.sh
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Description:
|
||||||
|
# This setup.sh find and run the install-bin that is compatible to the installing environment
|
||||||
|
|
||||||
|
# Find this script's directory
|
||||||
|
utl_dir=`dirname $0`
|
||||||
|
|
||||||
|
# set the INSTALL_BINs directory
|
||||||
|
bin_dir=$utl_dir
|
||||||
|
|
||||||
|
# get all the INSTALL_BINs
|
||||||
|
install_bin_list=`ls $bin_dir | grep INSTALL.BIN`
|
||||||
|
|
||||||
|
#get shell to be used to run "BIN" files
|
||||||
|
__machine=`uname`
|
||||||
|
shellInterpriter="/bin/ksh"
|
||||||
|
if [ $__machine = "Linux" ] ; then
|
||||||
|
shellInterpriter="/bin/sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# loop on the install_bin_list and find the first one that is compatible with the environment
|
||||||
|
for install_bin in $install_bin_list
|
||||||
|
do
|
||||||
|
${shellInterpriter} $bin_dir/$install_bin -m
|
||||||
|
if [ $? -eq 0 ];then
|
||||||
|
# Current install_bin is compatible with the environment was found, run it to install the FP
|
||||||
|
$bin_dir/$install_bin $@
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ERROR: There is no available installation file for this platform: `uname -a`
|
||||||
|
echo Installation files were found for the following platforms:
|
||||||
|
echo ${install_bin_list}| tr " " "\n" | cut -f 2 -d_ | cut -f 1 -d.
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
|
48
site-modules/controlm/files/sleep.sh
Normal file
48
site-modules/controlm/files/sleep.sh
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Sleep Script for Control-M
|
||||||
|
# Use to Test Control-M Scheduling
|
||||||
|
# Creation Date: 2016-09-09
|
||||||
|
# Created By: David Stephenson
|
||||||
|
# Version: 1.0
|
||||||
|
exec 2> /dev/null
|
||||||
|
echo "********************************"
|
||||||
|
echo "** CONTROL-M Environment **"
|
||||||
|
echo "********************************"
|
||||||
|
echo PATH := $PATH
|
||||||
|
echo LD_LIBRARY_PATH:= $LD_LIBRARY_PATH
|
||||||
|
echo CONTROLM := $CONTROLM
|
||||||
|
echo ""
|
||||||
|
echo "********************************"
|
||||||
|
echo "** Arguments passed to script **"
|
||||||
|
echo "********************************"
|
||||||
|
echo Number of ARGS: = $#
|
||||||
|
echo ARGS := $*
|
||||||
|
echo ""
|
||||||
|
echo "********************************"
|
||||||
|
echo "** Script Run times **"
|
||||||
|
echo "********************************"
|
||||||
|
echo START := $(date)
|
||||||
|
|
||||||
|
# Default RC to 0
|
||||||
|
RC=0
|
||||||
|
|
||||||
|
# Search ARGS for RC=xxx If found Return an Error Code
|
||||||
|
while (( "$#" )); do
|
||||||
|
arg=$(echo $1 | awk '{ print $1 }')
|
||||||
|
if [ "$arg" -eq "$arg" ] 2>/dev/null; then
|
||||||
|
echo SLEEP := $arg SECONDS
|
||||||
|
sleep $1 > /dev/null
|
||||||
|
fi
|
||||||
|
echo $arg | grep -qi "rc="
|
||||||
|
if [ "$?" -eq "0" ]; then
|
||||||
|
RC=$(echo $arg | grep -i "rc=" | awk -F= '{ print $2 }')
|
||||||
|
echo "RETURN CODE ARGUMENT: 'RC=$RC' FOUND. RETURN CODE '$RC' SENT TO CONTROL_M"
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
echo END := $(date)
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
exit $RC
|
||||||
|
|
0
site-modules/controlm/files/ztest
Normal file
0
site-modules/controlm/files/ztest
Normal file
BIN
site-modules/controlm/manifests/.DS_Store
vendored
Normal file
BIN
site-modules/controlm/manifests/.DS_Store
vendored
Normal file
Binary file not shown.
56
site-modules/controlm/manifests/controlm_agent.pp
Normal file
56
site-modules/controlm/manifests/controlm_agent.pp
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
class controlm::controlm_agent {
|
||||||
|
|
||||||
|
#used for the automated install file and firewall.
|
||||||
|
|
||||||
|
#MUST HAVE THESE TWO IN HIERA, use fqdn for primary if host in diff domain.
|
||||||
|
#controlm::controlm_agent::primary_server_host: ctmgnpappla012.optus.com.au
|
||||||
|
#controlm::controlm_agent::server_host: ctmgnpappla012
|
||||||
|
$server_host = hiera('controlm::controlm_agent::server_host','ctmgnpappla012')
|
||||||
|
$primary_server_host = hiera('controlm::controlm_agent::primary_server_host','ctmgnpappla012.optus.com.au')
|
||||||
|
|
||||||
|
$tracker_port = hiera('controlm::controlm_agent::tracker_port','7035')
|
||||||
|
$a2s_port = hiera('controlm::controlm_agent::agent2server_port','7005')
|
||||||
|
$s2a_port = hiera('controlm::controlm_agent::server2agent_port','7006')
|
||||||
|
$tcp_timeout = hiera('controlm::controlm_agent::tcp_timeout','60')
|
||||||
|
$ignore_fail = hiera('controlm::controlm_agent::ignore_fail',false)
|
||||||
|
$force_upgrade = hiera('controlm::controlm_agent::force_upgrade',false)
|
||||||
|
|
||||||
|
$software_version = hiera('controlm::controlm_agent::version','9.0.00-2')
|
||||||
|
|
||||||
|
$patch_files = hiera('controlm::controlm_agent::patch_files',['PAKAI.9.0.00.100_Linux-x86_64_INSTALL.BIN','PAKAI.9.0.00.200_Linux-x86_64_INSTALL.BIN'])
|
||||||
|
# array of patch files so
|
||||||
|
# controlm::controlm_agent::patch_files:
|
||||||
|
# - file1
|
||||||
|
# - file2
|
||||||
|
# patch files are not installed separately from main install as timing that was
|
||||||
|
# not working. So if we get new patches probably best to install by hand or see
|
||||||
|
# if you can get a separate script happening.
|
||||||
|
|
||||||
|
# also in hiera you need these, subbing PRD for GNP where needed
|
||||||
|
# isnd_linux::profiles::soe::login_accounts::groups:
|
||||||
|
# - 'ocaus01\ACL-GNP-CTRLM-rwx-SMT-ADMIN':
|
||||||
|
# additional_groups:
|
||||||
|
# - controlm
|
||||||
|
# - 'ocaus01\ACL-GNP-CTRLM-rx-SMT-SCHED':
|
||||||
|
# additional_groups:
|
||||||
|
# - controlm
|
||||||
|
#
|
||||||
|
# tpiam::profiles::sudoers:
|
||||||
|
# ocaus01aclgnpctrlmrwxsmtadmin:
|
||||||
|
# runas_users:
|
||||||
|
# - ctmagent
|
||||||
|
# commands: all_commands
|
||||||
|
# ocaus01aclgnpctrlmrxsmtsched:
|
||||||
|
# runas_users:
|
||||||
|
# - ctmagent
|
||||||
|
# commands: all_commands include controlm::controlm_agent::users
|
||||||
|
|
||||||
|
include controlm::controlm_agent::users
|
||||||
|
include controlm::controlm_agent::packages
|
||||||
|
include controlm::controlm_agent::files
|
||||||
|
include controlm::controlm_agent::firewall
|
||||||
|
include controlm::controlm_agent::install
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
153
site-modules/controlm/manifests/controlm_agent/files.pp
Normal file
153
site-modules/controlm/manifests/controlm_agent/files.pp
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
class controlm::controlm_agent::files inherits controlm::controlm_agent {
|
||||||
|
|
||||||
|
# Directories
|
||||||
|
unless defined(File['/apps']) {
|
||||||
|
file { [ '/apps', ]:
|
||||||
|
ensure => 'directory',
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0755',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
file { [ '/apps/bmc',]:
|
||||||
|
ensure => 'directory',
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0755',
|
||||||
|
require => File['/apps'],
|
||||||
|
}
|
||||||
|
file { [ '/apps/bmc/software','/apps/bmc/software/version_9/','/apps/bmc/software/version_9/fixes' ]:
|
||||||
|
ensure => 'directory',
|
||||||
|
owner => 'ctmagent',
|
||||||
|
group => 'controlm',
|
||||||
|
mode => '0755',
|
||||||
|
require => File['/apps/bmc'],
|
||||||
|
}
|
||||||
|
|
||||||
|
# scripts_optus
|
||||||
|
|
||||||
|
file { ['/apps/bmc/ctm/scripts_optus']:
|
||||||
|
ensure => directory,
|
||||||
|
owner => 'ctmagent',
|
||||||
|
group => 'controlm',
|
||||||
|
mode => '0775',
|
||||||
|
require => User['ctmagent'],
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/apps/bmc/ctm/scripts_optus/sleep.sh':
|
||||||
|
ensure => file,
|
||||||
|
owner => 'ctmagent',
|
||||||
|
group => 'controlm',
|
||||||
|
mode => '0755',
|
||||||
|
source => 'puppet:///modules/controlm/sleep.sh',
|
||||||
|
require => [File['/apps/bmc/ctm/scripts_optus'],User['ctmagent'],],
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/apps/bmc/ctm/scripts_optus/ctm.sh':
|
||||||
|
ensure => file,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0755',
|
||||||
|
source => 'puppet:///modules/controlm/ctm.sh',
|
||||||
|
require => File['/apps/bmc/ctm/scripts_optus'],
|
||||||
|
}
|
||||||
|
|
||||||
|
case $::os['release']['major']{
|
||||||
|
'6': {
|
||||||
|
file { '/etc/rc.d/init.d/ctm.sh':
|
||||||
|
ensure => link,
|
||||||
|
target => '/apps/bmc/ctm/scripts_optus/ctm.sh',
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
require => File['/apps/bmc/ctm/scripts_optus/ctm.sh'],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'7': {
|
||||||
|
|
||||||
|
file { '/etc/rc.d/init.d/ctm.sh':
|
||||||
|
ensure => absent,
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/etc/rc.d/init.d/ctm':
|
||||||
|
ensure => file,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0755',
|
||||||
|
source => 'puppet:///modules/controlm/ctm.sh',
|
||||||
|
notify => Exec['systemctl reload daemon for Control-M agent']
|
||||||
|
}
|
||||||
|
|
||||||
|
exec{'systemctl reload daemon for Control-M agent':
|
||||||
|
path => $::path,
|
||||||
|
command => 'systemctl daemon-reload',
|
||||||
|
refreshonly => true,
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
default: {fail "Unsupported Major version ${::os['release']['major']} detected"}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ctm/scripts
|
||||||
|
|
||||||
|
# file { '/apps/bmc/ctm/scripts':
|
||||||
|
# ensure => link,
|
||||||
|
# target => '/apps/bmc/software/version_9/ctm/scripts',
|
||||||
|
# owner => 'root',
|
||||||
|
# group => 'root',
|
||||||
|
# require => Package['ctmagent_core_clean'],
|
||||||
|
# }
|
||||||
|
|
||||||
|
# install scripts
|
||||||
|
|
||||||
|
file { '/apps/bmc/ctm/ctm_silentinstall_optus.xml':
|
||||||
|
ensure => file,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0755',
|
||||||
|
content => template('controlm/agent_install.erb'),
|
||||||
|
require => User['ctmagent'],
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/apps/bmc/ctm/controlm_agent_install.sh':
|
||||||
|
ensure => file,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0755',
|
||||||
|
content => template('controlm/controlm_agent_install.erb'),
|
||||||
|
require => User['ctmagent'],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# need to check status method and also if we need restart check.
|
||||||
|
# this should be in the install Iguess
|
||||||
|
# service { 'ctm.sh':
|
||||||
|
# ensure => running,
|
||||||
|
# enable => true,
|
||||||
|
# hasstatus => false,
|
||||||
|
# status => '',
|
||||||
|
# start => '',
|
||||||
|
# stop => '',
|
||||||
|
# subscribe => [
|
||||||
|
# ],
|
||||||
|
# require => '/etc/rc.d/init.d/ctm.sh',
|
||||||
|
# }
|
||||||
|
|
||||||
|
# profile scripts
|
||||||
|
file { '/etc/profile.d/controlm.csh':
|
||||||
|
ensure => file,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0755',
|
||||||
|
source => 'puppet:///modules/controlm/controlm.csh',
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/etc/profile.d/controlm.sh':
|
||||||
|
ensure => file,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0755',
|
||||||
|
source => 'puppet:///modules/controlm/controlm.sh',
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
16
site-modules/controlm/manifests/controlm_agent/firewall.pp
Normal file
16
site-modules/controlm/manifests/controlm_agent/firewall.pp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
class controlm::controlm_agent::firewall inherits controlm::controlm_agent {
|
||||||
|
|
||||||
|
|
||||||
|
firewall { '200 controlm tracker port hiera controlm_tracker_port':
|
||||||
|
action => 'accept',
|
||||||
|
proto => 'tcp',
|
||||||
|
dport => [$tracker_port],
|
||||||
|
}
|
||||||
|
|
||||||
|
firewall { '210 controlm server to agent hiera controlm_server2agent_port':
|
||||||
|
action => 'accept',
|
||||||
|
proto => 'tcp',
|
||||||
|
dport => [$s2a_port],
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
59
site-modules/controlm/manifests/controlm_agent/install.pp
Normal file
59
site-modules/controlm/manifests/controlm_agent/install.pp
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
class controlm::controlm_agent::install inherits controlm::controlm_agent {
|
||||||
|
|
||||||
|
|
||||||
|
# set up /etc/services
|
||||||
|
|
||||||
|
augeas { 'controlm':
|
||||||
|
context => '/files/etc/services',
|
||||||
|
changes => [
|
||||||
|
"set service-name[port = '${s2a_port}'][protocol = 'udp'] ctmagent",
|
||||||
|
"set service-name[port = '${s2a_port}'][protocol = 'udp']/#comment 'Control-M server2agent'",
|
||||||
|
"set service-name[port = '${s2a_port}'][protocol = 'tcp'] ctmagent",
|
||||||
|
"set service-name[port = '${s2a_port}'][protocol = 'tcp']/#comment 'Control-M server2age nt'",
|
||||||
|
"set service-name[port = '${a2s_port}'][protocol = 'udp'] ctmagent",
|
||||||
|
"set service-name[port = '${a2s_port}'][protocol = 'udp']/#comment 'Control-M agent2servr'",
|
||||||
|
"set service-name[port = '${a2s_port}'][protocol = 'tcp'] ctmagent",
|
||||||
|
"set service-name[port = '${a2s_port}'][protocol = 'tcp']/#comment 'Control-M agent2server'",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# use shellscript and sudo as running the install direct as user ctmagent gives HOME errors plus we get errors in the log file
|
||||||
|
# also does patches as can't get the patch script running after it for some reason
|
||||||
|
# patch names need to be in hiera see controlm_agent.pp
|
||||||
|
exec { 'controlm_agent_install':
|
||||||
|
command => '/apps/bmc/ctm/controlm_agent_install.sh > /apps/bmc/ctm/controlm_agent_install.log',
|
||||||
|
creates => '/apps/bmc/ctm/controlm_agent_install.hasrun',
|
||||||
|
require => [User['ctmagent'],Package['ctmagent_core_clean'],File['/apps/bmc/ctm/ctm_silentinstall_optus.xml','/apps/bmc/ctm/controlm_agent_install.sh'],Exec['chown_/apps/bmc'],],
|
||||||
|
timeout => 1800,
|
||||||
|
}
|
||||||
|
|
||||||
|
case $::os['release']['major']{
|
||||||
|
'6': {
|
||||||
|
service { 'ctm.sh':
|
||||||
|
ensure => running,
|
||||||
|
enable => true,
|
||||||
|
hasstatus => false,
|
||||||
|
status => '/bin/ps -ef | /bin/grep /apps/bmc/ctm/exe/p_ctm | /bin/grep -v grep',
|
||||||
|
require => [File['/etc/rc.d/init.d/ctm.sh'],Exec['controlm_agent_install'],]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'7': {
|
||||||
|
|
||||||
|
service { 'ctm.sh':
|
||||||
|
enable => false,
|
||||||
|
}
|
||||||
|
|
||||||
|
service { 'ctm':
|
||||||
|
ensure => running,
|
||||||
|
enable => true,
|
||||||
|
hasstatus => false,
|
||||||
|
status => '/bin/ps -ef | /bin/grep /apps/bmc/ctm/exe/p_ctm | /bin/grep -v grep',
|
||||||
|
require => [File['/etc/rc.d/init.d/ctm'],Exec['controlm_agent_install']]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
default: {fail "Unsupported Major version ${::os['release']['major']} detected"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
16
site-modules/controlm/manifests/controlm_agent/packages.pp
Normal file
16
site-modules/controlm/manifests/controlm_agent/packages.pp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
class controlm::controlm_agent::packages inherits controlm::controlm_agent {
|
||||||
|
|
||||||
|
package { 'ctmagent_core_clean' :
|
||||||
|
ensure => "$software_version",
|
||||||
|
require => User['ctmagent'],
|
||||||
|
}
|
||||||
|
|
||||||
|
# the RPM does permissions, this is a backup
|
||||||
|
exec {'software permissions' :
|
||||||
|
command => '/bin/chown -R ctmagent:controlm /apps/bmc/software/version_9',
|
||||||
|
onlyif => '/usr/bin/test $(/bin/find /apps/bmc/software/version_9/CheckReq -uid 0 | w
|
||||||
|
c -l) -gt 0',
|
||||||
|
require => Package['ctmagent_core_clean'],
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
38
site-modules/controlm/manifests/controlm_agent/users.pp
Normal file
38
site-modules/controlm/manifests/controlm_agent/users.pp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
class controlm::controlm_agent::users {
|
||||||
|
|
||||||
|
unless defined(Group['controlm']) {
|
||||||
|
group { 'controlm':
|
||||||
|
ensure => present,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
user { 'ctmagent':
|
||||||
|
gid => [ 'controlm'],
|
||||||
|
home => '/apps/bmc/ctm',
|
||||||
|
comment => 'ControlM Agent',
|
||||||
|
shell => '/bin/bash',
|
||||||
|
password => '*',
|
||||||
|
managehome => true,
|
||||||
|
require => [Group['controlm'],File['/apps/bmc'],],
|
||||||
|
}
|
||||||
|
# set ownerships for /apps/bmc/ctm as needs sticky on group and install needs ctmagent to own /apps/bmc
|
||||||
|
exec { 'set permissions on /apps/bmc/ctm':
|
||||||
|
command => '/bin/chmod 2775 /apps/bmc/ctm',
|
||||||
|
onlyif => '/usr/bin/test $(/bin/find /apps/bmc/ctm -perm 2775 | wc -l) -eq 0',
|
||||||
|
require => User['ctmagent'],
|
||||||
|
}
|
||||||
|
|
||||||
|
exec { 'chown_/apps/bmc':
|
||||||
|
command => '/bin/chown ctmagent.controlm /apps/bmc',
|
||||||
|
unless => '/usr/bin/test -e /apps/bmc/ctm/controlm_agent_install.hasrun',
|
||||||
|
require => User['ctmagent'],
|
||||||
|
}
|
||||||
|
|
||||||
|
sudo::rule { 'controlm':
|
||||||
|
type => 'group',
|
||||||
|
runas_users => 'root',
|
||||||
|
commands => [
|
||||||
|
'/apps/bmc/ctm/scripts_optus/ctm.sh',
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}
|
10
site-modules/controlm/manifests/controlm_agent/z1
Normal file
10
site-modules/controlm/manifests/controlm_agent/z1
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
file { '/apps/bmc/ctm/ctm_silentinstall_optus.xml':
|
||||||
|
ensure => file,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'root',
|
||||||
|
mode => '0755',
|
||||||
|
content => template('controlm/agent_install.erb'),
|
||||||
|
require => User['ctmagent'],
|
||||||
|
}
|
||||||
|
|
13
site-modules/controlm/templates/agent_install.erb
Normal file
13
site-modules/controlm/templates/agent_install.erb
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<AutomatedInstallation langpack="eng">
|
||||||
|
<target.product>Control-M/Agent 9.0.00</target.product>
|
||||||
|
<agent.parameters>
|
||||||
|
<entry key="field.Authorized.Controlm.Server.Host" value="<%= @server_host %>"/>
|
||||||
|
<entry key="ctm_agent.Tracker.Event.Port" value="<%= @tracker_port %>"/>
|
||||||
|
<entry key="field.Agent.To.Server.Port.Number" value="<%= @a2s_port %>"/>
|
||||||
|
<entry key="ctm_agent.Tcp_ip.Timeout" value="<%= @tcp_timeout %>"/>
|
||||||
|
<entry key="field.Server.To.Agent.Port.Number" value="<%= @s2a_port %>"/>
|
||||||
|
<entry key="Ignore.Disabling.Agent.Failure" value="<%= @ignore_fail %>"/>
|
||||||
|
<entry key="ctm_agent.Force.Upgrade" value="<%= @force_upgrade %>"/>
|
||||||
|
<entry key="field.Primary.Controlm.Server.Host" value="<%= @primary_server_host %>"/>
|
||||||
|
</agent.parameters>
|
||||||
|
</AutomatedInstallation>
|
71
site-modules/controlm/templates/controlm_agent_install.erb
Normal file
71
site-modules/controlm/templates/controlm_agent_install.erb
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
#Does install and patches if any
|
||||||
|
|
||||||
|
cd /apps/bmc/
|
||||||
|
sudo -u ctmagent /apps/bmc/software/version_9/setup.sh -silent /apps/bmc/ctm/ctm_silentinstall_optus.xml
|
||||||
|
RESULT=$?
|
||||||
|
echo "exit status $RESULT"
|
||||||
|
if [ $RESULT -ne 0 ] ; then exit $RESULT; fi
|
||||||
|
/bin/date > /apps/bmc/ctm/controlm_agent_install.hasrun
|
||||||
|
echo "exit status $RESULT" >> /apps/bmc/ctm/controlm_agent_install.hasrun
|
||||||
|
echo "do not remove this file unless you want to rerun the install" >> /apps/bmc/ctm/controlm_agent_install.hasrun
|
||||||
|
chmod 444 /apps/bmc/ctm/controlm_agent_install.hasrun
|
||||||
|
|
||||||
|
|
||||||
|
<% if @patch_files -%>
|
||||||
|
/bin/date > /apps/bmc/ctm/controlm_agent_patch_install.hasrun
|
||||||
|
# remove any old patches
|
||||||
|
rm -rf /apps/bmc/software/version_9/fixes/*INSTALL.BIN
|
||||||
|
|
||||||
|
. /etc/profile.d/controlm.sh
|
||||||
|
|
||||||
|
<% @patch_files.each do | file | -%>
|
||||||
|
|
||||||
|
echo "===================="
|
||||||
|
PATCH_RESULT=1
|
||||||
|
cd /apps/bmc/software/version_9/fixes
|
||||||
|
wget http://<%= scope.lookupvar('::razor_metadata_repo_server') -%>/files/bcc_source/controlm/<%= file %>
|
||||||
|
chmod 755 /apps/bmc/software/version_9/fixes/<%= file %>
|
||||||
|
sudo -u ctmagent /bin/bash - <<EOF
|
||||||
|
cd /apps/bmc/software/version_9/fixes
|
||||||
|
. /etc/profile.d/controlm.sh
|
||||||
|
/usr/bin/yes y | /apps/bmc/software/version_9/fixes/<%= file %>
|
||||||
|
EOF
|
||||||
|
PATCH_RESULT=$?
|
||||||
|
if [ $PATCH_RESULT -ne 0 ]
|
||||||
|
then
|
||||||
|
echo "patch <%= file -%> bad $PATCH_RESULT" >> controlm_agent_patch_install.hasrun
|
||||||
|
mv /apps/bmc/ctm/controlm_agent_patch_install.hasrun /apps/bmc/ctm/controlm_agent_patch_install.bad
|
||||||
|
exit $RESULT
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "patch exit status <%= file -%> $PATCH_RESULT"
|
||||||
|
# sleep to see if patches properly install
|
||||||
|
echo "sleeping for 10 "
|
||||||
|
sleep 10
|
||||||
|
<% end -%>
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
|
# set correct hostnames
|
||||||
|
SHORT=`/bin/hostname -s`
|
||||||
|
LONG=`/bin/hostname -f`
|
||||||
|
|
||||||
|
echo "Changing short hostnames in CONFIG.dat"
|
||||||
|
cp -f /apps/bmc/ctm/data/CONFIG.dat /apps/bmc/ctm/data/CONFIG.dat.bak
|
||||||
|
/bin/sed -i "s/$SHORT$/$LONG/" /apps/bmc/ctm/data/CONFIG.dat
|
||||||
|
grep $SHORT /apps/bmc/ctm/data/CONFIG.dat
|
||||||
|
|
||||||
|
|
||||||
|
#change mode
|
||||||
|
/usr/bin/yes y | /apps/bmc/ctm/scripts/set_agent_mode -u ctmagent -o 1
|
||||||
|
|
||||||
|
# stop agent
|
||||||
|
sudo -u ctmagent /bin/bash - <<EOF
|
||||||
|
. /etc/profile.d/controlm.sh
|
||||||
|
cd /apps/bmc/ctm
|
||||||
|
/apps/bmc/ctm/scripts/shut-ag
|
||||||
|
EOF
|
||||||
|
|
||||||
|
/usr/bin/yes y | /apps/bmc/ctm/scripts/set_agent_mode -u ctmagent -o 2
|
||||||
|
|
71
site-modules/controlm/templates/rc.agent_user.erb
Executable file
71
site-modules/controlm/templates/rc.agent_user.erb
Executable file
@ -0,0 +1,71 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# chkconfig: 2345 97 02
|
||||||
|
# description: controlm agent
|
||||||
|
|
||||||
|
# set minimal PATH to make sure basic commands like grep and awk are recognized
|
||||||
|
PATH=/usr/sbin/:/usr/bin:/sbin:$PATH
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
account_name="controlm"
|
||||||
|
install_path="<%= @install_dir %>"
|
||||||
|
|
||||||
|
# set config file name
|
||||||
|
config_file=$install_path/ctm/data/CONFIG.dat
|
||||||
|
|
||||||
|
# Get the agent status
|
||||||
|
AGENT_STATUS_FILE=$install_path/ctm/data/ctm_agent_status.dat
|
||||||
|
agent_status=`cat $AGENT_STATUS_FILE`
|
||||||
|
|
||||||
|
|
||||||
|
#Get input parameter start|stop|<empty> for backward compatibility
|
||||||
|
ARG1=`echo $1 | tr '[A-Z]' '[a-z]'`
|
||||||
|
if [ "$ARG1" = "start" ] || [ "$ARG1" = "stop" ] ; then
|
||||||
|
if [ "$ARG1" = "start" ] ; then
|
||||||
|
STATE_ACTION="start"
|
||||||
|
elif [ "$ARG1" = "stop" ] ; then
|
||||||
|
STATE_ACTION="stop"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
STATE_ACTION="start"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$agent_status" = "STOPPED" ] ; then # AGENT_STATUS is set to 'STOPPED', exit without starting the Agent
|
||||||
|
echo "Control-M/Agent (account $account_name) status is set to 'STOPPED'. Control-M/Agent will not start."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# get the value for config parameter AGENT_OWNER to determine which owner should start the agent
|
||||||
|
# in case the parameter is missing or empty, start as root.
|
||||||
|
# This script is executed as root user by the OS during machine startup.
|
||||||
|
# If the agent should run as agent owner, use 'su' to run start-ag
|
||||||
|
agent_owner=`grep AGENT_OWNER $config_file | awk '{print $2}'`
|
||||||
|
|
||||||
|
if [ "$STATE_ACTION" = "start" ] ; then
|
||||||
|
|
||||||
|
if [ "$agent_owner" != "root" ] ; then
|
||||||
|
/bin/su - $agent_owner -c "$install_path/ctm/scripts/start-ag -u $account_name -p ALL"
|
||||||
|
else
|
||||||
|
$install_path/ctm/scripts/start-ag -u $account_name -p ALL
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
# backup ctm_agent_status.dat to keep origional status
|
||||||
|
TMP_FILE_NAME="ctm_agent_status_dat-`date +'%Y-%m-%d_%H-%M-%S'`.tar"
|
||||||
|
cd $install_path/ctm/data ; tar -cf $TMP_FILE_NAME ctm_agent_status.dat
|
||||||
|
|
||||||
|
if [ "$agent_owner" != "root" ] ; then
|
||||||
|
/bin/su - $agent_owner -c "$install_path/ctm/scripts/shut-ag -u $account_name -p ALL"
|
||||||
|
else
|
||||||
|
$install_path/ctm/scripts/shut-ag -u $account_name -p ALL
|
||||||
|
fi
|
||||||
|
|
||||||
|
# restore ctm_agent_status.dat to origional
|
||||||
|
cd $install_path/ctm/data ; tar -xf $TMP_FILE_NAME ; rm -f $TMP_FILE_NAME
|
||||||
|
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|
0
site-modules/controlm/templates/ztest
Normal file
0
site-modules/controlm/templates/ztest
Normal file
5
site-modules/role/manifests/callaugeas.pp
Normal file
5
site-modules/role/manifests/callaugeas.pp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
class role::callaugeas {
|
||||||
|
|
||||||
|
include controlm::controlm_agent
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user