Puppet Class: psick::docker

Defined in:
manifests/docker.pp

Overview

Parameters:

  • ensure (Variant[Boolean,String]) (defaults to: present)
  • install_class (String) (defaults to: 'tp_profile::docker')
  • username (String[1]) (defaults to: 'example42')
  • options (Hash) (defaults to: { })
  • settings (Hash) (defaults to: { })
  • profiles (Array) (defaults to: [])
  • allowed_users (Array) (defaults to: [])
  • auto_restart (Boolean) (defaults to: true)
  • run (Variant[Undef,Hash]) (defaults to: undef)
  • build (Variant[Undef,Hash]) (defaults to: undef)
  • test (Variant[Undef,Hash]) (defaults to: undef)
  • push (Variant[Undef,Hash]) (defaults to: undef)
  • data_module (String[1]) (defaults to: 'tinydata')
  • manage (Boolean) (defaults to: $::psick::manage)
  • noop_manage (Boolean) (defaults to: $::psick::noop_manage)
  • noop_value (Boolean) (defaults to: $::psick::noop_value)


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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'manifests/docker.pp', line 2

class psick::docker (

  Variant[Boolean,String] $ensure           = present,

  String                  $install_class    = 'tp_profile::docker',

  String[1]               $username         = 'example42',

  Hash                    $options          = { },
  Hash                    $settings         = { },

  Array                   $profiles         = [],

  Array                   $allowed_users    = [],

  Boolean                 $auto_restart     = true,

  Variant[Undef,Hash]     $run              = undef,
  Variant[Undef,Hash]     $build            = undef,
  Variant[Undef,Hash]     $test             = undef,
  Variant[Undef,Hash]     $push             = undef,

  String[1]               $data_module      = 'tinydata',

  Boolean                 $manage           = $::psick::manage,
  Boolean                 $noop_manage      = $::psick::noop_manage,
  Boolean                 $noop_value       = $::psick::noop_value,
  ) {

  if $manage {
    if $noop_manage {
      noop($noop_value)
    }

    $tp_settings = tp_lookup('docker-engine','settings',$data_module,'merge')
    $module_settings = $tp_settings + $settings
    if $module_settings['service_name'] and $auto_restart {
      $service_notify = "Service[${module_settings['service_name']}]"
    } else {
      $service_notify = undef
    }

    if $install_class != '' {
      contain $install_class
    }

    if $profiles != [] {
      $profiles.each |$kl| {
        contain "::psick::docker::profile::${kl}"
      }
    }

    if $run {
      create_resources('psick::docker::run', $run )
    }
    if $build {
      create_resources('psick::docker::tp_build', $build )
    }
    if $test {
      create_resources('psick::docker::test', $test )
    }
    if $push {
      create_resources('psick::docker::push', $push )
    }

    $allowed_users.each | $u | {
      exec { "Add ${u} to docker":
        unless  => "grep docker /etc/group | grep ${u}",
        require => Class[$install_class],
        command => "usermod -a -G docker ${u}",
      }
    }
  }
}