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

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

Issue 29327588: Issue 2864 - Introduce class logstash (Closed)
Patch Set: Issue 2864 - Address feedback from code-review Created Oct. 20, 2015, 1: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 | « modules/logstash/manifests/fragment.pp ('k') | modules/logstash/manifests/pipeline.pp » ('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: logstash
2 #
3 # Manage Logstash (https://logstash.net/) installations via APT.
4 #
5 # Please refer to the online documentation at Elastic for more information
6 # on the logstash software, it's usage and configuration options:
7 #
8 # https://www.elastic.co/guide/en/logstash/current/index.html
9 #
10 # === Parameters:
11 #
12 # [*contrib*]
13 # Whether to realize Package['logstash-contrib'].
14 #
15 # [*ensure*]
16 # Either 'present'/'stopped', 'running'/'started', or 'absent'/'purged'.
17 # Note that Service['logstash'] is only realized implicitly when $ensure
18 # is neither 'absent' nor 'purged'.
19 #
20 # [*pipelines*]
21 # A hash to setup logstash::pipeline {$name: $parameter} resources.
22 #
23 # [*version*]
24 # The https://packages.elasticsearch.org/logstash/%s/debian $version.
25 #
26 # === Examples:
27 #
28 # class {'logstash':
29 # contrib => true,
30 # pipelines => {
31 # 'example' => {
32 # # see type logstash::pipeline for a parameter reference
33 # },
34 # },
35 # }
36 #
37 class logstash (
38 $contrib = false,
39 $ensure = 'running',
40 $pipelines = {},
41 $version = '1.4',
42 ) {
43
44 $ensure_file = $ensure ? {
45 /^(absent|purged)$/ => 'absent',
46 default => 'present',
47 }
48
49 apt::key {'logstash':
50 ensure => $ensure_file,
51 key => 'D88E42B4',
52 key_content => template('logstash/elastic-logstash-gpg-key.erb'),
53 }
54
55 apt::source {'logstash':
56 ensure => $ensure_file,
57 include_src => false,
58 location => "https://packages.elasticsearch.org/logstash/$version/debian",
59 release => 'stable',
60 require => Apt::Key['logstash'],
61 }
62
63 package {'logstash':
64 ensure => $ensure ? {
65 /^(absent|purged)$/ => $ensure,
66 default => 'present',
67 },
68 require => Apt::Source['logstash'],
69 }
70
71 @package {'logstash-contrib':
72 before => Service['logstash'],
73 ensure => $ensure ? {
74 /^(absent|purged)$/ => $ensure,
75 default => 'present',
76 },
77 require => Package['logstash'],
78 }
79
80 @service {'logstash':
81 enable => $ensure ? {
82 /^(absent|purged)$/ => false,
83 default => true,
84 },
85 ensure => $ensure ? {
86 /^(running|started)$/ => 'running',
87 default => 'stopped',
88 },
89 hasrestart => true,
90 require => Package['logstash'],
91 }
92
93 file {'/usr/local/bin/logstash':
94 ensure => $ensure_file,
95 mode => 0755,
96 source => 'puppet:///modules/logstash/logstash.sh',
97 require => Package['logstash'],
98 }
99
100 if $contrib {
101 realize(Package['logstash-contrib'])
102 }
103
104 if $ensure !~ /^(absent|purged)$/ {
105 realize(Service['logstash'])
106 }
107
108 create_resources('logstash::pipeline', $pipelines)
109 }
OLDNEW
« no previous file with comments | « modules/logstash/manifests/fragment.pp ('k') | modules/logstash/manifests/pipeline.pp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld