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 the defaults in a more beautiful place Created Jan. 6, 2017, 3:07 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 docker (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 ) {
33
34 include stdlib
35
36 ensure_resource('package', $title, merge({
37 name => 'docker-engine',
38 ensure => 'latest',
39 provider => 'apt',
40 }, $package))
41
42 # Used as default $ensure parameter for most resources below
43 $ensure = getparam(Package[$title], 'ensure') ? {
44 /^(absent|purged|held)$/ => 'absent',
45 default => 'present',
46 }
47
48 # Using ensure_*state functions
49 if ensure_state($ensure) {
50
51 service {'docker':
52 ensure => running,
53 require => Package['docker-engine'],
54 }
55
56 }
57
58 # The only package provider recognized implicitly
59 if getparam(Package[$title], 'provider') == 'apt' {
60
61 ensure_resource('apt::source', $title, merge({
62 before => Package['docker-engine'],
63 location => 'https://apt.dockerproject.org/repo',
64 release => downcase("$::osfamily-$::lsbdistcodename"),
65 include_src => false,
66 key => '58118E89F3A912897C070ADBF76221572C52609D',
67 key_server => 'hkp://ha.pool.sks-keyservers.net:80',
68 }, $source))
69
70 Apt::Source[$title] -> Package[$title]
71 }
72 }
73
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