summaryrefslogtreecommitdiff
path: root/manifests/repomaster.pp
blob: 96de9779a7701f70093b77cc6711f92c2ccf0529 (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
36
37
38
39
40
41
42
43
# Configures web server for serving package repo.
class profiles::repomaster (
  String $directory,
  String $hostname = "repo.${::fqdn}",
  Boolean $publish_dns = false,
  Optional[String] $dns_zone = undef,
) {

  include ::profiles::nginx

  include ::profiles::certificate
  letsencrypt::domain { $hostname:
    cert_name => $profiles::certificate::cert_name,
  }

  nginx::resource::server { $hostname:
    www_root             => $directory,
    autoindex            => 'on',
    use_default_location => true,
    ipv6_enable          => true,
    ipv6_listen_options  => '',
    listen_options       => '',
    *                    => letsencrypt::conf::nginx($hostname),
  }

  if $publish_dns {
    # TODO Separate toggles for ipv4 and ipv6
    # Since ipv4 might be internal and shouldn't be exported.
    # @@dns_record { "${hostname} A":
    #   type  => 'A',
    #   zone  => $dns_zone,
    #   key   => $hostname,
    #   value => $facts['ipaddress'],
    # }

    @@dns::record { "${hostname} AAAA":
      type  => 'AAAA',
      zone  => $dns_zone,
      key   => $hostname,
      value => $facts['ipaddress6'],
    }
  }
}