control-repo/site-modules/controlm/manifests/controlm_agent/install.pp

62 lines
2.5 KiB
ObjectPascal
Raw Normal View History

2019-12-19 02:17:49 +00:00
class controlm::controlm_agent::install inherits controlm::controlm_agent {
# set up /etc/services
augeas { 'controlm':
context => '/files/etc/services',
changes => [
2019-12-19 05:57:43 +00:00
"ins service-name after service-name[last()]",
2019-12-19 06:00:19 +00:00
"set service-name[last()] ctmagent",
"set service-name[. = 'ctmagent']/port ${s2a_port}",
"set service-name[. = 'ctmagent']/protocol tcp",
2019-12-19 05:11:53 +00:00
# "set service-name[port = '${s2a_port}'][protocol = 'udp']/ #comment 'Henry123']",
2019-12-19 05:49:48 +00:00
# "set service-name[port = '${s2a_port}'][protocol = 'tcp'] ctmagent",
2019-12-19 05:11:53 +00:00
# "set service-name[port = '${s2a_port}'][protocol = 'tcp']/ #comment 'Henry234']",
2019-12-19 05:49:48 +00:00
# "set service-name[port = '${a2s_port}'][protocol = 'udp'] ctmagent",
2019-12-19 05:11:53 +00:00
# "set service-name[port = '${a2s_port}'][protocol = 'udp']/ #comment 'Henry345'",
2019-12-19 05:49:48 +00:00
# "set service-name[port = '${a2s_port}'][protocol = 'tcp'] ctmagent",
2019-12-19 05:11:53 +00:00
# "set service-name[port = '${a2s_port}'][protocol = 'tcp']/ #comment 'Henry456'",
2019-12-19 05:26:47 +00:00
],
2019-12-19 02:17:49 +00:00
}
2019-12-19 04:36:24 +00:00
# use shellscript and sudo as running the install direct as user ctmagent gives HOME errors plus we get errors in the log file
2019-12-19 02:17:49 +00:00
# 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']]
}
2019-12-19 04:36:24 +00:00
2019-12-19 02:17:49 +00:00
}
default: {fail "Unsupported Major version ${::os['release']['major']} detected"}
}
}