Puppet Class: psick::docker::rocker_builder

Defined in:
manifests/docker/rocker_builder.pp

Overview

Parameters:

  • ensure (Variant[Boolean,String]) (defaults to: present)
  • images (Hash) (defaults to: {})
  • template (Variant[Undef,String]) (defaults to: 'psick/docker/Rockerfile.erb')
  • workdir (String[1]) (defaults to: '/var/rockerfiles')
  • maintainer (Variant[Undef,String]) (defaults to: undef)
  • from (String) (defaults to: '')
  • default_image_os (Variant[Undef,String]) (defaults to: downcase($::operatingsystem))
  • default_image_osversion (Variant[Undef,String]) (defaults to: $::operatingsystemmajrelease)
  • repository_tag (Variant[Undef,String]) (defaults to: undef)
  • exec_environment (Variant[Undef,Array]) (defaults to: undef)
  • exec_logoutput (Variant[Boolean,Pattern[/on_failure/]]) (defaults to: 'on_failure')
  • always_build (Boolean) (defaults to: false)
  • build_options (String) (defaults to: '')
  • command_mode (Pattern[/command|supervisor/]) (defaults to: 'supervisor')
  • mount_data_dir (Boolean) (defaults to: true)
  • mount_log_dir (Boolean) (defaults to: true)
  • push (Boolean) (defaults to: false)


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

class psick::docker::rocker_builder (

  Variant[Boolean,String] $ensure              = present,
  Hash                    $images              = {},

  Variant[Undef,String]   $template            = 'psick/docker/Rockerfile.erb',
  String[1]               $workdir             = '/var/rockerfiles',

  Variant[Undef,String]   $maintainer          = undef,
  String                  $from                = '',

  Variant[Undef,String]   $default_image_os        = downcase($::operatingsystem),
  Variant[Undef,String]   $default_image_osversion = $::operatingsystemmajrelease,

  Variant[Undef,String]   $repository_tag      = undef,

  Variant[Undef,Array]    $exec_environment    = undef,
  Variant[Boolean,Pattern[/on_failure/]] $exec_logoutput = 'on_failure',

  Boolean                 $always_build        = false,
  String                  $build_options       = '',
  Pattern[/command|supervisor/] $command_mode  = 'supervisor',

  Boolean                 $mount_data_dir      = true,
  Boolean                 $mount_log_dir       = true,

  Boolean                 $push                = false,
) {

  include ::psick::docker

  $real_repository_tag=$repository_tag ? {
    undef   => "${default_image_os}-${default_image_osversion}",
    default => $repository_tag,
  }
  $images.each |$image,$opts| {
    psick::docker::rocker_build { $image:
      ensure           => pick_default($opts['ensure'],$ensure),
      template         => pick_default($opts['template'],$template),
      workdir          => pick_default($opts['workdir'],$workdir),
      username         => pick_default($opts['username'],$::docker::username),
      image_os         => pick_default($opts['image_os'],$default_image_os),
      image_osversion  => pick($opts['image_osversion'],$default_image_osversion),
      maintainer       => pick_undef($opts['maintainer'],$maintainer),
      from             => pick_default($opts['from'],$from),
      repository       => pick($opts['repository'],$image),
      repository_tag   => pick($opts['repository_tag'],$real_repository_tag),
      exec_environment => pick_undef($opts['exec_environment'],$exec_environment),
      prepend_lines    => pick($opts['prepend_lines'],[]),
      append_lines     => pick($opts['append_lines'],[]),
      exec_logoutput   => pick($opts['exec_logoutput'],$exec_logoutput),
      always_build     => pick($opts['always_build'],$always_build),
      build_options    => pick_default($opts['build_options'],$build_options),
      cmd              => pick_undef($opts['cmd']),
      expose           => pick_undef($opts['expose']),
      puppet_facts     => pick_undef($opts['puppet_facts']),
      puppet_manifest  => pick_undef($opts['puppet_manifest']),
    }
  }

  if $push {
    $images.each |$image,$opts| {
      if $opts['push'] != false {
        psick::docker::push { $image:
          ensure           => pick_default($opts['ensure'],$ensure),
          username         => pick_default($opts['username'],$::docker::username),
          repository       => pick($opts['repository'],$image),
          repository_tag   => pick($opts['repository_tag'],$real_repository_tag),
          exec_environment => pick($opts['exec_environment'],$exec_environment),
          data_module      => $::psick::docker::data_module,
        }
      }
    }
  }
}