Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7cdd934
Added branch and examples for batch 4
shaikkhajaibrahim Jan 21, 2017
e0386c8
Added selector example
shaikkhajaibrahim Jan 21, 2017
c6ad08b
Added tomcat install
shaikkhajaibrahim Jan 21, 2017
7b68c70
Added new files for rr
shaikkhajaibrahim Jan 23, 2017
ab4a734
Added wget
shaikkhajaibrahim Jan 23, 2017
9ceff3e
Added defined resources
shaikkhajaibrahim Jan 25, 2017
2ad9efe
added module
shaikkhajaibrahim Jan 25, 2017
4e97391
Added Vagrant Machines for puppet VMS
shaikkhajaibrahim Jan 25, 2017
78548a1
Added motd
shaikkhajaibrahim Jan 26, 2017
c38c3d0
Added subclass_ex
shaikkhajaibrahim Jan 26, 2017
0616d81
Added Parameters demo module
shaikkhajaibrahim Jan 27, 2017
51523de
Added params_demo and parametrized tomcat
shaikkhajaibrahim Jan 27, 2017
3f4473e
Inheritance
shaikkhajaibrahim Jan 27, 2017
591fc9f
Added ntp
shaikkhajaibrahim Jan 27, 2017
8162be8
Added inline template example
shaikkhajaibrahim Jan 27, 2017
6d201a0
Added cyclos implementation
shaikkhajaibrahim Jan 27, 2017
39cb2e9
Added fix for file
shaikkhajaibrahim Jan 27, 2017
317c90b
added support for mysql_server
shaikkhajaibrahim Jan 27, 2017
e5db476
fix for failures
shaikkhajaibrahim Jan 27, 2017
9b18e34
Corrected java for ubuntu
shaikkhajaibrahim Jan 27, 2017
4579f02
Added tomcat installation
shaikkhajaibrahim Jan 27, 2017
ad9e229
Added templates
shaikkhajaibrahim Jan 28, 2017
6e017c7
Added Resource
shaikkhajaibrahim Jan 28, 2017
677127f
Added template sample
shaikkhajaibrahim Jan 28, 2017
7f1783a
Added changes for motd
shaikkhajaibrahim Jan 28, 2017
5222e01
Added apache for hiera testing
shaikkhajaibrahim Jan 29, 2017
3ae5b05
Added hiera lookup
shaikkhajaibrahim Jan 29, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions PuppetResources/ClassRoomExamples/apache_ex/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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'

# 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
83 changes: 83 additions & 0 deletions PuppetResources/ClassRoomExamples/apache_ex/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# apache_ex

#### Table of Contents

1. [Description](#description)
1. [Setup - The basics of getting started with apache_ex](#setup)
* [What apache_ex affects](#what-apache_ex-affects)
* [Setup requirements](#setup-requirements)
* [Beginning with apache_ex](#beginning-with-apache_ex)
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

Start with a one- or two-sentence summary of what the module does and/or what
problem it solves. This is your 30-second elevator pitch for your module.
Consider including OS/Puppet version it works with.

You can give more descriptive information in a second paragraph. This paragraph
should answer the questions: "What does this module *do*?" and "Why would I use
it?" If your module has a range of functionality (installation, configuration,
management, etc.), this is the time to mention it.

## Setup

### What apache_ex affects **OPTIONAL**

If it's obvious what your module touches, you can skip this section. For
example, folks can probably figure out that your mysql_instance module affects
their MySQL instances.

If there's more that they should know about, though, this is the place to mention:

* A list of files, packages, services, or operations that the module will alter,
impact, or execute.
* Dependencies that your module automatically installs.
* Warnings or other important notices.

### Setup Requirements **OPTIONAL**

If your module requires anything extra before setting up (pluginsync enabled,
etc.), mention it here.

If your most recent release breaks compatibility or requires particular steps
for upgrading, you might want to include an additional "Upgrading" section
here.

### Beginning with apache_ex

The very basic steps needed for a user to get the module up and running. This
can include setup steps, if necessary, or it can be an example of the most
basic use of the module.

## Usage

This section is where you describe how to customize, configure, and do the
fancy stuff with your module here. It's especially helpful if you include usage
examples and code samples for doing things with your module.

## Reference

Here, include a complete list of your module's classes, types, providers,
facts, along with the parameters for each. Users refer to this section (thus
the name "Reference") to find specific details; most users don't read it per
se.

## Limitations

This is where you list OS compatibility, version compatibility, etc. If there
are Known Issues, you might want to include them under their own heading here.

## Development

Since your module is awesome, other users will want to play with it. Let them
know what the ground rules for contributing are.

## Release Notes/Contributors/Etc. **Optional**

If you aren't using changelog, put your release notes here (though you should
consider using changelog). You can also add any additional sections you feel
are necessary or important to include here. Please use the `## ` header.
32 changes: 32 additions & 0 deletions PuppetResources/ClassRoomExamples/apache_ex/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'metadata-json-lint/rake_task'

if RUBY_VERSION >= '1.9'
require 'rubocop/rake_task'
RuboCop::RakeTask.new
end

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 :test do
[:metadata_lint, :lint, :validate, :spec].each do |test|
Rake::Task[test].invoke
end
end
12 changes: 12 additions & 0 deletions PuppetResources/ClassRoomExamples/apache_ex/examples/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# The baseline for module testing used by Puppet Labs is that each manifest
# should have a corresponding test manifest that declares that class or defined
# type.
#
# Tests are then run by using puppet apply --noop (to check for compilation
# errors and view a log of events) or by fully applying the test in a virtual
# environment (to compare the resulting system state to the desired state).
#
# Learn more about module testing here:
# https://docs.puppet.com/guides/tests_smoke.html
#
include ::apache_ex
53 changes: 53 additions & 0 deletions PuppetResources/ClassRoomExamples/apache_ex/manifests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Class: apache_ex
# ===========================
#
# Full description of class apache_ex here.
#
# Parameters
# ----------
#
# Document parameters here.
#
# * `sample parameter`
# Explanation of what this parameter affects and what it defaults to.
# e.g. "Specify one or more upstream ntp servers as an array."
#
# Variables
# ----------
#
# Here you should define a list of variables that this module would require.
#
# * `sample variable`
# Explanation of how this variable affects the function of this class and if
# it has a default. e.g. "The parameter enc_ntp_servers must be set by the
# External Node Classifier as a comma separated list of hostnames." (Note,
# global variables should be avoided in favor of class parameters as
# of Puppet 2.6.)
#
# Examples
# --------
#
# @example
# class { 'apache_ex':
# servers => [ 'pool.ntp.org', 'ntp.local.company.com' ],
# }
#
# Authors
# -------
#
# Author Name <author@domain.com>
#
# Copyright
# ---------
#
# Copyright 2017 Your name here, unless otherwise noted.
#
class apache_ex {

# install configured package
include apache_ex::install

#enable and start the service
include apache_ex::service

}
10 changes: 10 additions & 0 deletions PuppetResources/ClassRoomExamples/apache_ex/manifests/install.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class apache_ex::install ($package_name = 'httpd') {
package { $package_name:
ensure => installed,
}

$apache_install_message=hiera('apache_ex::install_message')

notify { $apache_install_message: }

}
14 changes: 14 additions & 0 deletions PuppetResources/ClassRoomExamples/apache_ex/manifests/service.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class apache_ex::service($service_name='httpd'){

service { $service_name:
ensure => running,
enable => true,
hasrestart => true,
hasstatus => true,
# pattern => $service_name,
}

$service_message = hiera('apache_ex::service_message')
notify { $service_message: }

}
15 changes: 15 additions & 0 deletions PuppetResources/ClassRoomExamples/apache_ex/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "asquarezone/apache_ex",
"version": "0.1.0",
"author": "asquarezone",
"summary": "apache class room example",
"license": "Apache-2.0",
"source": "https://github.com/asquarezone/PuppetZone.git",
"project_page": "https://github.com/asquarezone/PuppetZone",
"issues_url": "https://github.com/asquarezone/PuppetZone/issues",
"dependencies": [
{"name":"puppetlabs-stdlib","version_requirement":">= 1.0.0"}
],
"data_provider": null
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require 'spec_helper'
describe 'apache_ex' do
context 'with default values for all parameters' do
it { should contain_class('apache_ex') }
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'puppetlabs_spec_helper/module_spec_helper'
18 changes: 18 additions & 0 deletions PuppetResources/ClassRoomExamples/appserver_tomcat/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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'

# 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
83 changes: 83 additions & 0 deletions PuppetResources/ClassRoomExamples/appserver_tomcat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# appserver_tomcat

#### Table of Contents

1. [Description](#description)
1. [Setup - The basics of getting started with appserver_tomcat](#setup)
* [What appserver_tomcat affects](#what-appserver_tomcat-affects)
* [Setup requirements](#setup-requirements)
* [Beginning with appserver_tomcat](#beginning-with-appserver_tomcat)
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

Start with a one- or two-sentence summary of what the module does and/or what
problem it solves. This is your 30-second elevator pitch for your module.
Consider including OS/Puppet version it works with.

You can give more descriptive information in a second paragraph. This paragraph
should answer the questions: "What does this module *do*?" and "Why would I use
it?" If your module has a range of functionality (installation, configuration,
management, etc.), this is the time to mention it.

## Setup

### What appserver_tomcat affects **OPTIONAL**

If it's obvious what your module touches, you can skip this section. For
example, folks can probably figure out that your mysql_instance module affects
their MySQL instances.

If there's more that they should know about, though, this is the place to mention:

* A list of files, packages, services, or operations that the module will alter,
impact, or execute.
* Dependencies that your module automatically installs.
* Warnings or other important notices.

### Setup Requirements **OPTIONAL**

If your module requires anything extra before setting up (pluginsync enabled,
etc.), mention it here.

If your most recent release breaks compatibility or requires particular steps
for upgrading, you might want to include an additional "Upgrading" section
here.

### Beginning with appserver_tomcat

The very basic steps needed for a user to get the module up and running. This
can include setup steps, if necessary, or it can be an example of the most
basic use of the module.

## Usage

This section is where you describe how to customize, configure, and do the
fancy stuff with your module here. It's especially helpful if you include usage
examples and code samples for doing things with your module.

## Reference

Here, include a complete list of your module's classes, types, providers,
facts, along with the parameters for each. Users refer to this section (thus
the name "Reference") to find specific details; most users don't read it per
se.

## Limitations

This is where you list OS compatibility, version compatibility, etc. If there
are Known Issues, you might want to include them under their own heading here.

## Development

Since your module is awesome, other users will want to play with it. Let them
know what the ground rules for contributing are.

## Release Notes/Contributors/Etc. **Optional**

If you aren't using changelog, put your release notes here (though you should
consider using changelog). You can also add any additional sections you feel
are necessary or important to include here. Please use the `## ` header.
32 changes: 32 additions & 0 deletions PuppetResources/ClassRoomExamples/appserver_tomcat/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'metadata-json-lint/rake_task'

if RUBY_VERSION >= '1.9'
require 'rubocop/rake_task'
RuboCop::RakeTask.new
end

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 :test do
[:metadata_lint, :lint, :validate, :spec].each do |test|
Rake::Task[test].invoke
end
end
Loading