commit
2e1c0e7547
27 changed files with 1074 additions and 0 deletions
-
24.fixtures.yml
-
27.gitignore
-
28.travis.yml
-
28CONTRIBUTING.md
-
13Gemfile
-
202LICENSE
-
67README.md
-
27Rakefile
-
14data/common.yaml
-
18data/os/Debian.yaml
-
18data/os/RedHat.yaml
-
5data/testing.yaml
-
10hiera.yaml
-
68manifests/database.pp
-
64manifests/extract.pp
-
118manifests/init.pp
-
37manifests/php.pp
-
59manifests/webserver.pp
-
36metadata.json
-
40spec/acceptance/default_spec.rb
-
15spec/acceptance/nodesets/centos-7-x64.yml
-
17spec/acceptance/nodesets/debian-7-x64.yml
-
17spec/acceptance/nodesets/default.yml
-
59spec/classes/init_spec.rb
-
9spec/hiera/hiera.yaml
-
18spec/spec_helper.rb
-
36spec/spec_helper_acceptance.rb
@ -0,0 +1,24 @@ |
|||
--- |
|||
fixtures: |
|||
repositories: |
|||
stdlib: |
|||
ref: "4.12.0" |
|||
repo: "https://github.com/puppetlabs/puppetlabs-stdlib" |
|||
archive: |
|||
ref: "v1.1.1" |
|||
repo: "https://github.com/voxpupuli/puppet-archive" |
|||
mysql: |
|||
ref: "3.8.0" |
|||
repo: "http://github.com/puppetlabs/puppetlabs-mysql" |
|||
staging: |
|||
ref: "v2.0.1" |
|||
repo: "https://github.com/voxpupuli/puppet-staging" |
|||
apache: |
|||
ref: "1.10.0" |
|||
repo: "https://github.com/puppetlabs/puppetlabs-apache" |
|||
concat: |
|||
ref: "2.2.0" |
|||
repo: "https://github.com/puppetlabs/puppetlabs-concat" |
|||
|
|||
symlinks: |
|||
limesurvey: '#{source_dir}' |
@ -0,0 +1,27 @@ |
|||
# Final publish location for module build |
|||
pkg/ |
|||
|
|||
# VIM files |
|||
*.swp |
|||
*.swo |
|||
|
|||
# EMACS files |
|||
\#* |
|||
.\#* |
|||
|
|||
# Mac files |
|||
.DS_Store |
|||
|
|||
# Gem & bundler related files we do not want persisted to the repository |
|||
Gemfile.lock |
|||
.bundle |
|||
vendor/ |
|||
|
|||
# Used by rake spec, for temp modules and other test requirements |
|||
spec/fixtures/ |
|||
log/ |
|||
junit/ |
|||
|
|||
# RVM files that are specific to developers implementation |
|||
.ruby-version |
|||
.ruby-gemset |
@ -0,0 +1,28 @@ |
|||
--- |
|||
language: ruby |
|||
cache: bundler |
|||
|
|||
matrix: |
|||
fast_finish: true |
|||
include: |
|||
- rvm: 2.0 |
|||
env: PUPPET_VERSION="4.3.0" STRICT_VARIABLES="yes" |
|||
services: docker |
|||
sudo: required |
|||
script: bundle exec rake |
|||
- rvm: 2.1 |
|||
env: PUPPET_VERSION="4.5.0" STRICT_VARIABLES="yes" |
|||
services: docker |
|||
sudo: required |
|||
script: bundle exec rake |
|||
- rvm: 2.2 |
|||
env: PUPPET_VERSION="4.6.1" STRICT_VARIABLES="yes" |
|||
services: docker |
|||
sudo: required |
|||
script: bundle exec rake |
|||
allow_failures: |
|||
- rvm: 2.2 |
|||
env: PUPPET_VERSION="4.6.1" STRICT_VARIABLES="yes" BEAKER_set="centos-7-x64" |
|||
services: docker |
|||
sudo: required |
|||
script: bundle exec rake |
@ -0,0 +1,28 @@ |
|||
# Testing |
|||
|
|||
## Prerequisites |
|||
|
|||
`Docker` and `ruby` need to be installed on the local machine. |
|||
|
|||
## Running Tests |
|||
|
|||
After cloning the repository the testing environment should be set up on the |
|||
local machine: |
|||
|
|||
``` |
|||
$ bundle install --path vendor/bundle |
|||
$ bundle exec rake |
|||
``` |
|||
|
|||
With running `rake` the whole testsuite is triggered, this |
|||
includes: |
|||
|
|||
* puppet syntax validation |
|||
* code-style enforcement (with `puppet-lint`) |
|||
* unit-tests (with `rspec-puppet`) |
|||
* acceptance-tests (with `beaker-rspec`) |
|||
|
|||
## Coding Standards |
|||
|
|||
* All variables are defined in the base manifest (init.pp) |
|||
* No more than 140 characters per line |
@ -0,0 +1,13 @@ |
|||
source ENV['GEM_SOURCE'] || 'https://rubygems.org' |
|||
|
|||
puppetversion = ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'] : ['4.5'] |
|||
gem 'puppet', puppetversion, :require => false |
|||
gem 'puppetlabs_spec_helper', :require => false |
|||
gem 'metadata-json-lint', :require => false |
|||
gem 'rspec-puppet', :require => false |
|||
gem 'rspec-puppet-facts', :require => false |
|||
gem 'rake', :require => false |
|||
# beaker related gems |
|||
gem 'beaker-rspec', :require => false |
|||
gem 'serverspec', :require => false |
|||
gem 'specinfra', :require => false |
@ -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. |
@ -0,0 +1,67 @@ |
|||
# limesurvey |
|||
|
|||
#### Table of Contents |
|||
|
|||
1. [Description](#description) |
|||
1. [Setup - The basics of getting started with limesurvey](#setup) |
|||
* [Beginning with limesurvey](#beginning-with-limesurvey) |
|||
1. [Usage - Configuration options and additional functionality](#usage) |
|||
1. [Reference - An under-the-hood peek at what the module is doing and how](#reference) |
|||
1. [Limitations - OS compatibility, etc.](#limitations) |
|||
1. [Development - Guide for contributing to the module](#development) |
|||
|
|||
## Description |
|||
|
|||
This module installs Limesurvey. |
|||
|
|||
Optionally MySQL and Apache2 are installed and managed by this module. However, both classes can be overwritten. |
|||
|
|||
## Setup |
|||
|
|||
### Beginning with limesurvey |
|||
|
|||
Basically this module downloads the code from limesurey.org and places it into the specified directory. |
|||
Without the database class included you need to install and manage the database by yourself. |
|||
|
|||
## Usage |
|||
|
|||
A basic example using both webserver and database |
|||
```puppet |
|||
class { 'limesurvey': |
|||
dbname => 'limesurvey', |
|||
dbpassword => 'foobar', |
|||
dbuser => 'lemongrab', |
|||
sql_root_password => 'foobar', |
|||
manage_webserver => false, |
|||
} |
|||
``` |
|||
|
|||
## Reference |
|||
|
|||
## Classes |
|||
|
|||
#### Public classes |
|||
|
|||
* [`limesurey::init`]: Installs and configures Limesurvey. |
|||
* [`limesurey::extract`]: Downloads the code from limesurey.org |
|||
* [`limesurey::config`]: Manages the configuration of Limesurvey. |
|||
* [`limesurey::database`]: Installs and configures a MySQL database. |
|||
* [`limesurey::webserver`]: Installs and configures an Apacha2 webserver. |
|||
* [`limesurey::php`]: Installs the required PHP packages. |
|||
|
|||
For details on parameters see manifests |
|||
|
|||
## Limitations |
|||
|
|||
This module has been tested on: |
|||
* Debian 7, 8 |
|||
|
|||
The CentOS Build needs fixing but the module should work. |
|||
|
|||
## Development |
|||
|
|||
For further details see CONTRIBUTING.md |
|||
|
|||
## Authors |
|||
|
|||
* Markus Opolka |
@ -0,0 +1,27 @@ |
|||
require 'puppetlabs_spec_helper/rake_tasks' |
|||
require 'puppet-lint/tasks/puppet-lint' |
|||
require 'metadata-json-lint/rake_task' |
|||
|
|||
PuppetLint.configuration.send('disable_80chars') |
|||
PuppetLint.configuration.relative = true |
|||
PuppetLint.configuration.ignore_paths = ['spec/**/*.pp', 'pkg/**/*.pp'] |
|||
|
|||
desc 'Validate manifests, templates, and ruby files' |
|||
task :validate do |
|||
Dir['manifests/**/*.pp'].each do |manifest| |
|||
sh "puppet parser validate --noop #{manifest}" |
|||
end |
|||
Dir['spec/**/*.rb', 'lib/**/*.rb'].each do |ruby_file| |
|||
sh "ruby -c #{ruby_file}" unless ruby_file =~ %r{spec/fixtures} |
|||
end |
|||
Dir['templates/**/*.erb'].each do |template| |
|||
sh "erb -P -x -T '-' #{template} | ruby -c" |
|||
end |
|||
end |
|||
|
|||
desc 'Run metadata_lint, lint, validate, and spec tests.' |
|||
task :default do |
|||
[:metadata_lint, :lint, :validate, :spec, :beaker].each do |test| |
|||
Rake::Task[test].invoke |
|||
end |
|||
end |
@ -0,0 +1,14 @@ |
|||
--- |
|||
limesurvey::archive_path: '/tmp/limesurvey.tar.gz' |
|||
limesurvey::dir_name: 'limesurvey' |
|||
limesurvey::file_name: '%{::limesurvey::dir_name}.tar.gz' |
|||
limesurvey::dbhost: 'localhost' |
|||
limesurvey::download_url: 'https://www.limesurvey.org/stable-release?download=1853:limesurvey2514%20160908targz' |
|||
limesurvey::extract_path: '/opt/' |
|||
limesurvey::manage_database: true |
|||
limesurvey::manage_webserver: true |
|||
limesurvey::manage_php: true |
|||
limesurvey::mpm_module: 'prefork' |
|||
limesurvey::runtime_dir_mode: '0766' |
|||
limesurvey::vhost_name: 'limesurvey' |
|||
limesurvey::vhost_port: '80' |
@ -0,0 +1,18 @@ |
|||
--- |
|||
limesurvey::www_group: 'www-data' |
|||
limesurvey::www_user: 'www-data' |
|||
limesurvey::php_packages: |
|||
php5: |
|||
ensure: present |
|||
php5-mcrypt: |
|||
ensure: present |
|||
php5-gd: |
|||
ensure: present |
|||
php5-ldap: |
|||
ensure: present |
|||
php5-mysql: |
|||
ensure: present |
|||
php5-imap: |
|||
ensure: present |
|||
libapache2-mod-php5: |
|||
ensure: present |
@ -0,0 +1,18 @@ |
|||
--- |
|||
limesurvey::www_group: 'apache' |
|||
limesurvey::www_user: 'apache' |
|||
limesurvey::php_packages: |
|||
epel-release: |
|||
ensure: present |
|||
php: |
|||
ensure: present |
|||
php-mcrypt: |
|||
ensure: present |
|||
php-gd: |
|||
ensure: present |
|||
php-ldap: |
|||
ensure: present |
|||
php-mysql: |
|||
ensure: present |
|||
php-imap: |
|||
ensure: present |
@ -0,0 +1,5 @@ |
|||
--- |
|||
limesurvey::dbname: 'limesurvey' |
|||
limesurvey::dbpassword: 'foobar' |
|||
limesurvey::dbuser: 'limeuser' |
|||
limesurvey::sql_root_password: 'foobar' |
@ -0,0 +1,10 @@ |
|||
--- |
|||
version: 4 |
|||
datadir: data |
|||
hierarchy: |
|||
- name: "OS" |
|||
backend: yaml |
|||
path: "os/%{facts.os.family}" |
|||
|
|||
- name: "common" |
|||
backend: yaml |
@ -0,0 +1,68 @@ |
|||
# Class: limesurvey::database |
|||
# =========================== |
|||
# |
|||
# Manages the MySQL installtion for limesurvey |
|||
# |
|||
# Parameters |
|||
# ---------- |
|||
# |
|||
# * `dbhost` |
|||
# Hostname of the MySQL host |
|||
# |
|||
# * `dbname` |
|||
# Name of the database to install for limesurvey |
|||
# |
|||
# * `dbpassword` |
|||
# Password for the limesurvey database user |
|||
# |
|||
# * `dbuser` |
|||
# Username of the limesurvey database user |
|||
# |
|||
# * `sql_root_password` |
|||
# Root password for the MySQL installation |
|||
# |
|||
# Examples |
|||
# -------- |
|||
# |
|||
# @example |
|||
# class { 'limesurvey::database': |
|||
# dbhost => localhost, |
|||
# dbname => limesurvey, |
|||
# dbpassword => foobar, |
|||
# dbuser => foobar, |
|||
# sql_root_password => foobar, |
|||
# } |
|||
# |
|||
# Authors |
|||
# ------- |
|||
# |
|||
# Author Name <markus@martiablog.de> |
|||
# |
|||
# Copyright |
|||
# --------- |
|||
# |
|||
# Copyright 2016, unless otherwise noted. |
|||
# |
|||
class limesurvey::database ( |
|||
|
|||
String $dbhost = $limesurvey::dbhost, |
|||
String $dbname = $limesurvey::dbname, |
|||
String $dbpassword = $limesurvey::dbpassword, |
|||
String $dbuser = $limesurvey::dbuser, |
|||
String $sql_root_password = $limesurvey::sql_root_password, |
|||
|
|||
) { |
|||
|
|||
class { '::mysql::server': |
|||
root_password => $sql_root_password, |
|||
remove_default_accounts => true, |
|||
} |
|||
|
|||
::mysql::db { $dbname: |
|||
user => $dbuser, |
|||
password => $dbpassword, |
|||
host => $dbhost, |
|||
grant => [ 'SELECT', 'UPDATE', 'CREATE', 'INSERT', 'ALTER', 'DELETE', 'DROP', 'INDEX'], |
|||
} |
|||
|
|||
} |
@ -0,0 +1,64 @@ |
|||
# Class: limesurvey::extract |
|||
# =========================== |
|||
# |
|||
# Manages downloadn and extraction from limesurvey.org |
|||
# |
|||
# Parameters |
|||
# ---------- |
|||
# |
|||
# * `sample parameter` |
|||
# Explanation of what this parameter affects and what it defaults to. |
|||
# |
|||
# Examples |
|||
# -------- |
|||
# |
|||
# @example |
|||
# class { 'limesurvey::extract': |
|||
# } |
|||
# |
|||
# Authors |
|||
# ------- |
|||
# |
|||
# Author Name <markus@martiablog.de> |
|||
# |
|||
# Copyright |
|||
# --------- |
|||
# |
|||
# Copyright 2016, unless otherwise noted. |
|||
# |
|||
class limesurvey::extract ( |
|||
|
|||
String $archive_path = $limesurvey::archive_path, |
|||
String $download_url = $limesurvey::download_url, |
|||
String $extract_path = $limesurvey::extract_path, |
|||
String $install_path = $limesurvey::install_path, |
|||
String $runtime_dir_mode = $limesurvey::runtime_dir_mode, |
|||
String $www_group = $limesurvey::www_group, |
|||
String $www_user = $limesurvey::www_user, |
|||
|
|||
) { |
|||
|
|||
file { $install_path: |
|||
ensure => directory, |
|||
owner => $www_user, |
|||
group => $www_group, |
|||
} |
|||
|
|||
archive { $archive_path: |
|||
ensure => present, |
|||
extract => true, |
|||
extract_path => $extract_path, |
|||
source => $download_url, |
|||
creates => "${install_path}/tmp", |
|||
user => $www_user, |
|||
group => $www_group, |
|||
require => File[$install_path], |
|||
} |
|||
|
|||
file { "${install_path}/tmp/runtime/": |
|||
ensure => directory, |
|||
mode => $runtime_dir_mode, |
|||
require => File[$install_path], |
|||
} |
|||
|
|||
} |
@ -0,0 +1,118 @@ |
|||
# Class: limesurvey |
|||
# =========================== |
|||
# |
|||
# Manages the installation and configuration of Limesurvey |
|||
# Optionally with MySQL and Apache2/PHP |
|||
# |
|||
# Parameters |
|||
# ---------- |
|||
# |
|||
# * `archive_path` |
|||
# Name of path to extract to |
|||
# |
|||
# * `dir_name` |
|||
# Name of directory to extract to |
|||
# |
|||
# * `install_path` |
|||
# Combination of archive_path and dir_name |
|||
# |
|||
# * `download_url` |
|||
# Where to download the limesurey code from. |
|||
# Note: They seem to change that quite often. Be aware. |
|||
# |
|||
# * `extract_path` |
|||
# Target folder path to extract archive |
|||
# |
|||
# * `runtime_dir_mode` |
|||
# Mode of the limesurey runtime directory. Default is 0766, |
|||
# |
|||
# * `www_user |
|||
# Which owner to set to the limesurver directory |
|||
# |
|||
# * `www_group` |
|||
# Which group to set to the limesurver directory |
|||
# |
|||
# * `manage_database` |
|||
# To enable custom database code |
|||
# |
|||
# * `manage_webserver` |
|||
# To enable custom webserver code |
|||
# |
|||
# * `manage_php` |
|||
# To enable custom PHP code |
|||
# |
|||
# Examples |
|||
# -------- |
|||
# |
|||
# @example |
|||
# class { 'limesurvey': |
|||
# dbname => 'limesurvey', |
|||
# dbpassword => 'foobar', |
|||
# dbuser => 'lemongrab', |
|||
# sql_root_password => 'foobar', |
|||
# www_user => 'www-data', |
|||
# www_group => 'www-data', |
|||
# manage_webserver => false, |
|||
# manage_database => true, |
|||
# manage_php => true, |
|||
# } |
|||
# |
|||
# Authors |
|||
# ------- |
|||
# |
|||
# Author Name <markus@martiablog.de> |
|||
# |
|||
# Copyright |
|||
# --------- |
|||
# |
|||
# Copyright 2016, unless otherwise noted. |
|||
# |
|||
class limesurvey ( |
|||
|
|||
String $archive_path, |
|||
String $dir_name, |
|||
String $download_url, |
|||
String $extract_path, |
|||
String $file_name, |
|||
String $runtime_dir_mode, |
|||
String $www_group, |
|||
String $www_user, |
|||
|
|||
Boolean $manage_database, |
|||
Boolean $manage_webserver, |
|||
Boolean $manage_php, |
|||
|
|||
Optional[String] $dbhost, |
|||
Optional[String] $dbname, |
|||
Optional[String] $dbpassword, |
|||
Optional[String] $dbuser, |
|||
Optional[String] $sql_root_password, |
|||
Optional[String] $vhost_name, |
|||
Optional[String] $vhost_port, |
|||
Optional[String] $mpm_module, |
|||
Optional[Hash] $php_packages, |
|||
|
|||
String $database_class = 'limesurvey::database', |
|||
String $webserver_class = 'limesurvey::webserver', |
|||
String $php_class = 'limesurvey::php', |
|||
|
|||
String $install_path = "${extract_path}${dir_name}", |
|||
String $vhost_docroot = $install_path, |
|||
|
|||
) { |
|||
|
|||
contain 'limesurvey::extract' |
|||
|
|||
if $manage_database { |
|||
contain $database_class |
|||
} |
|||
|
|||
if $manage_webserver { |
|||
contain $webserver_class |
|||
} |
|||
|
|||
if $manage_php { |
|||
contain $php_class |
|||
} |
|||
|
|||
} |
@ -0,0 +1,37 @@ |
|||
# Class: limesurvey::php |
|||
# =========================== |
|||
# |
|||
# Installs required PHP packages |
|||
# |
|||
# Parameters |
|||
# ---------- |
|||
# |
|||
# * `php_packages` |
|||
# Hash of all required packages to be installed |
|||
# |
|||
# Examples |
|||
# -------- |
|||
# |
|||
# @example |
|||
# class { 'limesurvey::php': |
|||
# } |
|||
# |
|||
# Authors |
|||
# ------- |
|||
# |
|||
# Author Name <markus@martiablog.de> |
|||
# |
|||
# Copyright |
|||
# --------- |
|||
# |
|||
# Copyright 2016, unless otherwise noted. |
|||
# |
|||
class limesurvey::php ( |
|||
|
|||
Hash $php_packages = $limesurvey::php_packages, |
|||
|
|||
) { |
|||
|
|||
create_resources(package, $php_packages) |
|||
|
|||
} |
@ -0,0 +1,59 @@ |
|||
# Class: limesurvey::webserver |
|||
# =========================== |
|||
# |
|||
# Installs an Apache2 webserver for limesurvey |
|||
# |
|||
# Parameters |
|||
# ---------- |
|||
# |
|||
# * `vhost_docroot` |
|||
# docroot path for apache vhost |
|||
# |
|||
# * `vhost_name` |
|||
# vhost name for apache |
|||
# |
|||
# * `vhost_port` |
|||
# vhost port |
|||
# |
|||
# Examples |
|||
# -------- |
|||
# |
|||
# @example |
|||
# class { 'limesurvey::webserver': |
|||
# vhost_docroot => '/var/www/limesurvey', |
|||
# vhost_name => 'limesurvey', |
|||
# vhost_port => '80', |
|||
# } |
|||
# |
|||
# Authors |
|||
# ------- |
|||
# |
|||
# Author Name <markus@martiablog.de> |
|||
# |
|||
# Copyright |
|||
# --------- |
|||
# |
|||
# Copyright 2016, unless otherwise noted. |
|||
# |
|||
class limesurvey::webserver ( |
|||
|
|||
String $mpm_module = $limesurvey::mpm_module, |
|||
String $vhost_docroot = $limesurvey::vhost_docroot, |
|||
String $vhost_name = $limesurvey::vhost_name, |
|||
String $vhost_port = $limesurvey::vhost_port, |
|||
|
|||
) { |
|||
|
|||
class { 'apache': |
|||
default_vhost => false, |
|||
mpm_module => $mpm_module, |
|||
} |
|||
|
|||
class { '::apache::mod::php': } |
|||
|
|||
apache::vhost { $vhost_name: |
|||
port => $vhost_port, |
|||
docroot => $vhost_docroot, |
|||
} |
|||
|
|||
} |
@ -0,0 +1,36 @@ |
|||
{ |
|||
"name": "martiablog-limesurvey", |
|||
"version": "0.1.0", |
|||
"author": "martiablog", |
|||
"summary": "Installation and Configuration of Limesurvey", |
|||
"license": "Apache-2.0", |
|||
"source": "https://github.com/martialblog/puppet-limesurvey", |
|||
"project_page": "https://github.com/martialblog/puppet-limesurvey", |
|||
"issues_url": "https://github.com/martialblog/puppet-limesurvey/issues", |
|||
"dependencies": [ |
|||
{"name":"puppetlabs-stdlib","version_requirement":">= 1.0.0"}, |
|||
{"name":"puppet-archive","version_requirement":">= 1.1.1"}, |
|||
{"name":"puppetlabs-concat","version_requirement":">= 2.2.0"}, |
|||
{"name":"puppetlabs-apache","version_requirement":">= 1.10.0"}, |
|||
{"name":"puppetlabs-mysql","version_requirement":">= 3.8.0"} |
|||
], |
|||
"data_provider": "hiera", |
|||
"operatingsystem_support": [ |
|||
{ |
|||
"operatingsystem": "Debian", |
|||
"operatingsystemrelease": [ |
|||
"6", |
|||
"7", |
|||
"8" |
|||
] |
|||
}, |
|||
{ |
|||
"operatingsystem": "RedHat", |
|||
"operatingsystemrelease": [ |
|||
"7" |
|||
] |
|||
} |
|||
] |
|||
} |
|||
|
|||
|
@ -0,0 +1,40 @@ |
|||
require 'spec_helper_acceptance' |
|||
|
|||
describe 'limesurvey' do |
|||
|
|||
context 'with defaults' do |
|||
it 'should idempotently run' do |
|||
pp = <<-EOS |
|||
class { 'limesurvey': |
|||
dbname => 'limesurvey', |
|||
dbpassword => 'foobar', |
|||
dbuser => 'lemongrab', |
|||
sql_root_password => 'foobar', |
|||
www_user => 'www-data', |
|||
www_group => 'www-data', |
|||
manage_webserver => false, |
|||
manage_database => true, |
|||
manage_php => true, |
|||
} |
|||
EOS |
|||
|
|||
apply_manifest(pp, :catch_failures => true) |
|||
apply_manifest(pp, :catch_changes => true) |
|||
end |
|||
end |
|||
|
|||
context 'files provisioned' do |
|||
describe file('/opt/limesurvey') do |
|||
it { should be_directory } |
|||
it { should be_owned_by 'www-data' } |
|||
it { should be_grouped_into 'www-data' } |
|||
end |
|||
|
|||
describe file('/opt/limesurvey/tmp') do |
|||
it { should be_directory } |
|||
it { should be_owned_by 'www-data' } |
|||
it { should be_grouped_into 'www-data' } |
|||
end |
|||
end |
|||
|
|||
end |
@ -0,0 +1,15 @@ |
|||
HOSTS: |
|||
centos-7-x64: |
|||
docker_container_name: puppet_limesurvey_centos |
|||
default_apply_opts: |
|||
order: random |
|||
strict_variables: |
|||
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 cron locales-all net-tools wget git-core' |
|||
- 'useradd www-data' |
|||
|
@ -0,0 +1,17 @@ |
|||
HOSTS: |
|||
debian-7-x64: |
|||
docker_container_name: puppet_limesurvey_debian |
|||
default_apply_opts: |
|||
order: random |
|||
strict_variables: |
|||
platform: debian-7-amd64 |
|||
hypervisor : docker |
|||
image: debian:7 |
|||
docker_preserve_image: true |
|||
docker_cmd: '["/sbin/init"]' |
|||
docker_image_commands: |
|||
- 'apt-get install -y cron locales-all net-tools wget git-core' |
|||
- 'rm -f /usr/sbin/policy-rc.d' |
|||
CONFIG: |
|||
type: aio |
|||
|
@ -0,0 +1,17 @@ |
|||
HOSTS: |
|||
debian-8-x64: |
|||
docker_container_name: puppet_limesurvey_debian |
|||
default_apply_opts: |
|||
order: random |
|||
strict_variables: |
|||
platform: debian-8-amd64 |
|||
hypervisor : docker |
|||
image: debian:8 |
|||
docker_preserve_image: true |
|||
docker_cmd: '["/sbin/init"]' |
|||
docker_image_commands: |
|||
- 'apt-get install -y cron locales-all net-tools wget git-core' |
|||
- 'rm -f /usr/sbin/policy-rc.d' |
|||
CONFIG: |
|||
type: aio |
|||
|
@ -0,0 +1,59 @@ |
|||
require 'spec_helper' |
|||
require 'hiera' |
|||
|
|||
describe 'limesurvey' do |
|||
|
|||
on_supported_os.each do |os, facts| |
|||
context "on #{os}" do |
|||
let(:facts) do |
|||
facts.merge({ |
|||
:root_home => '/root' |
|||
}) |
|||
end |
|||
|
|||
|
|||
context 'with default values for all parameters' do |
|||
let(:params) {{ |
|||
:manage_webserver => false, |
|||
:manage_database => false, |
|||
:manage_php => false, |
|||
}} |
|||
|
|||
it { should contain_class('limesurvey') } |
|||
it { should contain_class('limesurvey::extract') } |
|||
it { is_expected.to compile.with_all_deps } |
|||
end |
|||
|
|||
|
|||
context 'with manage database' do |
|||
let(:params) {{ |
|||
:manage_database => true, |
|||
}} |
|||
|
|||
it { should contain_class('limesurvey::database') } |
|||
it { is_expected.to compile.with_all_deps } |
|||
end |
|||
|
|||
|
|||
context 'with manage php' do |
|||
let(:params) {{ |
|||
:manage_php => true, |
|||
}} |
|||
|
|||
it { should contain_class('limesurvey::php') } |
|||
it { is_expected.to compile.with_all_deps } |
|||
end |
|||
|
|||
|
|||
context 'with manage webserver' do |
|||
let(:params) {{ |
|||
:manage_webserver => true, |
|||
}} |
|||
|
|||
it { should contain_class('limesurvey::webserver') } |
|||
it { is_expected.to compile.with_all_deps } |
|||
end |
|||
|
|||
end |
|||
end |
|||
end |
@ -0,0 +1,9 @@ |
|||
--- |
|||
:backends: |
|||
- yaml |
|||
:hierarchy: |
|||
- "os/%{::osfamily}" |
|||
- common |
|||
- testing |
|||
:yaml: |
|||
:datadir: 'data' |
@ -0,0 +1,18 @@ |
|||
require 'rspec-puppet/spec_helper' |
|||
require 'puppetlabs_spec_helper/module_spec_helper' |
|||
require 'rspec-puppet-facts' |
|||
include RspecPuppetFacts |
|||
|
|||
fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures')) |
|||
|
|||
RSpec.configure do |c| |
|||
c.module_path = File.join(fixture_path, 'modules') |
|||
c.manifest_dir = File.join(fixture_path, 'manifests') |
|||
|
|||
c.hiera_config = 'spec/hiera/hiera.yaml' |
|||
|
|||
# set strict variables setting in puppet if set as env |
|||
if ENV['STRICT_VARIABLES'] == 'yes' |
|||
Puppet.settings[:strict_variables] = true |
|||
end |
|||
end |
@ -0,0 +1,36 @@ |
|||
require 'beaker-rspec' |
|||
require 'yaml' |
|||
|
|||
install_puppet_agent_on hosts, {} |
|||
|
|||
RSpec.configure do |c| |
|||
# Project root |
|||
module_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) |
|||
module_name = module_root.split('/').last.sub('-','_') |
|||
|
|||
# Readable test descriptions |
|||
c.formatter = :documentation |
|||
|
|||
# Configure all nodes in nodeset |
|||
c.before :suite do |
|||
# Install module and dependencies |
|||
puppet_module_install(:source => module_root, :module_name => module_name) |
|||
|
|||
modules_fixtures = YAML.load_file(module_root + '/.fixtures.yml') |
|||
modules = modules_fixtures['fixtures']['repositories'] |
|||
|
|||
hosts.each do |host| |
|||
copy_module_to(host, :source => module_root, :module_name => 'limesurvey') |
|||
|
|||
modules.each do |moduleName, moduleInfo| |
|||
puts 'Fetch ' + moduleName + ' ' + moduleInfo['ref'] + ' from ' + moduleInfo['repo'] |
|||
on host, 'git clone ' + moduleInfo['repo'] + ' /etc/puppetlabs/code/environments/production/modules/' + moduleName |
|||
on host, 'cd /etc/puppetlabs/code/environments/production/modules/' + moduleName + ' && git checkout ' + moduleInfo['ref'] |
|||
end |
|||
end |
|||
|
|||
end |
|||
|
|||
end |
|||
|
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue