safeguard-devise 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.vagrant/machines/default/virtualbox/action_provision +1 -0
- data/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/.vagrant/machines/default/virtualbox/id +1 -0
- data/Gemfile +25 -0
- data/Gemfile.lock +186 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/Vagrantfile +128 -0
- data/app/controllers/devise/devise_safeguard_controller.rb +56 -0
- data/app/views/devise/verify_safeguard.html.erb +9 -0
- data/app/views/devise/verify_safeguard.html.haml +7 -0
- data/config/locales/pt-BR.yml +5 -0
- data/lib/devise-safeguard/controllers/helpers.rb +54 -0
- data/lib/devise-safeguard/hooks/safeguard_authenticatable.rb +7 -0
- data/lib/devise-safeguard/models/safeguard_authenticatable.rb +18 -0
- data/lib/devise-safeguard/rails.rb +7 -0
- data/lib/devise-safeguard/routes.rb +17 -0
- data/lib/generators/active_record/devise_safeguard_generator.rb +13 -0
- data/lib/generators/active_record/templates/migration.rb +15 -0
- data/lib/generators/devise_safeguard/devise_safeguard_generator.rb +30 -0
- data/lib/generators/devise_safeguard/install_generator.rb +44 -0
- data/lib/safeguard-devise.rb +24 -0
- data/puppet/manifests/default.pp +66 -0
- data/puppet/modules/elasticsearch/CHANGELOG +62 -0
- data/puppet/modules/elasticsearch/CONTRIBUTORS +20 -0
- data/puppet/modules/elasticsearch/LICENSE +13 -0
- data/puppet/modules/elasticsearch/Modulefile +9 -0
- data/puppet/modules/elasticsearch/README.md +147 -0
- data/puppet/modules/elasticsearch/Rakefile +5 -0
- data/puppet/modules/elasticsearch/manifests/config.pp +64 -0
- data/puppet/modules/elasticsearch/manifests/init.pp +208 -0
- data/puppet/modules/elasticsearch/manifests/java.pp +50 -0
- data/puppet/modules/elasticsearch/manifests/package.pp +84 -0
- data/puppet/modules/elasticsearch/manifests/params.pp +103 -0
- data/puppet/modules/elasticsearch/manifests/plugin.pp +97 -0
- data/puppet/modules/elasticsearch/manifests/python.pp +34 -0
- data/puppet/modules/elasticsearch/manifests/service.pp +114 -0
- data/puppet/modules/elasticsearch/manifests/template.pp +118 -0
- data/puppet/modules/elasticsearch/metadata.json +41 -0
- data/puppet/modules/elasticsearch/spec/classes/elasticsearch_init_spec.rb +596 -0
- data/puppet/modules/elasticsearch/spec/defines/template_spec.rb +66 -0
- data/puppet/modules/elasticsearch/spec/spec_helper.rb +2 -0
- data/puppet/modules/elasticsearch/templates/etc/default/elasticsearch.erb +5 -0
- data/puppet/modules/elasticsearch/templates/etc/elasticsearch/elasticsearch.yml.erb +93 -0
- data/puppet/modules/memcached/.gitignore +2 -0
- data/puppet/modules/memcached/Modulefile +8 -0
- data/puppet/modules/memcached/README.md +29 -0
- data/puppet/modules/memcached/manifests/init.pp +33 -0
- data/puppet/modules/memcached/manifests/params.pp +21 -0
- data/puppet/modules/memcached/templates/memcached.conf.erb +46 -0
- data/puppet/modules/memcached/templates/memcached_sysconfig.erb +5 -0
- data/puppet/modules/mysql/.fixtures.yml +3 -0
- data/puppet/modules/mysql/.gemfile +5 -0
- data/puppet/modules/mysql/LICENSE +201 -0
- data/puppet/modules/mysql/Modulefile +8 -0
- data/puppet/modules/mysql/README.md +124 -0
- data/puppet/modules/mysql/files/mysqltuner.pl +966 -0
- data/puppet/modules/mysql/lib/puppet/parser/functions/mysql_password.rb +15 -0
- data/puppet/modules/mysql/lib/puppet/provider/database/mysql.rb +42 -0
- data/puppet/modules/mysql/lib/puppet/provider/database_grant/mysql.rb +177 -0
- data/puppet/modules/mysql/lib/puppet/provider/database_user/mysql.rb +42 -0
- data/puppet/modules/mysql/lib/puppet/type/database.rb +17 -0
- data/puppet/modules/mysql/lib/puppet/type/database_grant.rb +75 -0
- data/puppet/modules/mysql/lib/puppet/type/database_user.rb +25 -0
- data/puppet/modules/mysql/manifests/backup.pp +68 -0
- data/puppet/modules/mysql/manifests/config.pp +122 -0
- data/puppet/modules/mysql/manifests/db.pp +77 -0
- data/puppet/modules/mysql/manifests/init.pp +24 -0
- data/puppet/modules/mysql/manifests/java.pp +24 -0
- data/puppet/modules/mysql/manifests/params.pp +91 -0
- data/puppet/modules/mysql/manifests/python.pp +26 -0
- data/puppet/modules/mysql/manifests/ruby.pp +28 -0
- data/puppet/modules/mysql/manifests/server/account_security.pp +13 -0
- data/puppet/modules/mysql/manifests/server/monitor.pp +19 -0
- data/puppet/modules/mysql/manifests/server/mysqltuner.pp +22 -0
- data/puppet/modules/mysql/manifests/server.pp +52 -0
- data/puppet/modules/mysql/templates/my.cnf.erb +42 -0
- data/puppet/modules/mysql/templates/my.cnf.pass.erb +6 -0
- data/puppet/modules/mysql/templates/mysqlbackup.sh.erb +23 -0
- data/puppet/modules/postgresql/GPL-3 +674 -0
- data/puppet/modules/postgresql/Modulefile +13 -0
- data/puppet/modules/postgresql/README.md +156 -0
- data/puppet/modules/postgresql/lib/puppet/provider/pg_database/debian_postgresql.rb +30 -0
- data/puppet/modules/postgresql/lib/puppet/provider/pg_database/default.rb +17 -0
- data/puppet/modules/postgresql/lib/puppet/provider/pg_user/debian_postgresql.rb +63 -0
- data/puppet/modules/postgresql/lib/puppet/provider/pg_user/default.rb +17 -0
- data/puppet/modules/postgresql/lib/puppet/type/pg_database.rb +29 -0
- data/puppet/modules/postgresql/lib/puppet/type/pg_user.rb +45 -0
- data/puppet/modules/postgresql/manifests/db.pp +20 -0
- data/puppet/modules/postgresql/manifests/init.pp +12 -0
- data/puppet/modules/postgresql/manifests/params.pp +15 -0
- data/puppet/modules/postgresql/manifests/server.pp +47 -0
- data/puppet/modules/postgresql/templates/pg_hba.conf.erb +105 -0
- data/puppet/modules/postgresql/templates/postgresql.conf.erb +559 -0
- data/puppet/modules/redis/CHANGELOG +41 -0
- data/puppet/modules/redis/Gemfile +7 -0
- data/puppet/modules/redis/Gemfile.lock +18 -0
- data/puppet/modules/redis/Modulefile +10 -0
- data/puppet/modules/redis/README.md +34 -0
- data/puppet/modules/redis/Rakefile +6 -0
- data/puppet/modules/redis/manifests/init.pp +153 -0
- data/puppet/modules/redis/manifests/params.pp +39 -0
- data/puppet/modules/redis/metadata.json +31 -0
- data/puppet/modules/redis/spec/spec_helper.rb +17 -0
- data/puppet/modules/redis/templates/redis.debian.conf.erb +217 -0
- data/puppet/modules/redis/templates/redis.logrotate.erb +9 -0
- data/puppet/modules/redis/templates/redis.rhel.conf.erb +547 -0
- data/puppet/modules/redis/tests/init.pp +8 -0
- data/puppet/upgrade-puppet.sh +16 -0
- data/safeguard-devise.gemspec +249 -0
- data/spec/controllers/safeguard_devise_controller_spec.rb +67 -0
- data/spec/devise/safeguard_authenticatable_spec.rb +71 -0
- data/spec/orm/active_record.rb +4 -0
- data/spec/routing/routes_spec.rb +13 -0
- data/spec/safeguard-devise-test-app/.gitignore +16 -0
- data/spec/safeguard-devise-test-app/Gemfile +14 -0
- data/spec/safeguard-devise-test-app/Gemfile.lock +119 -0
- data/spec/safeguard-devise-test-app/README.rdoc +28 -0
- data/spec/safeguard-devise-test-app/Rakefile +6 -0
- data/spec/safeguard-devise-test-app/app/assets/images/.keep +0 -0
- data/spec/safeguard-devise-test-app/app/assets/javascripts/application.js +13 -0
- data/spec/safeguard-devise-test-app/app/assets/stylesheets/application.css +13 -0
- data/spec/safeguard-devise-test-app/app/controllers/application_controller.rb +5 -0
- data/spec/safeguard-devise-test-app/app/controllers/concerns/.keep +0 -0
- data/spec/safeguard-devise-test-app/app/controllers/home_controller.rb +6 -0
- data/spec/safeguard-devise-test-app/app/helpers/application_helper.rb +2 -0
- data/spec/safeguard-devise-test-app/app/mailers/.keep +0 -0
- data/spec/safeguard-devise-test-app/app/models/.keep +0 -0
- data/spec/safeguard-devise-test-app/app/models/concerns/.keep +0 -0
- data/spec/safeguard-devise-test-app/app/models/user.rb +6 -0
- data/spec/safeguard-devise-test-app/app/views/devise/devise_safeguard/verify_safeguard.html.erb +9 -0
- data/spec/safeguard-devise-test-app/app/views/devise/devise_safeguard/verify_safeguard.html.haml +6 -0
- data/spec/safeguard-devise-test-app/app/views/home/index.html.erb +1 -0
- data/spec/safeguard-devise-test-app/app/views/layouts/application.html.erb +14 -0
- data/spec/safeguard-devise-test-app/bin/bundle +3 -0
- data/spec/safeguard-devise-test-app/bin/rails +4 -0
- data/spec/safeguard-devise-test-app/bin/rake +4 -0
- data/spec/safeguard-devise-test-app/config/application.rb +31 -0
- data/spec/safeguard-devise-test-app/config/boot.rb +4 -0
- data/spec/safeguard-devise-test-app/config/database.yml +25 -0
- data/spec/safeguard-devise-test-app/config/environment.rb +5 -0
- data/spec/safeguard-devise-test-app/config/environments/development.rb +29 -0
- data/spec/safeguard-devise-test-app/config/environments/production.rb +80 -0
- data/spec/safeguard-devise-test-app/config/environments/test.rb +36 -0
- data/spec/safeguard-devise-test-app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/safeguard-devise-test-app/config/initializers/devise.rb +259 -0
- data/spec/safeguard-devise-test-app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/safeguard-devise-test-app/config/initializers/inflections.rb +16 -0
- data/spec/safeguard-devise-test-app/config/initializers/mime_types.rb +5 -0
- data/spec/safeguard-devise-test-app/config/initializers/secret_token.rb +12 -0
- data/spec/safeguard-devise-test-app/config/initializers/session_store.rb +3 -0
- data/spec/safeguard-devise-test-app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/safeguard-devise-test-app/config/locales/devise.en.yml +59 -0
- data/spec/safeguard-devise-test-app/config/locales/devise.safeguard.pt-BR.yml +5 -0
- data/spec/safeguard-devise-test-app/config/locales/en.yml +23 -0
- data/spec/safeguard-devise-test-app/config/routes.rb +59 -0
- data/spec/safeguard-devise-test-app/config.ru +4 -0
- data/spec/safeguard-devise-test-app/db/migrate/20140220191103_create_users.rb +9 -0
- data/spec/safeguard-devise-test-app/db/migrate/20140220191247_add_devise_to_users.rb +49 -0
- data/spec/safeguard-devise-test-app/db/migrate/20140220191522_devise_safeguard_add_to_users.rb +15 -0
- data/spec/safeguard-devise-test-app/db/schema.rb +37 -0
- data/spec/safeguard-devise-test-app/db/seeds.rb +7 -0
- data/spec/safeguard-devise-test-app/lib/assets/.keep +0 -0
- data/spec/safeguard-devise-test-app/lib/tasks/.keep +0 -0
- data/spec/safeguard-devise-test-app/log/.keep +0 -0
- data/spec/safeguard-devise-test-app/public/404.html +58 -0
- data/spec/safeguard-devise-test-app/public/422.html +58 -0
- data/spec/safeguard-devise-test-app/public/500.html +57 -0
- data/spec/safeguard-devise-test-app/public/favicon.ico +0 -0
- data/spec/safeguard-devise-test-app/public/robots.txt +5 -0
- data/spec/safeguard-devise-test-app/test/controllers/.keep +0 -0
- data/spec/safeguard-devise-test-app/test/fixtures/.keep +0 -0
- data/spec/safeguard-devise-test-app/test/fixtures/users.yml +9 -0
- data/spec/safeguard-devise-test-app/test/helpers/.keep +0 -0
- data/spec/safeguard-devise-test-app/test/integration/.keep +0 -0
- data/spec/safeguard-devise-test-app/test/mailers/.keep +0 -0
- data/spec/safeguard-devise-test-app/test/models/.keep +0 -0
- data/spec/safeguard-devise-test-app/test/models/user_test.rb +7 -0
- data/spec/safeguard-devise-test-app/test/test_helper.rb +15 -0
- data/spec/safeguard-devise-test-app/vendor/assets/javascripts/.keep +0 -0
- data/spec/safeguard-devise-test-app/vendor/assets/stylesheets/.keep +0 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/tests_helper/helpers.rb +34 -0
- metadata +381 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
# == Class: elasticsearch::java
|
2
|
+
#
|
3
|
+
# This class exists to install java if its not managed from an other module
|
4
|
+
#
|
5
|
+
#
|
6
|
+
# === Parameters
|
7
|
+
#
|
8
|
+
# This class does not provide any parameters.
|
9
|
+
#
|
10
|
+
#
|
11
|
+
# === Examples
|
12
|
+
#
|
13
|
+
# This class may be imported by other classes to use its functionality:
|
14
|
+
# class { 'elasticsearch::java': }
|
15
|
+
#
|
16
|
+
# It is not intended to be used directly by external resources like node
|
17
|
+
# definitions or other modules.
|
18
|
+
#
|
19
|
+
#
|
20
|
+
# === Authors
|
21
|
+
#
|
22
|
+
# * Richard Pijnenburg <mailto:richard@ispavailability.com>
|
23
|
+
#
|
24
|
+
class elasticsearch::java {
|
25
|
+
|
26
|
+
if $elasticsearch::java_package == undef {
|
27
|
+
# Default Java package
|
28
|
+
case $::operatingsystem {
|
29
|
+
'CentOS', 'Fedora', 'Scientific', 'RedHat', 'Amazon', 'OracleLinux': {
|
30
|
+
$package = 'java-1.6.0-openjdk'
|
31
|
+
}
|
32
|
+
'Debian', 'Ubuntu': {
|
33
|
+
$package = 'openjdk-6-jre-headless'
|
34
|
+
}
|
35
|
+
default: {
|
36
|
+
fail("\"${module_name}\" provides no java package
|
37
|
+
for \"${::operatingsystem}\"")
|
38
|
+
}
|
39
|
+
}
|
40
|
+
} else {
|
41
|
+
$package = $elasticsearch::java_package
|
42
|
+
}
|
43
|
+
|
44
|
+
## Install the java package unless already specified somewhere else
|
45
|
+
if !defined(Package[$package]) {
|
46
|
+
package { $package:
|
47
|
+
ensure => present
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# == Class: elasticsearch::package
|
2
|
+
#
|
3
|
+
# This class exists to coordinate all software package management related
|
4
|
+
# actions, functionality and logical units in a central place.
|
5
|
+
#
|
6
|
+
#
|
7
|
+
# === Parameters
|
8
|
+
#
|
9
|
+
# This class does not provide any parameters.
|
10
|
+
#
|
11
|
+
#
|
12
|
+
# === Examples
|
13
|
+
#
|
14
|
+
# This class may be imported by other classes to use its functionality:
|
15
|
+
# class { 'elasticsearch::package': }
|
16
|
+
#
|
17
|
+
# It is not intended to be used directly by external resources like node
|
18
|
+
# definitions or other modules.
|
19
|
+
#
|
20
|
+
#
|
21
|
+
# === Authors
|
22
|
+
#
|
23
|
+
# * Richard Pijnenburg <mailto:richard@ispavailability.com>
|
24
|
+
#
|
25
|
+
class elasticsearch::package {
|
26
|
+
|
27
|
+
#### Package management
|
28
|
+
|
29
|
+
# set params: in operation
|
30
|
+
if $elasticsearch::ensure == 'present' {
|
31
|
+
|
32
|
+
if $elasticsearch::version == false {
|
33
|
+
|
34
|
+
$package_ensure = $elasticsearch::autoupgrade ? {
|
35
|
+
true => 'latest',
|
36
|
+
default => 'present',
|
37
|
+
}
|
38
|
+
|
39
|
+
} else {
|
40
|
+
|
41
|
+
$package_ensure = $elasticsearch::version
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
# set params: removal
|
46
|
+
} else {
|
47
|
+
$package_ensure = 'purged'
|
48
|
+
}
|
49
|
+
|
50
|
+
if $elasticsearch::pkg_source {
|
51
|
+
|
52
|
+
$filenameArray = split($elasticsearch::pkg_source, '/')
|
53
|
+
$basefilename = $filenameArray[-1]
|
54
|
+
|
55
|
+
$extArray = split($basefilename, '\.')
|
56
|
+
$ext = $extArray[-1]
|
57
|
+
|
58
|
+
$tmpSource = "/tmp/${basefilename}"
|
59
|
+
|
60
|
+
file { $tmpSource:
|
61
|
+
source => $elasticsearch::pkg_source,
|
62
|
+
owner => 'root',
|
63
|
+
group => 'root',
|
64
|
+
backup => false
|
65
|
+
}
|
66
|
+
|
67
|
+
case $ext {
|
68
|
+
'deb': { $pkg_provider = 'dpkg' }
|
69
|
+
'rpm': { $pkg_provider = 'rpm' }
|
70
|
+
default: { fail("Unknown file extention \"${ext}\"") }
|
71
|
+
}
|
72
|
+
} else {
|
73
|
+
$tmpSource = undef
|
74
|
+
$pkg_provider = undef
|
75
|
+
}
|
76
|
+
|
77
|
+
# action
|
78
|
+
package { $elasticsearch::params::package:
|
79
|
+
ensure => $package_ensure,
|
80
|
+
source => $tmpSource,
|
81
|
+
provider => $pkg_provider
|
82
|
+
}
|
83
|
+
|
84
|
+
}
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# == Class: elasticsearch::params
|
2
|
+
#
|
3
|
+
# This class exists to
|
4
|
+
# 1. Declutter the default value assignment for class parameters.
|
5
|
+
# 2. Manage internally used module variables in a central place.
|
6
|
+
#
|
7
|
+
# Therefore, many operating system dependent differences (names, paths, ...)
|
8
|
+
# are addressed in here.
|
9
|
+
#
|
10
|
+
#
|
11
|
+
# === Parameters
|
12
|
+
#
|
13
|
+
# This class does not provide any parameters.
|
14
|
+
#
|
15
|
+
#
|
16
|
+
# === Examples
|
17
|
+
#
|
18
|
+
# This class is not intended to be used directly.
|
19
|
+
#
|
20
|
+
#
|
21
|
+
# === Links
|
22
|
+
#
|
23
|
+
# * {Puppet Docs: Using Parameterized Classes}[http://j.mp/nVpyWY]
|
24
|
+
#
|
25
|
+
#
|
26
|
+
# === Authors
|
27
|
+
#
|
28
|
+
# * Richard Pijnenburg <mailto:richard@ispavailability.com>
|
29
|
+
#
|
30
|
+
class elasticsearch::params {
|
31
|
+
|
32
|
+
#### Default values for the parameters of the main module class, init.pp
|
33
|
+
|
34
|
+
# ensure
|
35
|
+
$ensure = 'present'
|
36
|
+
|
37
|
+
# autoupgrade
|
38
|
+
$autoupgrade = false
|
39
|
+
|
40
|
+
# restart on configuration change?
|
41
|
+
$restart_on_change = true
|
42
|
+
|
43
|
+
# service status
|
44
|
+
$status = 'enabled'
|
45
|
+
|
46
|
+
# configuration directory
|
47
|
+
$confdir = '/etc/elasticsearch'
|
48
|
+
|
49
|
+
# plugins directory
|
50
|
+
$plugindir = '/usr/share/elasticsearch/plugins'
|
51
|
+
|
52
|
+
# plugins helper binary
|
53
|
+
$plugintool = '/usr/share/elasticsearch/bin/plugin'
|
54
|
+
|
55
|
+
# default service settings
|
56
|
+
$service_settings = {
|
57
|
+
'ES_USER' => 'elasticsearch',
|
58
|
+
'ES_GROUP' => 'elasticsearch',
|
59
|
+
}
|
60
|
+
|
61
|
+
#### Internal module values
|
62
|
+
|
63
|
+
# packages
|
64
|
+
case $::operatingsystem {
|
65
|
+
'CentOS', 'Fedora', 'Scientific', 'RedHat', 'Amazon', 'OracleLinux': {
|
66
|
+
# main application
|
67
|
+
$package = [ 'elasticsearch' ]
|
68
|
+
}
|
69
|
+
'Debian', 'Ubuntu': {
|
70
|
+
# main application
|
71
|
+
$package = [ 'elasticsearch' ]
|
72
|
+
}
|
73
|
+
default: {
|
74
|
+
fail("\"${module_name}\" provides no package default value
|
75
|
+
for \"${::operatingsystem}\"")
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
# service parameters
|
80
|
+
case $::operatingsystem {
|
81
|
+
'CentOS', 'Fedora', 'Scientific', 'RedHat', 'Amazon', 'OracleLinux': {
|
82
|
+
$service_name = 'elasticsearch'
|
83
|
+
$service_hasrestart = true
|
84
|
+
$service_hasstatus = true
|
85
|
+
$service_pattern = $service_name
|
86
|
+
$service_provider = 'redhat'
|
87
|
+
$service_settings_path = "/etc/sysconfig/${service_name}"
|
88
|
+
}
|
89
|
+
'Debian', 'Ubuntu': {
|
90
|
+
$service_name = 'elasticsearch'
|
91
|
+
$service_hasrestart = true
|
92
|
+
$service_hasstatus = true
|
93
|
+
$service_pattern = $service_name
|
94
|
+
$service_provider = 'debian'
|
95
|
+
$service_settings_path = "/etc/default/${service_name}"
|
96
|
+
}
|
97
|
+
default: {
|
98
|
+
fail("\"${module_name}\" provides no service parameters
|
99
|
+
for \"${::operatingsystem}\"")
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
}
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# == Define: elasticsearch::plugin
|
2
|
+
#
|
3
|
+
# This define allows you to install arbitrary Elasticsearch plugins
|
4
|
+
# either by using the default repositories or by specifying an URL
|
5
|
+
#
|
6
|
+
# All default values are defined in the elasticsearch::params class.
|
7
|
+
#
|
8
|
+
#
|
9
|
+
# === Parameters
|
10
|
+
#
|
11
|
+
# [*module_dir*]
|
12
|
+
# Directory name where the module will be installed
|
13
|
+
# Value type is string
|
14
|
+
# Default value: None
|
15
|
+
# This variable is required
|
16
|
+
#
|
17
|
+
# [*ensure*]
|
18
|
+
# Whether the plugin will be installed or removed.
|
19
|
+
# Set to 'absent' to ensure a plugin is not installed
|
20
|
+
# Value type is string
|
21
|
+
# Default value: present
|
22
|
+
# This variable is optional
|
23
|
+
#
|
24
|
+
# [*url*]
|
25
|
+
# Specify an URL where to download the plugin from.
|
26
|
+
# Value type is string
|
27
|
+
# Default value: None
|
28
|
+
# This variable is optional
|
29
|
+
#
|
30
|
+
#
|
31
|
+
# === Examples
|
32
|
+
#
|
33
|
+
# # From official repository
|
34
|
+
# elasticsearch::plugin{'mobz/elasticsearch-head': module_dir => 'head'}
|
35
|
+
#
|
36
|
+
# # From custom url
|
37
|
+
# elasticsearch::plugin{ 'elasticsearch-jetty':
|
38
|
+
# module_dir => 'elasticsearch-jetty',
|
39
|
+
# url => 'https://oss-es-plugins.s3.amazonaws.com/elasticsearch-jetty/elasticsearch-jetty-0.90.0.zip',
|
40
|
+
# }
|
41
|
+
#
|
42
|
+
# === Authors
|
43
|
+
#
|
44
|
+
# * Matteo Sessa <mailto:matteo.sessa@catchoftheday.com.au>
|
45
|
+
# * Dennis Konert <mailto:dkonert@gmail.com>
|
46
|
+
#
|
47
|
+
define elasticsearch::plugin(
|
48
|
+
$module_dir,
|
49
|
+
$ensure = 'present',
|
50
|
+
$url = ''
|
51
|
+
) {
|
52
|
+
|
53
|
+
require elasticsearch::params
|
54
|
+
|
55
|
+
Exec {
|
56
|
+
path => [ '/bin', '/usr/bin', '/usr/local/bin' ],
|
57
|
+
cwd => '/',
|
58
|
+
}
|
59
|
+
|
60
|
+
$notify_elasticsearch = $elasticsearch::restart_on_change ? {
|
61
|
+
false => undef,
|
62
|
+
default => Class['elasticsearch::service'],
|
63
|
+
}
|
64
|
+
|
65
|
+
if ($module_dir != '') {
|
66
|
+
validate_string($module_dir)
|
67
|
+
} else {
|
68
|
+
fail("module_dir undefined for plugin ${name}")
|
69
|
+
}
|
70
|
+
|
71
|
+
if ($url != '') {
|
72
|
+
validate_string($url)
|
73
|
+
$install_cmd = "${elasticsearch::plugintool} -install ${name} -url ${url}"
|
74
|
+
$exec_rets = [0,1]
|
75
|
+
} else {
|
76
|
+
$install_cmd = "${elasticsearch::plugintool} -install ${name}"
|
77
|
+
$exec_rets = [0,]
|
78
|
+
}
|
79
|
+
|
80
|
+
case $ensure {
|
81
|
+
'installed', 'present': {
|
82
|
+
exec {"install-plugin-${name}":
|
83
|
+
command => $install_cmd,
|
84
|
+
creates => "${elasticsearch::plugindir}/${module_dir}",
|
85
|
+
returns => $exec_rets,
|
86
|
+
notify => $notify_elasticsearch,
|
87
|
+
}
|
88
|
+
}
|
89
|
+
default: {
|
90
|
+
exec {"remove-plugin-${name}":
|
91
|
+
command => "${elasticsearch::plugintool} --remove ${module_dir}",
|
92
|
+
onlyif => "test -d ${elasticsearch::plugindir}/${module_dir}",
|
93
|
+
notify => $notify_elasticsearch,
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# there are many python bindings for elasticsearch. This provides all
|
2
|
+
# the ones we know about http://www.elasticsearch.org/guide/clients/
|
3
|
+
define elasticsearch::python (
|
4
|
+
$ensure = 'installed',
|
5
|
+
) {
|
6
|
+
|
7
|
+
# make sure the package name is valid and setup the provider as
|
8
|
+
# necessary
|
9
|
+
case $name {
|
10
|
+
'pyes': {
|
11
|
+
$provider = 'pip'
|
12
|
+
}
|
13
|
+
'rawes': {
|
14
|
+
$provider = 'pip'
|
15
|
+
}
|
16
|
+
'pyelasticsearch': {
|
17
|
+
$provider = 'pip'
|
18
|
+
}
|
19
|
+
'ESClient': {
|
20
|
+
$provider = 'pip'
|
21
|
+
}
|
22
|
+
'elasticutils': {
|
23
|
+
$provider = 'pip'
|
24
|
+
}
|
25
|
+
default: {
|
26
|
+
fail("unknown python binding package '${name}'")
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
package { $name:
|
31
|
+
ensure => $ensure,
|
32
|
+
provider => $provider,
|
33
|
+
}
|
34
|
+
}
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# == Class: elasticsearch::service
|
2
|
+
#
|
3
|
+
# This class exists to coordinate all service management related actions,
|
4
|
+
# functionality and logical units in a central place.
|
5
|
+
#
|
6
|
+
# <b>Note:</b> "service" is the Puppet term and type for background processes
|
7
|
+
# in general and is used in a platform-independent way. E.g. "service" means
|
8
|
+
# "daemon" in relation to Unix-like systems.
|
9
|
+
#
|
10
|
+
#
|
11
|
+
# === Parameters
|
12
|
+
#
|
13
|
+
# This class does not provide any parameters.
|
14
|
+
#
|
15
|
+
#
|
16
|
+
# === Examples
|
17
|
+
#
|
18
|
+
# This class may be imported by other classes to use its functionality:
|
19
|
+
# class { 'elasticsearch::service': }
|
20
|
+
#
|
21
|
+
# It is not intended to be used directly by external resources like node
|
22
|
+
# definitions or other modules.
|
23
|
+
#
|
24
|
+
#
|
25
|
+
# === Authors
|
26
|
+
#
|
27
|
+
# * Richard Pijnenburg <mailto:richard@ispavailability.com>
|
28
|
+
#
|
29
|
+
class elasticsearch::service {
|
30
|
+
|
31
|
+
include elasticsearch
|
32
|
+
|
33
|
+
$notify_elasticsearch = $elasticsearch::restart_on_change ? {
|
34
|
+
false => undef,
|
35
|
+
default => Service['elasticsearch'],
|
36
|
+
}
|
37
|
+
|
38
|
+
#### Service management
|
39
|
+
|
40
|
+
# set params: in operation
|
41
|
+
if $elasticsearch::ensure == 'present' {
|
42
|
+
|
43
|
+
case $elasticsearch::status {
|
44
|
+
# make sure service is currently running, start it on boot
|
45
|
+
'enabled': {
|
46
|
+
$service_ensure = 'running'
|
47
|
+
$service_enable = true
|
48
|
+
}
|
49
|
+
# make sure service is currently stopped, do not start it on boot
|
50
|
+
'disabled': {
|
51
|
+
$service_ensure = 'stopped'
|
52
|
+
$service_enable = false
|
53
|
+
}
|
54
|
+
# make sure service is currently running, do not start it on boot
|
55
|
+
'running': {
|
56
|
+
$service_ensure = 'running'
|
57
|
+
$service_enable = false
|
58
|
+
}
|
59
|
+
# do not start service on boot, do not care whether currently running or not
|
60
|
+
'unmanaged': {
|
61
|
+
$service_ensure = undef
|
62
|
+
$service_enable = false
|
63
|
+
}
|
64
|
+
# unknown status
|
65
|
+
# note: don't forget to update the parameter check in init.pp if you
|
66
|
+
# add a new or change an existing status.
|
67
|
+
default: {
|
68
|
+
fail("\"${elasticsearch::status}\" is an unknown service status value")
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
# set params: removal
|
73
|
+
} else {
|
74
|
+
|
75
|
+
# make sure the service is stopped and disabled (the removal itself will be
|
76
|
+
# done by package.pp)
|
77
|
+
$service_ensure = 'stopped'
|
78
|
+
$service_enable = false
|
79
|
+
|
80
|
+
}
|
81
|
+
|
82
|
+
file {$elasticsearch::params::service_settings_path:
|
83
|
+
ensure => file,
|
84
|
+
content => template("${module_name}/etc/default/elasticsearch.erb"),
|
85
|
+
owner => 'root',
|
86
|
+
group => 'root',
|
87
|
+
mode => '0644',
|
88
|
+
notify => $notify_elasticsearch,
|
89
|
+
}
|
90
|
+
|
91
|
+
if $elasticsearch::status != 'unmanaged' and $elasticsearch::initfile != undef {
|
92
|
+
# Write service file
|
93
|
+
file { '/etc/init.d/elasticsearch':
|
94
|
+
ensure => present,
|
95
|
+
source => $elasticsearch::initfile,
|
96
|
+
owner => 'root',
|
97
|
+
group => 'root',
|
98
|
+
mode => '0555',
|
99
|
+
before => Service[ 'elasticsearch' ]
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
# action
|
104
|
+
service { 'elasticsearch':
|
105
|
+
ensure => $service_ensure,
|
106
|
+
enable => $service_enable,
|
107
|
+
name => $elasticsearch::params::service_name,
|
108
|
+
hasstatus => $elasticsearch::params::service_hasstatus,
|
109
|
+
hasrestart => $elasticsearch::params::service_hasrestart,
|
110
|
+
pattern => $elasticsearch::params::service_pattern,
|
111
|
+
provider => $elasticsearch::params::service_provider,
|
112
|
+
}
|
113
|
+
|
114
|
+
}
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# == Define: elasticsearch::template
|
2
|
+
#
|
3
|
+
# This define allows you to insert, update or delete templates that are used within Elasticsearch for the indexes
|
4
|
+
#
|
5
|
+
# === Parameters
|
6
|
+
#
|
7
|
+
# [*file*]
|
8
|
+
# File path of the template ( json file )
|
9
|
+
# Value type is string
|
10
|
+
# Default value: undef
|
11
|
+
# This variable is optional
|
12
|
+
#
|
13
|
+
# [*replace*]
|
14
|
+
# Set to 'true' if you intend to replace the existing template
|
15
|
+
# Value type is boolean
|
16
|
+
# Default value: false
|
17
|
+
# This variable is optional
|
18
|
+
#
|
19
|
+
# [*delete*]
|
20
|
+
# Set to 'true' if you intend to delete the existing template
|
21
|
+
# Value type is boolean
|
22
|
+
# Default value: false
|
23
|
+
# This variable is optional
|
24
|
+
#
|
25
|
+
# [*host*]
|
26
|
+
# Host name or IP address of the ES instance to connect to
|
27
|
+
# Value type is string
|
28
|
+
# Default value: localhost
|
29
|
+
# This variable is optional
|
30
|
+
#
|
31
|
+
# [*port*]
|
32
|
+
# Port number of the ES instance to connect to
|
33
|
+
# Value type is number
|
34
|
+
# Default value: 9200
|
35
|
+
# This variable is optional
|
36
|
+
#
|
37
|
+
# === Authors
|
38
|
+
#
|
39
|
+
# * Richard Pijnenburg <mailto:richard@ispavailability.com>
|
40
|
+
#
|
41
|
+
define elasticsearch::template(
|
42
|
+
$file = undef,
|
43
|
+
$replace = false,
|
44
|
+
$delete = false,
|
45
|
+
$host = 'localhost',
|
46
|
+
$port = 9200
|
47
|
+
) {
|
48
|
+
|
49
|
+
require elasticsearch
|
50
|
+
|
51
|
+
Exec {
|
52
|
+
path => [ '/bin', '/usr/bin', '/usr/local/bin' ],
|
53
|
+
cwd => '/',
|
54
|
+
}
|
55
|
+
|
56
|
+
# Build up the url
|
57
|
+
$es_url = "http://${host}:${port}/_template/${name}"
|
58
|
+
|
59
|
+
# Can't do a replace and delete at the same time
|
60
|
+
if $replace == true and $delete == true {
|
61
|
+
fail('Replace and Delete cant be used together')
|
62
|
+
}
|
63
|
+
|
64
|
+
if $delete == false {
|
65
|
+
# Fail when no file is supplied
|
66
|
+
if $file == undef {
|
67
|
+
fail('The variable "file" cannot be empty when inserting or updating a template')
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
$file_ensure = $delete ? {
|
72
|
+
true => 'absent',
|
73
|
+
default => 'present'
|
74
|
+
}
|
75
|
+
|
76
|
+
$file_notify = $delete ? {
|
77
|
+
true => undef,
|
78
|
+
default => Exec[ "insert_template ${name}" ]
|
79
|
+
}
|
80
|
+
|
81
|
+
# place the template file
|
82
|
+
file { "${elasticsearch::confdir}/templates_import/elasticsearch-template-${name}.json":
|
83
|
+
ensure => $file_ensure,
|
84
|
+
source => $file,
|
85
|
+
notify => $file_notify,
|
86
|
+
require => Exec[ 'mkdir_templates' ],
|
87
|
+
}
|
88
|
+
|
89
|
+
if $replace == true or $delete == true {
|
90
|
+
|
91
|
+
# Only notify the insert_template call when we do a replace.
|
92
|
+
$exec_notify = $replace ? {
|
93
|
+
true => Exec[ "insert_template ${name}" ],
|
94
|
+
default => undef
|
95
|
+
}
|
96
|
+
|
97
|
+
# Delete the existing template
|
98
|
+
# First check if it exists of course
|
99
|
+
exec { "delete_template ${name}":
|
100
|
+
command => "curl -s -XDELETE ${es_url}",
|
101
|
+
onlyif => "test $(curl -s '${es_url}?pretty=true' | wc -l) -gt 1",
|
102
|
+
notify => $exec_notify
|
103
|
+
}
|
104
|
+
|
105
|
+
}
|
106
|
+
|
107
|
+
# Insert the template if we don't delete an existing one
|
108
|
+
# Before inserting we check if a template exists with that same name
|
109
|
+
if $delete == false {
|
110
|
+
exec { "insert_template ${name}":
|
111
|
+
command => "curl -s -XPUT ${es_url} -d @${elasticsearch::confdir}/templates_import/elasticsearch-template-${name}.json",
|
112
|
+
unless => "test $(curl -s '${es_url}?pretty=true' | wc -l) -gt 1",
|
113
|
+
refreshonly => true,
|
114
|
+
tries => 3,
|
115
|
+
try_sleep => 10
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
{
|
2
|
+
"project_page": "https://github.com/elasticsearch/puppet-elasticsearch",
|
3
|
+
"license": "Apache License, Version 2.0",
|
4
|
+
"source": "https://github.com/elasticsearch/puppet-elasticsearch",
|
5
|
+
"checksums": {
|
6
|
+
"spec/spec_helper.rb": "3ea886dd135e120afa31e0aab12e85b0",
|
7
|
+
"LICENSE": "1fc7fa7c411594f07888338b1865e9d7",
|
8
|
+
"templates/etc/elasticsearch/elasticsearch.yml.erb": "7960bf7708776396cf094e6bd5ee9e97",
|
9
|
+
"manifests/init.pp": "0a2ee898e72bc85b7f91b12b22072a04",
|
10
|
+
"manifests/package.pp": "f888a269dffc8ba1358b3fe558f7ddb9",
|
11
|
+
"manifests/template.pp": "a362fdf5c9e26510048fa9e730ed49bf",
|
12
|
+
"templates/etc/default/elasticsearch.erb": "496bf6f670c8a68653f2b9256c1539e0",
|
13
|
+
"spec/classes/elasticsearch_init_spec.rb": "d876ee65fe9cbabfc4f04de48a17c7a4",
|
14
|
+
"manifests/params.pp": "01a422c1a84ee073e0ebafc2585ff7ed",
|
15
|
+
"CHANGELOG": "6fa25a87d60ed7311403992eec4081c8",
|
16
|
+
"manifests/config.pp": "0463f24a00e0472996c0b18d5e976e5b",
|
17
|
+
"manifests/python.pp": "c3a546ce1eba575c209175867494f599",
|
18
|
+
"manifests/service.pp": "50709f07a8bea21172d59eeb15e589f1",
|
19
|
+
"Modulefile": "beaacf02407cbdcc878b0df8bef3b514",
|
20
|
+
"README.md": "a75ebe5b4562b12eda4cf4fa3f696931",
|
21
|
+
"Rakefile": "d9fad069cf2dfdc0541548e278e39bbb",
|
22
|
+
"manifests/java.pp": "94ecd1ef0bdccf492657c39a04d9d09e",
|
23
|
+
"manifests/plugin.pp": "b02c99cbd74aa0b20f547e942b854cf3",
|
24
|
+
"spec/defines/template_spec.rb": "a3bc69d8e679bdef1a4ff4957a2c68e8",
|
25
|
+
"CONTRIBUTORS": "14df2fd27cf7b6ca9833527f2ba93442"
|
26
|
+
},
|
27
|
+
"types": [
|
28
|
+
|
29
|
+
],
|
30
|
+
"description": "Module for managing and configuring Elasticsearch nodes",
|
31
|
+
"version": "0.1.3",
|
32
|
+
"summary": "Module for managing and configuring Elasticsearch nodes",
|
33
|
+
"name": "ispavailability-elasticsearch",
|
34
|
+
"author": "ispavailability",
|
35
|
+
"dependencies": [
|
36
|
+
{
|
37
|
+
"version_requirement": ">= 3.0.0",
|
38
|
+
"name": "puppetlabs/stdlib"
|
39
|
+
}
|
40
|
+
]
|
41
|
+
}
|