summaryrefslogtreecommitdiff
path: root/puppet/modules/site_mx/manifests/couchdb.pp
blob: f842ceabe5e472801bab9779ce5f78abbc509ecb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
class site_mx::couchdb {

  $stunnel = hiera('stunnel')
  $couch_client            = $stunnel['couch_client']
  $couch_client_connect    = $couch_client['connect']

  include x509::variables
  $x509                    = hiera('x509')
  $key                     = $x509['key']
  $cert                    = $x509['cert']
  $ca                      = $x509['ca_cert']
  $cert_name               = 'leap_couchdb'
  $ca_name                 = 'leap_ca'
  $ca_path                 = "${x509::variables::local_CAs}/${ca_name}.crt"
  $cert_path               = "${x509::variables::certs}/${cert_name}.crt"
  $key_path                = "${x509::variables::keys}/${cert_name}.key"

  class { 'site_stunnel::setup':
    cert_name => $cert_name,
    key       => $key,
    cert      => $cert,
    ca_name   => $ca_name,
    ca        => $ca
  }

  $couchdb_stunnel_client_defaults = {
    'connect_port' => $couch_client_connect,
    'client'     => true,
    'cafile'     => $ca_path,
    'key'        => $key_path,
    'cert'       => $cert_path,
  }

  create_resources(site_stunnel::clients, $couch_client, $couchdb_stunnel_client_defaults)
}