Puppet Class: psick::docker::compose

Defined in:
manifests/docker/compose.pp

Overview

Class: psick::docker::compose

Class to install Docker Compose using the recommended curl command. Original source: github.com/garethr/garethr-docker/blob/master/manifests/compose.pp

Parameters

ensure

Whether to install or remove Docker Compose Valid values are absent present Defaults to present

version

The real_version of Docker Compose to install.

Parameters:

  • ensure (Variant[Boolean,String]) (defaults to: present)
  • options (Hash) (defaults to: { })
  • template (Variant[Undef,String[1]]) (defaults to: undef)
  • version (String) (defaults to: '')


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
# File 'manifests/docker/compose.pp', line 16

class psick::docker::compose(
  Variant[Boolean,String]  $ensure           = present,
  Hash                     $options          = { },
  Variant[Undef,String[1]] $template         = undef,
  String                   $version          = '',
) {

  include ::psick::docker

  $real_version = $version ? {
    ''      => $::psick::docker::module_settings['compose_version'],
    default => $version,
  }

  if $ensure == 'present' {
    exec { "Install Docker Compose ${real_version}":
      path    => '/usr/bin/',
      cwd     => '/tmp',
      command => "curl -s -L https://github.com/docker/compose/releases/download/${real_version}/docker-compose-${::kernel}-x86_64 > /usr/local/bin/docker-compose-${real_version}",
      creates => "/usr/local/bin/docker-compose-${real_version}"
    }
    -> file { "/usr/local/bin/docker-compose-${real_version}":
      owner => 'root',
      mode  => '0755'
    }
    -> file { '/usr/local/bin/docker-compose':
      ensure => 'link',
      target => "/usr/local/bin/docker-compose-${real_version}",
    }
  } else {
    file { [
      "/usr/local/bin/docker-compose-${real_version}",
      '/usr/local/bin/docker-compose'
    ]:
      ensure => absent,
    }
  }
}