camptocamp/puppet-puppet — pull request #37 by raphink (2012-10-30 16:11:10+00:00)
Title: Use exported resources to manage puppetmaster backends with proxy

This PR allows to use exported resources to automatically setup the backends for the puppet proxy provided by `puppet::proxy` from the `puppet::master::standalone` classes.

:warning: This PR changes the parameters sent to the `puppet::proxy` definition:

- `backend` is removed, and replaced by `$puppetmaster_backend_ip` in `puppet::master::standalone`;
- `ports` is removed, and automatically calculated based on `$puppetmasters` in `puppet::master::standalone`;
- `fair` is removed and replaced by `$puppetmaster_backend_fair` in `puppet::master::standalone`.

Additionnally, `puppet::proxy::base` doesn't provide a default route (using the `puppetmaster-legacy` backend) automatically, so you have to specify it yourself. Note however that unless `$puppetmaster_backend_name` is specified, it will default to `puppetmaster-legacy`, but you still have to specify the route manually:

```puppet
puppet::proxy { 'puppetmaster-legacy':
ensure => present,
order => '99',
location => '.*',
comment => 'default route',
}
```

:information_source: The `puppet::proxy::base` defines variables to provide its own local backend for certificate management:

```puppet
$puppetmaster_backend_name = 'puppetmaster-ca'
$puppetmaster_backend_ip = '127.0.0.1'
$puppetmasters = 1
```

The typical usage to setup a puppetmaster as backend is to add the following on the puppetmaster node:

```puppet
$puppetmasters = 8
$puppetmaster_backend_name = 'puppetmaster0'
```

and this to the proxy node:

```puppet
puppet::proxy {
'puppetmaster-ca':
order => '00',
location => '/.*/(certificate.*?)/(.*)';

'puppetmaster0':
location => '^/myenvironment/.*';
}
```