# /home/administrator/code/environments/production/modules/webapp/manifests/web.pp
# 웹 서버 운영
class webapp::web {
$servername = "${::fqdn}" ➊
$port = "80"
class { 'apache':
mpm_module => 'prefork', ➋
default_vhost => false,
default_charset => 'UTF-8',
}
apache::vhost {"${servername}":
port => "${port}",
docroot => "/var/www/${servername}"
}
include apache::mod::php ➌
include mysql::bindings::php ➍
file { 'index.html':
name => "/var/www/${servername}/index.html",
content => "<html><head><title>Host Information</title></head>
<body><h1>안녕하세요</h1>
<h2>hostname : ${::fqdn}</h2>
<h2>ip address : ${::ipaddress}</h2></body></html>\n",
require => Apache::Vhost["${servername}"],
ensure => absent, ➎
}
file { 'index.php': ➏
name => "/var/www/${servername}/index.php",
content => "<?php phpinfo(); ?>",
require => Apache::Vhost["${servername}"],
}
}