summaryrefslogtreecommitdiff
path: root/global/overlay/etc/puppet/modules/sunet/manifests/dockerhost.pp
blob: 67f75f9f7dccc90cccdf634d0691cb73d0f53c32 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
# Install docker from https://get.docker.com/ubuntu
class sunet::dockerhost {
  apt::source {'docker_official':
     location           => 'https://get.docker.com/ubuntu',
     release            => 'docker',
     repos              => 'main',
     key                => 'A88D21E9',
     include_src        => false
  }
  package {'lxc-docker':
     ensure             => latest,
  }

  class {'docker':
     manage_package     => false,
  }

  package { 'unbound': ensure => 'latest' }
  service { 'unbound': ensure => 'running' }

  file { '/usr/local/etc/docker.d/20unbound':
    ensure  => file,
    path    => '/usr/local/etc/docker.d/20unbound',
    mode    => '0755',
    content => template('sunet/dockerhost/20unbound.erb'),
  }

  file { '/etc/logrotate.d/docker-containers':
    ensure  => file,
    path    => '/etc/logrotate.d/docker-containers',
    mode    => '0644',
    content => template('sunet/dockerhost/logrotate_docker-containers.erb'),
  }

  file { '/etc/unbound/unbound.conf.d/docker.conf':
    ensure  => file,
    path    => '/etc/unbound/unbound.conf.d/docker.conf',
    mode    => '0644',
    content => template('sunet/dockerhost/unbound_docker.conf.erb'),
    notify  => Service['unbound'],
  }

  ufw::allow { 'allow-docker-resolving_udp':
    port  => '53',
    ip    => $::ipaddress_docker0,    # both IPv4 and IPv6
    from  => '172.16.0.0/12',
    proto => 'udp',
  }
  ufw::allow { 'allow-docker-resolving_tcp':
    port  => '53',
    ip    => $::ipaddress_docker0,    # both IPv4 and IPv6
    from  => '172.16.0.0/12',
    proto => 'tcp',
  }

}