First and foremost, the module ensures that lighttpd and varnish’s packages are installed, and that their services are running.

After all that is done, it copies the lighty.erb file from lighty/templates into /etc/lighttpd/lighttpd.conf. (Note: this is generally not best practice; you should work with conf.d instead) and does a similar thing with varnish’s configuration file. (Note the “require => Package[“lighttpd”]. It makes sure that lighttpd is installed before copying the file.)

The configuration files are default, except that lighttpd is set to listen to port 8080 and varnish to 80.

Also worth noting is that lighttpd’s userdir module is enabled with an exec resource. It is a viable choice in this case, since it doesn’t break anything if run multiple times. After the “/usr/sbin/lighty-enable-mod userdir” command has been executed, puppet notifies the lighttpd service which will then reload itself to reflect the changes.

4) Templates

The user-index.erb file is just a small html5 compliant webpage that says “Hi!”.

Homework topic: GIT

Assignment

-Make a local git repository
-Make multiple nonsensical commits and return your repository to an earlier point with git reset
-Copy your local repository to a server
-Clone your repository to another system and test that changes are synchronized successfully
-Try a git frontend (e.g. giggle)

We can see that puppet noticed the change, and replaced the modified apache2.conf with the one from /templates. Thus, we can conclude that the module works.

Summary

We created a puppet module which ensures that the apache2 web server is installed, running and that its configuration file apache2.conf matches the one in the module’s /templates directory.

SSHD module

For this one I’ll be using the Xubuntu VM from the previous homework assignment. I’ve restored an earlier snapshot, so we’ll be updating sources.list and installing puppet again. The commands are identical to the ones in the previous Debian module, so I’ll omit those.

master@palvelin:~$ ./filewriter2.sh
warning: Could not retrieve fact fqdn
notice: Finished catalog run in 0.11 seconds
master@palvelin:~$ cat writtenfile2
This is too much content to write in the manifest, surely.
This is from a variable!
master@palvelin:~$

Assignment

Scenario

The main user, master, has trouble controlling his webpage editing impulses. The system has the apache2 web server with the userdir mod enabled, which leaves him free to edit /home/master/public_html/index.html

Note the warning about not being able to retrieve fact fqdn. This could supposedly be alleviated by adding 127.0.0.1 something.or.other to the HOSTS file. The check adds an extra 5 seconds or so to the action.

Results

Let’s see if the web page changed:

It certainly did. Let’s try running nethack:

Seems to have installed just fine. Applying the module again wouldn’t modify the system further, as the resources’ desired state is the status quo.