If you haven’t seen my previous tutorials you should see them:
How to install Puppet, Hello World module using template to Puppet,
Installing Apache and PHP with Puppet module, Installing Puppet master and slaves.
I’m using Xubuntu 12.04.03 32bit
This tutorial I’m creating parametrized class. Class is installing Apache2 and you can change Apaches port when running Puppet module.
Install Puppet, create folders and init.pp file.
Create Apache2 class and in parameter it takes default port 80.
Create template folder and ports.conf.erb.
Ports.conf.erb is copy of /etc/apache2/ports.conf, but $port ( in ports.conf.erb file <%= @port %> ) variable changes port what Apache is listening.
Run it without parameter. Apache should get installed and should work in localhost
]
Then run Puppet and add to 8080 to port parameter.
Localhost now stop working.
]
Apache should listen localhost:8080.
]
Ok. We don’t want use that port now. So let’s change it back to 80.
Localhost:8080 doesn’t work no more.
]
Now Apache listens port 80.
]
You have installed Apache2 successfully and changed Apaches port from template using parametrized class.
Folder tree looks like this