Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: modules/docker/manifests/init.pp

Issue 29370801: Noissue - New module for installing docker on debian (Closed)
Patch Set: Setting suitable defaults for docker package Created Jan. 6, 2017, 3:04 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # == Class: docker
2 #
3 # Install docker (https://www.docker.com/)
4 #
5 # == Parameters:
6 #
7 # [*source*]
8 # Overwrite the default apt::source used (given Class['apt'] is defined).
9 #
10 # [*package*]
11 # Overwrite the default package options, to fine-tune the target version (i.e.
12 # ensure => 'latest') or remove Fluentd (ensure => 'absent' or 'purged')
13 #
14 # === Examples:
15 #
16 # class {'docker':
17 # package => {
18 # ensure => 'latest',
19 # },
20 # source => {
21 # location => 'https://apt.dockerproject.org/repo',
22 # release => downcase("$::osfamily-$::lsbdistcodename"),
23 # include_src => false,
24 # key => '58118E89F3A912897C070ADBF76221572C52609D',
25 # key_server => 'hkp://ha.pool.sks-keyservers.net:80',
26 # }
27 # }
28 #
29 class docker(
30 $source = hiera('docker::source', {}),
31 $package = hiera('docker::package', {
32 ensure => 'latest',
33 provider => 'apt',
34 }),
35 ) {
36
37 include stdlib
38
39 ensure_resource('package', $title, merge({
40 name => 'docker-engine',
41 }, $package))
42
43 # Used as default $ensure parameter for most resources below
44 $ensure = getparam(Package[$title], 'ensure') ? {
45 /^(absent|purged|held)$/ => 'absent',
46 default => 'present',
47 }
48
49 # Using ensure_*state functions
50 if ensure_state($ensure) {
51
52 service {'docker':
53 ensure => running,
54 require => Package['docker-engine'],
55 }
56
57 }
58
59 # The only package provider recognized implicitly
60 if getparam(Package[$title], 'provider') == 'apt' {
61
62 ensure_resource('apt::source', $title, merge({
63 before => Package['docker-engine'],
64 location => 'https://apt.dockerproject.org/repo',
65 release => downcase("$::osfamily-$::lsbdistcodename"),
66 include_src => false,
67 key => '58118E89F3A912897C070ADBF76221572C52609D',
68 key_server => 'hkp://ha.pool.sks-keyservers.net:80',
69 }, $source))
70
71 Apt::Source[$title] -> Package[$title]
72 }
73 }
74
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld