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,93 @@
|
|
1
|
+
<%-
|
2
|
+
|
3
|
+
# Function to make a structured and sorted yaml representation out of a hash
|
4
|
+
def recursive_hash_to_yml_string(hash, depth=0)
|
5
|
+
spacer = ""
|
6
|
+
depth.times { spacer += " "}
|
7
|
+
hash.keys.sort.each do |sorted_key|
|
8
|
+
@yml_string += spacer + sorted_key + ": "
|
9
|
+
if hash[sorted_key].is_a?(Array)
|
10
|
+
keyspacer = ""
|
11
|
+
sorted_key.length.times { keyspacer += " " }
|
12
|
+
@yml_string += "\n"
|
13
|
+
hash[sorted_key].each do |item|
|
14
|
+
@yml_string += spacer + keyspacer + "- " + item +"\n"
|
15
|
+
end
|
16
|
+
elsif hash[sorted_key].is_a?(Hash)
|
17
|
+
@yml_string += "\n"
|
18
|
+
recursive_hash_to_yml_string(hash[sorted_key], depth+1)
|
19
|
+
else
|
20
|
+
@yml_string += "#{hash[sorted_key].to_s}\n"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Function to transform shorted write up of the keys into full hash representation
|
26
|
+
def transform(hash)
|
27
|
+
return_vals = []
|
28
|
+
|
29
|
+
hash.each do |key,val|
|
30
|
+
if m = /^([^.]+)\.(.*)$/.match(key)
|
31
|
+
temp = { m[1] => { m[2] => val } }
|
32
|
+
transform(temp).each do |stuff|
|
33
|
+
return_vals << stuff
|
34
|
+
end
|
35
|
+
else
|
36
|
+
if val.is_a?(Hash)
|
37
|
+
transform(val).each do |stuff|
|
38
|
+
return_vals << { key => stuff }
|
39
|
+
end
|
40
|
+
else
|
41
|
+
return_vals << { key => val }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
return_vals
|
47
|
+
end
|
48
|
+
|
49
|
+
# Function to deep merge hashes with same keys
|
50
|
+
class ::Hash
|
51
|
+
def deep_merge_with_array_values_concatenated(hash)
|
52
|
+
target = dup
|
53
|
+
|
54
|
+
hash.keys.each do |key|
|
55
|
+
if hash[key].is_a? Hash and self[key].is_a? Hash
|
56
|
+
target[key] = target[key].deep_merge_with_array_values_concatenated(hash[key])
|
57
|
+
next
|
58
|
+
end
|
59
|
+
|
60
|
+
if hash[key].is_a?(Array) && target[key].is_a?(Array)
|
61
|
+
target[key] = target[key] + hash[key]
|
62
|
+
else
|
63
|
+
target[key] = hash[key]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
target
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# initial string
|
72
|
+
@yml_string = "### MANAGED BY PUPPET ###\n"
|
73
|
+
|
74
|
+
if !@settings.empty?
|
75
|
+
|
76
|
+
@yml_string += "---\n"
|
77
|
+
|
78
|
+
## Transform shorted keys into full write up
|
79
|
+
transformed_config = transform(@settings)
|
80
|
+
|
81
|
+
# Merge it back into a hash
|
82
|
+
tmphash = { }
|
83
|
+
transformed_config.each do |subhash|
|
84
|
+
tmphash = tmphash.deep_merge_with_array_values_concatenated(subhash)
|
85
|
+
end
|
86
|
+
|
87
|
+
# Transform it into yaml
|
88
|
+
recursive_hash_to_yml_string(tmphash)
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
-%>
|
93
|
+
<%= @yml_string -%>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
name 'saz-memcached'
|
2
|
+
version '2.0.2'
|
3
|
+
source 'git://github.com/saz/puppet-memcached.git'
|
4
|
+
author 'saz'
|
5
|
+
license 'Apache License, Version 2.0'
|
6
|
+
summary 'UNKNOWN'
|
7
|
+
description 'Manage memcached via Puppet'
|
8
|
+
project_page 'https://github.com/saz/puppet-memcached'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
# puppet-memcached
|
3
|
+
|
4
|
+
Manage memcached via Puppet
|
5
|
+
|
6
|
+
## How to use
|
7
|
+
|
8
|
+
### Use roughly 90% of memory
|
9
|
+
|
10
|
+
```
|
11
|
+
class { 'memcached': }
|
12
|
+
```
|
13
|
+
|
14
|
+
### Set a fixed memory limit in MB
|
15
|
+
|
16
|
+
```
|
17
|
+
class { 'memcached':
|
18
|
+
max_memory => 2048
|
19
|
+
}
|
20
|
+
```
|
21
|
+
|
22
|
+
### Other class parameters
|
23
|
+
|
24
|
+
* $logfile = '/var/log/memcached.log'
|
25
|
+
* $listen_ip = '0.0.0.0'
|
26
|
+
* $tcp_port = 11211
|
27
|
+
* $udp_port = 11211
|
28
|
+
* $user = '' (OS specific setting, see params.pp)
|
29
|
+
* $max_connections = 8192
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class memcached(
|
2
|
+
$package_ensure = 'present',
|
3
|
+
$logfile = '/var/log/memcached.log',
|
4
|
+
$max_memory = false,
|
5
|
+
$listen_ip = '0.0.0.0',
|
6
|
+
$tcp_port = 11211,
|
7
|
+
$udp_port = 11211,
|
8
|
+
$user = $::memcached::params::user,
|
9
|
+
$max_connections = '8192',
|
10
|
+
$verbosity = undef,
|
11
|
+
$unix_socket = undef
|
12
|
+
) inherits memcached::params {
|
13
|
+
|
14
|
+
package { $memcached::params::package_name:
|
15
|
+
ensure => $package_ensure,
|
16
|
+
}
|
17
|
+
|
18
|
+
file { $memcached::params::config_file:
|
19
|
+
owner => 'root',
|
20
|
+
group => 'root',
|
21
|
+
mode => '0644',
|
22
|
+
content => template($memcached::params::config_tmpl),
|
23
|
+
require => Package[$memcached::params::package_name],
|
24
|
+
}
|
25
|
+
|
26
|
+
service { $memcached::params::service_name:
|
27
|
+
ensure => running,
|
28
|
+
enable => true,
|
29
|
+
hasrestart => true,
|
30
|
+
hasstatus => false,
|
31
|
+
subscribe => File[$memcached::params::config_file],
|
32
|
+
}
|
33
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class memcached::params {
|
2
|
+
case $::osfamily {
|
3
|
+
'Debian': {
|
4
|
+
$package_name = 'memcached'
|
5
|
+
$service_name = 'memcached'
|
6
|
+
$config_file = '/etc/memcached.conf'
|
7
|
+
$config_tmpl = "${module_name}/memcached.conf.erb"
|
8
|
+
$user = 'nobody'
|
9
|
+
}
|
10
|
+
'RedHat': {
|
11
|
+
$package_name = 'memcached'
|
12
|
+
$service_name = 'memcached'
|
13
|
+
$config_file = '/etc/sysconfig/memcached'
|
14
|
+
$config_tmpl = "${module_name}/memcached_sysconfig.erb"
|
15
|
+
$user = 'memcached'
|
16
|
+
}
|
17
|
+
default: {
|
18
|
+
fail("Unsupported platform: ${::osfamily}")
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# File managed by puppet
|
2
|
+
|
3
|
+
# Run memcached as a daemon.
|
4
|
+
-d
|
5
|
+
|
6
|
+
# pidfile
|
7
|
+
-P /var/run/memcached.pid
|
8
|
+
|
9
|
+
# Log memcached's output
|
10
|
+
logfile <%= logfile %>
|
11
|
+
|
12
|
+
<% if @verbosity -%>
|
13
|
+
# Verbosity
|
14
|
+
-<%= verbosity %>
|
15
|
+
<% end -%>
|
16
|
+
|
17
|
+
# Use <num> MB memory max to use for object storage.
|
18
|
+
<% if max_memory -%>
|
19
|
+
-m <%= max_memory %>
|
20
|
+
<% else -%>
|
21
|
+
-m <%= ((memorysize.to_f*1024)*0.95).floor %>
|
22
|
+
<% end -%>
|
23
|
+
|
24
|
+
<% if @unix_socket -%>
|
25
|
+
# UNIX socket path to listen on
|
26
|
+
-s <%= unix_socket %>
|
27
|
+
<% else -%>
|
28
|
+
|
29
|
+
# IP to listen on
|
30
|
+
-l <%= listen_ip %>
|
31
|
+
|
32
|
+
# TCP port to listen on
|
33
|
+
-p <%= tcp_port %>
|
34
|
+
|
35
|
+
# UDP port to listen on
|
36
|
+
-U <%= udp_port %>
|
37
|
+
<% end -%>
|
38
|
+
|
39
|
+
# Run daemon as user
|
40
|
+
-u <%= user %>
|
41
|
+
|
42
|
+
# Limit the number of simultaneous incoming connections.
|
43
|
+
-c <%= max_connections %>
|
44
|
+
|
45
|
+
# Number of threads to use to process incoming requests.
|
46
|
+
-t <%= processorcount %>
|
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
@@ -0,0 +1,124 @@
|
|
1
|
+
# Mysql module for Puppet
|
2
|
+
|
3
|
+
This module manages mysql on Linux (RedHat/Debian) distros. A native mysql provider implements database resource type to handle database, database user, and database permission.
|
4
|
+
|
5
|
+
## Description
|
6
|
+
|
7
|
+
This module uses the fact osfamily which is supported by Facter 1.6.1+. If you do not have facter 1.6.1 in your environment, the following manifests will provide the same functionality in site.pp (before declaring any node):
|
8
|
+
|
9
|
+
if ! $::osfamily {
|
10
|
+
case $::operatingsystem {
|
11
|
+
'RedHat', 'Fedora', 'CentOS', 'Scientific', 'SLC', 'Ascendos', 'CloudLinux', 'PSBM', 'OracleLinux', 'OVS', 'OEL': {
|
12
|
+
$osfamily = 'RedHat'
|
13
|
+
}
|
14
|
+
'ubuntu', 'debian': {
|
15
|
+
$osfamily = 'Debian'
|
16
|
+
}
|
17
|
+
'SLES', 'SLED', 'OpenSuSE', 'SuSE': {
|
18
|
+
$osfamily = 'Suse'
|
19
|
+
}
|
20
|
+
'Solaris', 'Nexenta': {
|
21
|
+
$osfamily = 'Solaris'
|
22
|
+
}
|
23
|
+
default: {
|
24
|
+
$osfamily = $::operatingsystem
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
This module depends on creates_resources function which is introduced in Puppet 2.7. Users on puppet 2.6 can use the following module which provides this functionality:
|
30
|
+
|
31
|
+
[http://github.com/puppetlabs/puppetlabs-create_resources](http://github.com/puppetlabs/puppetlabs-create_resources)
|
32
|
+
|
33
|
+
This module is based on work by David Schmitt. The following contributor have contributed patches to this module (beyond Puppet Labs):
|
34
|
+
|
35
|
+
* Christian G. Warden
|
36
|
+
* Daniel Black
|
37
|
+
* Justin Ellison
|
38
|
+
* Lowe Schmidt
|
39
|
+
* Matthias Pigulla
|
40
|
+
* William Van Hevelingen
|
41
|
+
* Michael Arnold
|
42
|
+
|
43
|
+
## Usage
|
44
|
+
|
45
|
+
### mysql
|
46
|
+
Installs the mysql-client package.
|
47
|
+
|
48
|
+
class { 'mysql': }
|
49
|
+
|
50
|
+
### mysql::java
|
51
|
+
Installs mysql bindings for java.
|
52
|
+
|
53
|
+
class { 'mysql::java': }
|
54
|
+
|
55
|
+
### mysql::python
|
56
|
+
Installs mysql bindings for python.
|
57
|
+
|
58
|
+
class { 'mysql::python': }
|
59
|
+
|
60
|
+
### mysql::ruby
|
61
|
+
Installs mysql bindings for ruby.
|
62
|
+
|
63
|
+
class { 'mysql::ruby': }
|
64
|
+
|
65
|
+
### mysql::server
|
66
|
+
Installs mysql-server packages, configures my.cnf and starts mysqld service:
|
67
|
+
|
68
|
+
class { 'mysql::server':
|
69
|
+
config_hash => { 'root_password' => 'foo' }
|
70
|
+
}
|
71
|
+
|
72
|
+
Database login information stored in `/root/.my.cnf`.
|
73
|
+
|
74
|
+
### mysql::db
|
75
|
+
Creates a database with a user and assign some privileges.
|
76
|
+
|
77
|
+
mysql::db { 'mydb':
|
78
|
+
user => 'myuser',
|
79
|
+
password => 'mypass',
|
80
|
+
host => 'localhost',
|
81
|
+
grant => ['all'],
|
82
|
+
}
|
83
|
+
|
84
|
+
### mysql::backup
|
85
|
+
Installs a mysql backup script, cronjob, and priviledged backup user.
|
86
|
+
|
87
|
+
class { 'mysql::backup':
|
88
|
+
backupuser => 'myuser',
|
89
|
+
backuppassword => 'mypassword',
|
90
|
+
backupdir => '/tmp/backups',
|
91
|
+
}
|
92
|
+
|
93
|
+
### Providers for database types:
|
94
|
+
MySQL provider supports puppet resources command:
|
95
|
+
|
96
|
+
$ puppet resource database
|
97
|
+
database { 'information_schema':
|
98
|
+
ensure => 'present',
|
99
|
+
charset => 'utf8',
|
100
|
+
}
|
101
|
+
database { 'mysql':
|
102
|
+
ensure => 'present',
|
103
|
+
charset => 'latin1',
|
104
|
+
}
|
105
|
+
|
106
|
+
The custom resources can be used in any other manifests:
|
107
|
+
|
108
|
+
database { 'mydb':
|
109
|
+
charset => 'latin1',
|
110
|
+
}
|
111
|
+
|
112
|
+
database_user { 'bob@localhost':
|
113
|
+
password_hash => mysql_password('foo')
|
114
|
+
}
|
115
|
+
|
116
|
+
database_grant { 'user@localhost/database':
|
117
|
+
privileges => ['all'] ,
|
118
|
+
}
|
119
|
+
|
120
|
+
A resource default can be specified to handle dependency:
|
121
|
+
|
122
|
+
Database {
|
123
|
+
require => Class['mysql::server'],
|
124
|
+
}
|