Time for action – adding the Nginx service

  1. 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'],
      }
    }
  2. 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
    

What just happened?

Let's look at the code you added in detail:

package { 'apache2.2-common':
  ensure => absent,
}

On Ubuntu, the default setup includes the Apache ...

Get Puppet 3 Beginner's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.