Puppet

When creating a new module with PDK, running unit tests gives the following message:

Deprecation Warnings:

puppetlabs_spec_helper: defaults `mock_with` to `:mocha`. See https://github.com/puppetlabs/puppetlabs_spec_helper#mock_with to choose a sensible value for you

To switch to :mocha as mentioned, create .sync.yml in the module directory and add the following lines:

---
spec/spec_helper.rb:
  mock_with: ':rspec'

The run pdk update to apply the changes.


Apache example with settings I commonly use:

class { 'apache': }

apache::vhost  { 'myserver.domain.local':
    port                => '443',
    ssl                 => true,
    ssl_cert            => '/etc/pki/tls/certs/mydomain.pem',
    ssl_chain           => '/etc/pki/tls/certs/mychain.pem',
    ssl_key             => '/etc/pki/tls/private/mydomain_key.pem',
    docroot             => '/var/www/html',
    override            => ['All'],
    options             => ['-Indexes'],
    setenv              => ['MY_ENV_VARIABLE production'],
    proxy_preserve_host => true,
    proxy_pass          => [
      { 'path' => '/backend/', 'url' => 'http://localhost:9000/backend/' },
      { 'path' => '/static/', 'url' => 'http://localhost:9001/static/' },
    ],
}

With multiple directories:

class { 'apache': }

apache::vhost { 'myserver.domain.local':
  port        => '443',
  ssl         => true,
  ssl_cert    => '/etc/pki/tls/certs/mydomain.pem',
  ssl_chain   => '/etc/pki/tls/certs/mychain.pem',
  ssl_key     => '/etc/pki/tls/private/mydomain_key.pem',
  docroot     => '/var/www/html',
  setenv      => ['MY_ENV_VARIABLE production'],
  directories => [
    {
      'path'           => '/var/www/html',
      'provider'       => 'directory',
      'allow_override' => ['All'],
      'options'        => ['-Indexes'],
    },
  ],