使用 puppet-apache 安装 apache 服务器。

简介

puppet-apache模块是由puppetlabs公司维护的官方模块,提供完善的apache管理能力

WARNING: Configurations not managed by Puppet will be purged.

如果你之前使用手工配置了Apache服务,想要尝试使用puppet-apache模块管理,请额外小心该模块默认情况下会清理掉所有没有被puppet管理的配置文件!

RPM 安装

yum install puppet-apache -y

安装 Apache

在终端下输入:

puppet apply --debug --modulepath /usr/share/openstack-puppet/modules -ve "include ::apache"

或者创建并编辑一个文件test.pp,并输入:

class { 'apache': }

在终端下输入:

puppet apply --modulepath /usr/share/openstack-puppet/modules /root/test.pp

在约1分钟内(取决于你的网速和虚拟机的性能),你就已经完成了Apache服务的安装,配置和启动了。

安装过程如下:

[root@xiexianbin-cn ~]# puppet apply --modulepath /usr/share/openstack-puppet/modules /root/test.pp
Notice: Compiled catalog for xiexianbin-cn in environment production in 2.48 seconds
Notice: /Stage[main]/Apache/Package[httpd]/ensure: created
Notice: /Stage[main]/Apache/File[/etc/httpd/conf.d/autoindex.conf]/ensure: removed
Notice: /Stage[main]/Apache/File[/etc/httpd/conf.d/userdir.conf]/ensure: removed
Notice: /Stage[main]/Apache/File[/etc/httpd/conf.d/welcome.conf]/ensure: removed
Notice: /Stage[main]/Apache/File[/etc/httpd/conf.d/README]/ensure: removed
Notice: /Stage[main]/Apache/File[/etc/httpd/conf/httpd.conf]/content: content changed '{md5}f5e7449c0f17bc856e86011cb5d152ba' to '{md5}250beff756ae0b9043822f151bf3d46f'
Notice: /Stage[main]/Apache/File[/etc/httpd/conf.modules.d/00-proxy.conf]/ensure: removed
Notice: /Stage[main]/Apache/File[/etc/httpd/conf.modules.d/01-cgi.conf]/ensure: removed
Notice: /Stage[main]/Apache/File[/etc/httpd/conf.modules.d/00-mpm.conf]/ensure: removed
Notice: /Stage[main]/Apache/File[/etc/httpd/conf.modules.d/00-systemd.conf]/ensure: removed
Notice: /Stage[main]/Apache/File[/etc/httpd/conf.modules.d/00-base.conf]/ensure: removed
Notice: /Stage[main]/Apache/File[/etc/httpd/conf.modules.d/00-lua.conf]/ensure: removed
Notice: /Stage[main]/Apache/File[/etc/httpd/conf.modules.d/00-dav.conf]/ensure: removed
Notice: /Stage[main]/Apache::Service/Service[httpd]/ensure: ensure changed 'stopped' to 'running'
Notice: Finished catalog run in 4.95 seconds
[root@xiexianbin-cn ~]# cat test.pp 
class { 'apache': }

[root@xiexianbin-cn ~]# 

安装后,就可以通过80端口访问。

完毕。