added Puppet documentation, Jenkinsfile and Gemfile for CI
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# .gitignore for cd_apache
|
||||
.yardoc
|
||||
Gemfile.lock
|
||||
22
Gemfile
Normal file
22
Gemfile
Normal file
@@ -0,0 +1,22 @@
|
||||
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
||||
|
||||
puppetversion = ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'] : ['>= 3.3']
|
||||
gem 'metadata-json-lint'
|
||||
gem 'puppet', puppetversion
|
||||
gem 'puppetlabs_spec_helper', '>= 1.0.0'
|
||||
gem 'puppet-lint', '>= 1.0.0'
|
||||
gem 'facter', '>= 1.7.0'
|
||||
gem 'rspec-puppet'
|
||||
gem 'puppet-strings'
|
||||
gem 'rake'
|
||||
gem 'semantic_puppet'
|
||||
gem 'rgen'
|
||||
|
||||
# rspec must be v2 for ruby 1.8.7
|
||||
if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9'
|
||||
gem 'rspec', '~> 2.0'
|
||||
gem 'rake', '~> 10.0'
|
||||
else
|
||||
# rubocop requires ruby >= 1.9
|
||||
gem 'rubocop'
|
||||
end
|
||||
227
Jenkinsfile
vendored
Normal file
227
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
pipeline {
|
||||
agent {
|
||||
label 'puppet'
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
stage('pulling master before adding files') {
|
||||
steps {
|
||||
sshagent(['0c22dc63-2ae0-4ad5-98e0-65aa0f0f411g']) {
|
||||
sh '''git config user.name "Jenkins Server"
|
||||
git config user.email jenkins@confdroid.com
|
||||
git pull origin master
|
||||
git checkout -b jenkins '''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('install required gems') {
|
||||
steps {
|
||||
sh 'bundle install'
|
||||
}
|
||||
}
|
||||
|
||||
stage('puppet-lint tests') {
|
||||
steps {
|
||||
sh '''find . -iname *.pp -exec puppet-lint \\
|
||||
--no-class_inherits_from_params_class-check \\
|
||||
--no-variable_scope-check \\
|
||||
--no-80chars-check \\
|
||||
--no-arrow_alignment-check \\
|
||||
--no-autoloader_layout-check \\
|
||||
--log-format "%{path}:%{line}:%{check}:%{KIND}:%{message}" {} \\;'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('puppet parser test') {
|
||||
steps {
|
||||
sh '''for file in $(find . -iname \'*.pp\'); do
|
||||
puppet parser validate --color false --render-as s --modulepath=modules $file || exit 1;
|
||||
done;'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('Puppet ERB template test') {
|
||||
steps{
|
||||
sh '''for file in $(find . -iname \'*.erb\');
|
||||
do erb -P -x -T "-" $file | ruby -c || exit 1;
|
||||
done;'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('compiler warnings') {
|
||||
steps {
|
||||
warnings canComputeNew: false, canResolveRelativePaths: false, consoleParsers: [[parserName: 'Puppet-Lint']], defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', messagesPattern: '', unHealthy: ''
|
||||
}
|
||||
}
|
||||
|
||||
stage('update repo structure') {
|
||||
steps {
|
||||
sh '''rm -Rf REPOSTRUCTURE.md
|
||||
echo "$(tree --dirsfirst --charset=ascii .)" > REPOSTRUCTURE.md'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('create Puppet documention') {
|
||||
steps {
|
||||
sh 'puppet strings'
|
||||
}
|
||||
}
|
||||
|
||||
stage('create changelog') {
|
||||
steps{
|
||||
step([$class: 'GitChangelogRecorder', config: [configFile: 'git-changelog-settings.json', createFileTemplateContent: '''<h1> Git Changelog changelog </h1>
|
||||
|
||||
<p>
|
||||
Changelog of Git Changelog.
|
||||
</p>
|
||||
|
||||
{{#tags}}
|
||||
<h2> {{name}} </h2>
|
||||
{{#issues}}
|
||||
{{#hasIssue}}
|
||||
{{#hasLink}}
|
||||
<h2> {{name}} <a href="{{link}}">{{issue}}</a> {{title}} </h2>
|
||||
{{/hasLink}}
|
||||
{{^hasLink}}
|
||||
<h2> {{name}} {{issue}} {{title}} </h2>
|
||||
{{/hasLink}}
|
||||
{{/hasIssue}}
|
||||
{{^hasIssue}}
|
||||
<h2> {{name}} </h2>
|
||||
{{/hasIssue}}
|
||||
|
||||
|
||||
{{#commits}}
|
||||
<a href="https://gitlab.puppetsoft.com/12WW1160/git-changelog-lib/commit/{{hash}}">{{hash}}</a> {{authorName}} <i>{{commitTime}}</i>
|
||||
<p>
|
||||
<h3>{{{messageTitle}}}</h3>
|
||||
|
||||
{{#messageBodyItems}}
|
||||
<li> {{.}}</li>
|
||||
{{/messageBodyItems}}
|
||||
</p>
|
||||
{{/commits}}
|
||||
|
||||
{{/issues}}
|
||||
{{/tags}}
|
||||
''', createFileTemplateFile: '', createFileUseTemplateContent: true, createFileUseTemplateFile: false, customIssues: [[link: '', name: '', pattern: '', title: ''], [link: '', name: '', pattern: '', title: '']], dateFormat: 'YYYY-MM-dd HH:mm:ss', file: 'CHANGELOG.md', fromReference: '', fromType: 'firstCommit', gitHubApi: '', gitHubApiTokenCredentialsId: '', gitHubIssuePattern: '#([0-9]+)', gitHubToken: '', gitLabApiTokenCredentialsId: '', gitLabProjectName: '', gitLabServer: '', gitLabToken: '', ignoreCommitsIfMessageMatches: '^\\[maven-release-plugin\\].*|^\\[Gradle Release Plugin\\].*|^Merge.*', ignoreCommitsWithoutIssue: false, ignoreTagsIfNameMatches: '', jiraIssuePattern: '\\b[a-zA-Z]([a-zA-Z]+)-([0-9]+)\\b', jiraPassword: '', jiraServer: '', jiraUsername: '', jiraUsernamePasswordCredentialsId: '', mediaWikiPassword: '', mediaWikiTemplateContent: '''__NOTOC__
|
||||
|
||||
= Git Changelog changelog =
|
||||
Changelog of Git Changelog.
|
||||
|
||||
{{#tags}}
|
||||
== {{name}} ==
|
||||
{{#issues}}
|
||||
{{#hasIssue}}
|
||||
{{#hasLink}}
|
||||
=== {{name}} [{{link}} {{issue}}] {{title}} ===
|
||||
{{/hasLink}}
|
||||
{{^hasLink}}
|
||||
=== {{name}} {{issue}} {{title}} ===
|
||||
{{/hasLink}}
|
||||
{{/hasIssue}}
|
||||
{{^hasIssue}}
|
||||
=== {{name}} ===
|
||||
{{/hasIssue}}
|
||||
|
||||
{{#commits}}
|
||||
[https://gitlab.puppetsoft.com/12WW1160/git-changelog-lib/commit/{{hash}} {{hash}}] {{authorName}} {{commitTime}}
|
||||
|
||||
\'\'\'{{{messageTitle}}}\'\'\'
|
||||
|
||||
{{#messageBodyItems}}
|
||||
* {{.}}
|
||||
{{/messageBodyItems}}
|
||||
|
||||
{{/commits}}
|
||||
|
||||
{{/issues}}
|
||||
{{/tags}}
|
||||
''', mediaWikiTemplateFile: '', mediaWikiTitle: '', mediaWikiUrl: '', mediaWikiUseTemplateContent: false, mediaWikiUseTemplateFile: false, mediaWikiUsername: '', noIssueName: 'No issue', readableTagName: '/([^/]+?)$', showSummary: false, showSummaryTemplateContent: '''<h1> Git Changelog changelog </h1>
|
||||
|
||||
<p>
|
||||
Changelog of Git Changelog.
|
||||
</p>
|
||||
|
||||
{{#tags}}
|
||||
<h2> {{name}} </h2>
|
||||
{{#issues}}
|
||||
{{#hasIssue}}
|
||||
{{#hasLink}}
|
||||
<h2> {{name}} <a href="{{link}}">{{issue}}</a> {{title}} </h2>
|
||||
{{/hasLink}}
|
||||
{{^hasLink}}
|
||||
<h2> {{name}} {{issue}} {{title}} </h2>
|
||||
{{/hasLink}}
|
||||
{{/hasIssue}}
|
||||
{{^hasIssue}}
|
||||
<h2> {{name}} </h2>
|
||||
{{/hasIssue}}
|
||||
|
||||
|
||||
{{#commits}}
|
||||
<a href="https://github.com/12WW1160/git-changelog-lib/commit/{{hash}}">{{hash}}</a> {{authorName}} <i>{{commitTime}}</i>
|
||||
<p>
|
||||
<h3>{{{messageTitle}}}</h3>
|
||||
|
||||
{{#messageBodyItems}}
|
||||
<li> {{.}}</li>
|
||||
{{/messageBodyItems}}
|
||||
</p>
|
||||
|
||||
|
||||
{{/commits}}
|
||||
|
||||
{{/issues}}
|
||||
{{/tags}}
|
||||
''', showSummaryTemplateFile: '', showSummaryUseTemplateContent: false, showSummaryUseTemplateFile: false, subDirectory: '', timeZone: 'UTC', toReference: '', toType: 'master', untaggedName: 'Unreleased', useConfigFile: false, useFile: true, useGitHub: false, useGitHubApiTokenCredentials: false, useGitLab: false, useGitLabApiTokenCredentials: false, useIgnoreTagsIfNameMatches: false, useJira: false, useJiraUsernamePasswordCredentialsId: false, useMediaWiki: false, useReadableTagName: false, useSubDirectory: false]])
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
stage('show diff') {
|
||||
steps {
|
||||
sh 'git diff'
|
||||
}
|
||||
}
|
||||
|
||||
stage('recommit changes to repo') {
|
||||
steps {
|
||||
sshagent(['0c22dc63-2ae0-4ad5-98e0-65aa0f0f411g']) {
|
||||
sh '''git config user.name "Jenkins Server"
|
||||
git config user.email jenkins@confdroid.com
|
||||
echo `git add -A && git commit -am "recommit for updates in build $BUILD_NUMBER"`
|
||||
git push origin HEAD:jenkins'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('update Gitlab') {
|
||||
steps {
|
||||
updateGitlabCommitStatus state: 'success'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
deleteDir() /* clean up our workspace */
|
||||
}
|
||||
success {
|
||||
echo 'Pipeline finished successfully!'
|
||||
}
|
||||
unstable {
|
||||
echo 'I am unstable :/'
|
||||
}
|
||||
failure {
|
||||
echo 'I failed :('
|
||||
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'support@confdroid.com', sendToIndividuals: true])
|
||||
}
|
||||
changed {
|
||||
echo 'Things were different before...'
|
||||
mail bcc: '', body: "Pipeline Job '${JOB_NAME}' has changed, please verify.", cc: '', from: '', replyTo: '', subject: "Pipeline Job '${JOB_NAME}' has changed", to: 'support@confdroid.com'
|
||||
}
|
||||
}
|
||||
}
|
||||
30
README.md
30
README.md
@@ -1,6 +1,6 @@
|
||||
|Repo Name| version | Build Status|
|
||||
|---|---|---|---|
|
||||
|`cd_apache`| 0.0.0.2 | [](https://jenkins.puppetsoft.com/job/cd_apache/)|
|
||||
|`cd_apache`| 0.0.1.0 | [](https://jenkins.puppetsoft.com/job/cd_apache/)|
|
||||
|
||||
### Synopsis
|
||||
`Apache httpd` is a very powerful and widely used web server.
|
||||
@@ -32,39 +32,15 @@
|
||||
### Features
|
||||
* install required binaries and dependencies
|
||||
* manage user settings (optional)
|
||||
* manage directory structure
|
||||
* manage directory structure (optional)
|
||||
* manage configuration files (optional):
|
||||
* file system permissions
|
||||
* selinux context
|
||||
* manage the service
|
||||
|
||||
### Repo Structure
|
||||
Repostructure as been moved to REPOSTRUCTURE.md
|
||||
|
||||
```
|
||||
.
|
||||
|-- lib
|
||||
|-- manifests
|
||||
| |-- main
|
||||
| | `-- config.pp
|
||||
| |-- server
|
||||
| | |-- config.pp
|
||||
| | |-- dirs.pp
|
||||
| | |-- files.pp
|
||||
| | |-- install.pp
|
||||
| | |-- service.pp
|
||||
| | `-- user.pp
|
||||
| |-- init.pp
|
||||
| `-- params.pp
|
||||
|-- templates
|
||||
| |-- autoindex_conf.erb
|
||||
| |-- httpd_conf.erb
|
||||
| |-- magic.erb
|
||||
| |-- ssl_conf.erb
|
||||
| |-- userdir_conf.erb
|
||||
| `-- welcome.conf
|
||||
|-- CHANGELOG.md
|
||||
`-- README.md
|
||||
```
|
||||
|
||||
### Dependencies
|
||||
All dependencies must be included in the catalogue.
|
||||
|
||||
@@ -19,9 +19,8 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# @summary Initialze the cd_apache Puppet module.
|
||||
##############################################################################
|
||||
|
||||
|
||||
class cd_apache {
|
||||
include cd_apache::params
|
||||
}
|
||||
|
||||
@@ -19,9 +19,8 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# @summary configure the module classes to be used.
|
||||
##############################################################################
|
||||
|
||||
|
||||
class cd_apache::main::config (
|
||||
|
||||
) inherits cd_apache::params {
|
||||
|
||||
@@ -19,8 +19,42 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# @summary This class holds all parameters for the cd_apache module, which are
|
||||
# inherited by all classes except defines.
|
||||
# @param [string] pkg_ensure Specify which
|
||||
# [package type] (https://confdroid.com/2017/05/puppet-type-package/)
|
||||
# to use, i.e. `latest`, `present` or `absent`.
|
||||
# @param [boolean] ae_manage_user Whether or not to manage details for the
|
||||
# httpd service user. This is generally only required when using httpd on
|
||||
# a number of servers sharing storage resources, i.e. NFS, where UID and GID
|
||||
# settings must be same accross all nodes.
|
||||
# @param [string] ae_user_name Specify the user name for the httpd user.
|
||||
# only active if `ae_manage_user` is set to true.
|
||||
# @param [string] ae_user_uid Specify the UID for teh httpd service user.
|
||||
# only active if `ae_manage_user` is set to true.
|
||||
# @param [string] ae_u_comment Specify the user comment for /etc/passwd.
|
||||
# Shows up in email notofications as sender informations.
|
||||
# only active if `ae_manage_user` is set to true.
|
||||
# @param [string] ae_u_groups Specify any secondary groups the httpd service
|
||||
# user shoould be in. Must not contain teh primary group.
|
||||
# only active if `ae_manage_user` is set to true.
|
||||
# @param [string] ae_user_home Specify the home of the httpd service user.
|
||||
# only active if `ae_manage_user` is set to true.
|
||||
# @param [string] ae_user_shell Specify the shell for teh httpd service user,
|
||||
# which normally should not be allowed to log in .
|
||||
# only active if `ae_manage_user` is set to true.
|
||||
# @param [boolean] ae_manage_cfg Whether or not to manage the httpd
|
||||
# configuration. httpd is very often a sub system used by many other services,
|
||||
# and the required configuration depends on the use case. If using httpd as
|
||||
# sub-service ( i.e. for phpmyadmin, Nagios etc.), the main configuration
|
||||
# should be done on that end, not in cd_apache. IN that case, set `ae_manage_cfg`
|
||||
# to `false`.
|
||||
# @param [boolean] ae_manage_dirs Whether or not main directories required
|
||||
# to run httpd should be managed. Tyically this should be set to true.
|
||||
# @param [boolean] ae_allow_user_dirs Whether or not to allow user directories
|
||||
# should be allowed to share content through httpd. Usually this is a security
|
||||
# problem and as such should be disabled.
|
||||
##############################################################################
|
||||
|
||||
class cd_apache::params (
|
||||
|
||||
$pkg_ensure = 'latest',
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
## cd_apache::server::config.pp
|
||||
# Module name: cd_apache
|
||||
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
||||
# License:
|
||||
# This file is part of cd_apache.
|
||||
#
|
||||
# cd_apache is used for providing automatic configuration of
|
||||
# Apache Webserver.
|
||||
# Copyright (C) 2014 confdroid (copyright@confdroid.com)
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
##############################################################################
|
||||
|
||||
|
||||
class cd_apache::server::config (
|
||||
|
||||
) inherits cd_apache::params {
|
||||
|
||||
require cd_apache::server::files
|
||||
|
||||
}
|
||||
@@ -19,9 +19,9 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# @summary Manage all aspects of the directory structure required for the
|
||||
# httpd service.
|
||||
##############################################################################
|
||||
|
||||
|
||||
class cd_apache::server::dirs (
|
||||
|
||||
) inherits cd_apache::params {
|
||||
|
||||
@@ -19,9 +19,8 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# @summary Manage all aspects for the httpd configuration, if enabled.
|
||||
##############################################################################
|
||||
|
||||
|
||||
class cd_apache::server::files (
|
||||
|
||||
) inherits cd_apache::params {
|
||||
|
||||
@@ -19,9 +19,8 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# @summary Install required binaries
|
||||
##############################################################################
|
||||
|
||||
|
||||
class cd_apache::server::install (
|
||||
|
||||
) inherits cd_apache::params {
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# @summary manage the httpd service.
|
||||
##############################################################################
|
||||
|
||||
class cd_apache::server::service (
|
||||
|
||||
) inherits cd_apache::params {
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# @summary manage all aspects of the httpd service user, if enabled
|
||||
##############################################################################
|
||||
|
||||
class cd_apache::server::user (
|
||||
|
||||
) inherits cd_apache::params {
|
||||
|
||||
Reference in New Issue
Block a user