First, we'll create a simple website for Nginx to serve.
Create the directory
/var/www/cat-pictures
:ubuntu@demo:~/puppet$ sudo mkdir -p /var/www/cat-pictures
Add a small HTML file:
ubuntu@demo:~/puppet$ sudo su -c 'echo "I can haz cat pictures?" >/var/www/cat-pictures/index.html'
Next, we'll create the virtual host file for Puppet to deploy:
Create the directory
modules/nginx/files
:ubuntu@demo:~/puppet$ mkdir modules/nginx/files
Create the file
modules/nginx/files/cat-pictures.conf
with the following contents:server { listen 80; root /var/www/cat-pictures; server_name cat-pictures.com; }
Next, we'll add a resource that will deploy this file to the server.
Edit the file
modules/nginx/manifests/init.pp
so it looks like this:# Manage nginx webserver class nginx { package { 'nginx': ensure => installed, } service { 'nginx': ensure => running, require => Package['nginx'], } file { '/etc/nginx/sites-enabled...