Puppet Class: docker

Defined in:
puppet/modules/docker/manifests/init.pp

Overview

Class: docker

Install Docker.



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
# File 'puppet/modules/docker/manifests/init.pp', line 5

class docker {
    apt::repository { 'docker':
        uri        => 'https://download.docker.com/linux/debian',
        dist       => $::lsbdistcodename,
        components => stable,
        keyfile    => 'puppet:///modules/docker/docker-archive-keyring.asc',
        source     => false,
    }

    package { ['docker-ce', 'docker-buildx-plugin']:
        ensure  => present,
        require => Apt::Repository['docker'],
    }

    group { 'docker':
        ensure => present,
    }
    exec { 'www-data docker membership':
        unless  => '/usr/bin/groups www-data | /bin/grep -q "\bdocker\b"',
        command => '/usr/sbin/usermod -aG docker www-data',
        user    => 'root',
        require => Group['docker'],
    }
    exec { 'vagrant docker membership':
        unless  => '/usr/bin/groups vagrant | /bin/grep -q "\bdocker\b"',
        command => '/usr/sbin/usermod -aG docker vagrant',
        user    => 'root',
        require => Group['docker'],
    }
}