I have a very basic code to stop and disable few services which I am running for CentOS/RHEL 6/7 servers.
$stop_services = [ "ip6tables", "iptables", "auditd", "cups" ]
service { $stop_services
ensure => stopped
enable => false
}
Is it possible to not run this code when the OS is CentOS/RHEL 7 and the stop_services value is auditd.
Regards,
Vikas
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/8f5a3e93-6a4e-4875-a4dc-cda501d4e5ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
case $::operatingsystem {
'RedHat', 'CentOS' : {
$stop_services = [ "ip6tables", "iptables", "auditd", "cups" ]
$exclude_services = $::osfamily ? {
'RedHat' => [ 'auditd' ]
}
if ($::operatingsystemmajrelease == '6') {
service { $stop_services:
ensure => stopped,
enable => false,
}
}
if ($::operatingsystemmajrelease == '7') {
service { $stop_services - $exclude_services:
ensure => stopped,
enable => false,
}
}
}
}
You need to set up hiera (http://docs.puppetlabs.com/hiera/1/) to let you choose settings using the "operatingsystem", "osfamily", and/or "operatingsystemmajrelease" facts.
Personally, I am a bit confused as to what services you want stopped under what conditions, so I cannot offer more detail.
The hiera data for your default case would be :
---
foo::services_to_stop :
- ip6tables
- iptables
- auditd
- cups
“Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” (Bill Waterson: Calvin & Hobbes)
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/9e21fc26-244f-4fd9-bde7-fc569fe9bd60%40googlegroups.com.