Edit the
modules/nginx/manifests/init.pp
file as follows:# Manage nginx webserver class nginx { package { 'apache2.2-common': ensure => absent, } package { 'nginx': ensure => installed, require => Package['apache2.2-common'], } service { 'nginx': ensure => running, require => Package['nginx'], } }
Run Puppet as follows:
ubuntu@demo:~/puppet$ papply Notice: /Stage[main]/Nginx/Package[apache2.2-common]/ensure: removed Notice: /Stage[main]/Nginx/Service[nginx]/ensure: ensure changed 'stopped' to 'running' Notice: Finished catalog run in 0.47 seconds
Let's look at the code you added in detail:
package { 'apache2.2-common': ensure => absent, }
On Ubuntu, the default setup includes the Apache web server, which would conflict with Nginx if we tried to run it at the same time. So by specifying ensure => absent
, we remove the Apache package.
The next section declares the nginx
package...