Skip to content

Instantly share code, notes, and snippets.

@gangsta
Created May 17, 2017 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gangsta/e27927d2e5a988bfbf55e5a4bd38287f to your computer and use it in GitHub Desktop.
Save gangsta/e27927d2e5a988bfbf55e5a4bd38287f to your computer and use it in GitHub Desktop.

This is how we might use the defined type in a Puppet manifest:

apache::vhost { 'foo.example.com':
      port          => '80',
      docroot       => '/var/www/foo.example.com',
      docroot_owner => 'foo',
      docroot_group => 'foo',
      options       => ['Indexes','FollowSymLinks','MultiViews'],
      proxy_pass    => [ { 'path' => '/a', 'url' => 'http://backend-a/' } ],
}
 
apache::vhost { 'bar.example.com':
    port     => '80',
    docroot: => '/var/www/bar.example.com',
}

So it’s a “hash of hashes” data structure. We can represent this in YAML like so:

apache::vhosts:
  foo.example.com:
    port: 80
    docroot: /var/www/foo.example.com
    docroot_owner: foo
    docroot_group: foo
    options:
      - Indexes
      - FollowSymLinks
      - MultiViews
    proxy_pass:
      -
        path: '/a'
        url: 'http://localhost:8080/a'
  bar.example.com:
    port: 80
    docroot: /var/www/bar.example.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment