aboutsummaryrefslogtreecommitdiff
path: root/manifests/ce.pp
blob: 25a2204a81efd96ac9caf8794be4fe98c7ab5ad1 (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
# See https://docs.docker.com/engine/install/debian/
class docker::ce inherits docker {
  $distro = downcase($::lsbdistid)

  file { '/etc/apt/trusted.gpg.d/docker.gpg':
    ensure => present,
    mode   => '0644',
    owner  => 'root',
    group  => 'root',
    source => "puppet:///modules/docker/${distro}.gpg",
  }

  file { '/etc/apt/sources.list.d/docker.list':
    ensure  => present,
    owner   => "root",
    group   => "root",
    mode    => "0644",
    content => "deb [arch=${::architecture}] https://download.docker.com/linux/${distro} ${::lsbdistcodename} stable\n",
    require => File['/etc/apt/trusted.gpg.d/docker.gpg'],
    notify  => Exec['docker-apt-auto-update'],
  }

  exec { 'docker-apt-auto-update':
    command     => "/usr/bin/apt-get update",
    user        => "root",
    refreshonly => true,
  }

  # Docker community edition
  package { 'docker-ce':
    ensure  => present,
    require => [
      File['/etc/apt/sources.list.d/docker.list'],
      Exec['docker-apt-auto-update'],
    ],
  }

  # Ensure that the distro package is absent
  Package['docker'] {
    ensure => absent,
  }

  Service['docker'] {
    require => Package['docker-ce'],
  }
}