[root@web1.cctvcjw.com /etc/puppet/modules/apache]# tree
.
|-- files
| `-- httpd.conf
|-- manifests
| |-- config.pp
| |-- init.pp
| |-- install.pp
| `-- service.pp
`-- templates
[root@web1.cctvcjw.com /etc/puppet/modules/apache/manifests]# cat init.pp
class apache {
include apache::install,apache::config,apache::service
}
[root@web1.cctvcjw.com /etc/puppet/modules/apache/manifests]# cat install.pp
class apache::install {
package { "apache":
name => 'httpd',
ensure => 'present',
before => Class['apache::config'],
}
}
[root@web1.cctvcjw.com /etc/puppet/modules/apache/manifests]# cat config.pp
class apache::config {
file { "httpd.conf":
name => '/etc/httpd/conf/httpd.conf',
ensure => present,
source => 'puppet:///modules/apache/httpd.conf',
owner => www,
mode => 0700,
group =>www,
require =>Class['apache::install'],
notify => Class['apache::service'],
}
}
[root@web1.cctvcjw.com /etc/puppet/modules/apache/manifests]# cat service.pp
class apache::service {
service { "httpd":
ensure => running,
# hasrestart => true,
hasstatus => true,
enable => true,
require => Class['apache::config'],
}
}
阅读(1699) | 评论(0) | 转发(0) |