Nginx系列(四)——配置文件自动化管理
Automation 自动化 需要安装Puppet class nginx { package {"nginx": ensure => 'installed',} #确认Nginx已安装 service {"nginx": ensure => 'true', hasrestart => 'true', #确认开机自启 restart => '/etc/init.d/nginx reload', #重启Nginx } file { "nginx.conf": path => '/etc/nginx/nginx.conf', require => Package['nginx'], notify => Service['nginx'], content => template('nginx/templates/nginx.conf.erb'), user=>'root', group=>'root', mode='0644'; } } Chef 安装Chef package 'nginx' do action :install end service 'nginx' do supports :status => true, :restart => true, :reload => true action [ :start, :enable ] end template 'nginx