I need to write a single manifest as install-apache.pp
that will install
apache2
package if it is Debian based system orhttpd
package if it is RedHat based system
Below is the code; this works in CentOS but does not work in Ubuntu.
case $facts['os']['name'] {
'Debian': {
package { 'apache2':
ensure => installed,
}
service { 'apache2':
ensure => running,
}
}
'RedHat': {
package { 'httpd' :
ensure => installed,
}
service { 'httpd':
ensure => running,
}
}
}
So I made some changes as below, but am not sure why it is not working.
case $operatingsystem {
'Debian': {
package { 'apache2':
ensure => installed,
} ->
service { 'apache2':
ensure => running,
enable => true,
}
}
'RedHat': {
package { 'httpd' :
ensure => installed,
} ->
service { 'httpd':
ensure => running,
enable => true,
}
}
}
Command used to execute:
puppet apply install-apache.pp --logdest /root/output.log