Puppet Class: docker::compose
- Inherits:
- docker::params
- Defined in:
- manifests/compose.pp
Overview
Class: docker::compose
Class to install Docker Compose using the recommended curl command.
Parameters
- ensure
-
Whether to install or remove Docker Compose Valid values are absent present Defaults to present
- version
-
The version of Docker Compose to install. Defaults to the value set in $docker::params::compose_version
- install_path
-
The path where to install Docker Compose. Defaults to the value set in $docker::params::compose_install_path
- proxy
-
Proxy to use for downloading Docker Compose.
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 |
# File 'manifests/compose.pp', line 23
class docker::compose(
Optional[Pattern[/^present$|^absent$/]] $ensure = 'present',
Optional[String] $version = $docker::params::compose_version,
Optional[String] $install_path = $docker::params::compose_install_path,
Optional[String] $proxy = undef
) inherits docker::params {
if $proxy != undef {
validate_re($proxy, '^((http[s]?)?:\/\/)?([^:^@]+:[^:^@]+@|)([\da-z\.-]+)\.([\da-z\.]{2,6})(:[\d])?([\/\w \.-]*)*\/?$')
}
if $ensure == 'present' {
ensure_packages(['curl'])
if $proxy != undef {
$proxy_opt = "--proxy ${proxy}"
} else {
$proxy_opt = ''
}
exec { "Install Docker Compose ${version}":
path => '/usr/bin/',
cwd => '/tmp',
command => "curl -s -S -L ${proxy_opt} https://github.com/docker/compose/releases/download/${version}/docker-compose-${::kernel}-x86_64 -o ${install_path}/docker-compose-${version}",
creates => "${install_path}/docker-compose-${version}",
require => Package['curl'],
}
file { "${install_path}/docker-compose-${version}":
owner => 'root',
mode => '0755',
require => Exec["Install Docker Compose ${version}"]
}
file { "${install_path}/docker-compose":
ensure => 'link',
target => "${install_path}/docker-compose-${version}",
require => File["${install_path}/docker-compose-${version}"]
}
} else {
file { [
"${install_path}/docker-compose-${version}",
"${install_path}/docker-compose"
]:
ensure => absent,
}
}
}
|