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

Side by Side Diff: modules/adblockplus/manifests/mumble.pp

Issue 29517747: #1645 - Introduce mumble module (Closed)
Patch Set: For comment 2 Created Aug. 31, 2017, 7:34 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 | « hiera/roles/voip.yaml ('k') | modules/adblockplus/templates/mumble-server.ini.erb » ('j') | 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: adblockplus:mumble
2 #
3 # Create and maintain mumble (https://www.mumble.com) setups.
4 #
5 # === Parameters:
6 #
7 # [*package*]
8 # Overwrite the default package options, to fine-tune the target version (i.e.
9 # ensure => 'latest') or remove mumble (ensure => 'absent' or 'purged')
10 #
11 # [*certificate*]
12 # Certificate used to enable SSL connection with the server.
13 #
14 # [*private_key*]
15 # Private key used to enable SSL connection with the client.
16 #
17 # [*server_password*]
18 # String used to login into the server.
19 #
20 #
21 # === Examples:
22 #
23 # class {'adblockplus::mumble':
24 # package => {
25 # 'ensure' => 'absent',
26 # },
27 # },
28 # }
29 #
30 class adblockplus::mumble (
31 $package = {},
32 $certificate = {},
33 $private_key = {},
34 $server_password = 'changeme',
35 ){
36
37 # https://forge.puppet.com/puppetlabs/stdlib#getparam
38 $package_ensure = $package['ensure']
39
40 # https://docs.puppet.com/puppet/latest/lang_conditional.html#selectors
41 $ensure = $package_ensure ? {
42 /^(absent|latest|present|purged|true)$/ => $package_ensure,
43 default => 'present',
44 }
45
46 ensure_resource('package', $title, merge({
47 name => 'mumble-server',
48 ensure => $ensure,
49 }, $package))
50
51 file {'/etc/mumble-server.ini':
52 owner => 'root',
53 group => 'mumble-server',
54 mode => 0640,
55 content => template('adblockplus/mumble-server.ini.erb'),
56 require => Package[$title],
57 notify => Service['mumble-server'],
58 }
59
60 service {'mumble-server':
61 ensure => 'running',
62 enable => true,
63 require => Package[$title],
64 }
65
66 # https://forge.puppet.com/puppetlabs/stdlib#getparam
67 $certificate_ensure = $certificate['ensure']
68
69 # https://docs.puppet.com/puppet/latest/lang_conditional.html#selectors
70 $ensure_certificate = $certificate_ensure ? {
71 /^(absent|latest|present|purged|true)$/ => $certificate_ensure,
72 default => 'absent',
73 }
74
75 $default_cert_source = $certificate['content'] ? {
76 undef => 'puppet:///modules/private/mumble.crt',
77 default => undef,
78 }
79
80 ensure_resource('file', '/etc/mumble.crt', merge({
81 ensure => ensure_file_state($ensure_certificate),
82 mode => 0644,
83 path => '/etc/mumble.crt',
84 group => 'mumble-server',
85 before => File['/etc/mumble-server.ini'],
86 require => Package[$title],
87 source => $default_cert_source,
88 }, $certificate))
89
90 # https://forge.puppet.com/puppetlabs/stdlib#getparam
91 $private_key_ensure = $private_key['ensure']
92
93 # https://docs.puppet.com/puppet/latest/lang_conditional.html#selectors
94 $ensure_private_key = $certificate_ensure ? {
95 /^(absent|latest|present|purged|true)$/ => $private_key_ensure,
96 default => 'absent',
97 }
98
99 $default_pk_source = $private_key['content'] ? {
100 undef => 'puppet:///modules/private/mumble.key',
101 default => undef,
102 }
103
104 ensure_resource('file', 'mumble.key', merge({
105 ensure => ensure_file_state($ensure_private_key),
106 mode => 0644,
107 path => '/etc/mumble.key',
108 group => 'mumble-server',
109 before => File['/etc/mumble-server.ini'],
110 require => Package[$title],
111 source => $default_pk_source,
112 }, $private_key))
113 }
114
OLDNEW
« no previous file with comments | « hiera/roles/voip.yaml ('k') | modules/adblockplus/templates/mumble-server.ini.erb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld