12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'modules/docker/manifests/registry/web.pp', line 12
class docker::registry::web (
String $docker_username,
String $docker_password_hash,
Array[Stdlib::Host] $allow_push_from,
Array[String] $ssl_settings,
Boolean $use_puppet_certs = false,
Boolean $use_acme_chief_certs = false,
Boolean $http_endpoint = false,
Array[Stdlib::Host] $http_allowed_hosts = [],
Boolean $cors = false,
Optional[String] $ssl_certificate_name = undef,
) {
if (!$use_puppet_certs and ($ssl_certificate_name == undef)) {
fail('Either puppet certs should be used, or an ssl cert name should be provided')
}
if $use_puppet_certs {
# TODO: consider using profile::pki::get_cert
puppet::expose_agent_certs { '/etc/nginx':
ensure => present,
provide_private => true,
require => Class['nginx'],
}
}
file { '/etc/nginx/htpasswd.registry':
content => "${docker_username}:${docker_password_hash}",
owner => 'www-data',
group => 'www-data',
mode => '0440',
before => Service['nginx'],
require => Package['nginx-common'],
}
nginx::site { 'registry':
content => template('docker/registry-nginx.conf.erb'),
}
if $http_endpoint {
nginx::site { 'registry-http':
content => template('docker/registry-http-nginx.conf.erb'),
}
}
}
|