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 
       | 
      
        # File 'manifests/profile/host.pp', line 1
class docker::profile::host (
  Variant[Boolean,String] $ensure              = present,
  Hash                    $instances           = {},
  Variant[Undef,String]   $repository_tag      = 'latest',
  Variant[Undef,Array]    $exec_environment    = [],
  Variant[Boolean,Pattern[/on_failure/]] $exec_logoutput = 'on_failure',
  Pattern[/command|service/] $run_mode         = 'service',
  String                  $run_options         = '',
  Boolean                 $mount_data_dir      = true,
  Boolean                 $mount_log_dir       = true,
) {
  include ::docker
  $instances.each |$instance,$opts| {
    docker::run { $instance:
      ensure           => pick_default($opts['ensure'],$ensure),
      image            => pick_default($opts['image'],''),
      username         => pick_default($opts['username'],$::docker::username),
      repository       => pick_default($opts['repository'],$instance),
      repository_tag   => pick_default($opts['repository_tag'],$repository_tag),
      exec_environment => pick_default($opts['exec_environment'],$exec_environment),
      exec_logoutput   => pick_default($opts['exec_logoutput'],$exec_logoutput),
      run_mode         => pick_default($opts['run_mode'],$run_mode),
      run_options      => pick_default($opts['run_options'],$run_options),
      mount_data_dir   => pick_default($opts['mount_data_dir'],$mount_data_dir),
      mount_log_dir    => pick_default($opts['mount_log_dir'],$mount_log_dir),
    }
  }
}
       |