Skip to content

Commit c2e1936

Browse files
author
olevole
committed
Initial
1 parent b7b66ed commit c2e1936

File tree

28 files changed

+710
-0
lines changed

28 files changed

+710
-0
lines changed

clonos_network/Gemfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
2+
3+
puppetversion = ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'] : ['>= 3.3']
4+
gem 'metadata-json-lint'
5+
gem 'puppet', puppetversion
6+
gem 'puppetlabs_spec_helper', '>= 1.0.0'
7+
gem 'puppet-lint', '>= 1.0.0'
8+
gem 'facter', '>= 1.7.0'
9+
gem 'rspec-puppet'
10+
11+
# rspec must be v2 for ruby 1.8.7
12+
if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9'
13+
gem 'rspec', '~> 2.0'
14+
gem 'rake', '~> 10.0'
15+
else
16+
# rubocop requires ruby >= 1.9
17+
gem 'rubocop'
18+
end

clonos_network/README.md

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# clonos_network
2+
3+
#### Table of Contents
4+
5+
1. [Description](#description)
6+
1. [Setup - The basics of getting started with clonos_network](#setup)
7+
* [What clonos_network affects](#what-clonos_network-affects)
8+
* [Setup requirements](#setup-requirements)
9+
* [Beginning with clonos_network](#beginning-with-clonos_network)
10+
1. [Usage - Configuration options and additional functionality](#usage)
11+
1. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
12+
1. [Limitations - OS compatibility, etc.](#limitations)
13+
1. [Development - Guide for contributing to the module](#development)
14+
15+
## Description
16+
17+
Start with a one- or two-sentence summary of what the module does and/or what
18+
problem it solves. This is your 30-second elevator pitch for your module.
19+
Consider including OS/Puppet version it works with.
20+
21+
You can give more descriptive information in a second paragraph. This paragraph
22+
should answer the questions: "What does this module *do*?" and "Why would I use
23+
it?" If your module has a range of functionality (installation, configuration,
24+
management, etc.), this is the time to mention it.
25+
26+
## Setup
27+
28+
### What clonos_network affects **OPTIONAL**
29+
30+
If it's obvious what your module touches, you can skip this section. For
31+
example, folks can probably figure out that your mysql_instance module affects
32+
their MySQL instances.
33+
34+
If there's more that they should know about, though, this is the place to mention:
35+
36+
* A list of files, packages, services, or operations that the module will alter,
37+
impact, or execute.
38+
* Dependencies that your module automatically installs.
39+
* Warnings or other important notices.
40+
41+
### Setup Requirements **OPTIONAL**
42+
43+
If your module requires anything extra before setting up (pluginsync enabled,
44+
etc.), mention it here.
45+
46+
If your most recent release breaks compatibility or requires particular steps
47+
for upgrading, you might want to include an additional "Upgrading" section
48+
here.
49+
50+
### Beginning with clonos_network
51+
52+
The very basic steps needed for a user to get the module up and running. This
53+
can include setup steps, if necessary, or it can be an example of the most
54+
basic use of the module.
55+
56+
## Usage
57+
58+
This section is where you describe how to customize, configure, and do the
59+
fancy stuff with your module here. It's especially helpful if you include usage
60+
examples and code samples for doing things with your module.
61+
62+
## Reference
63+
64+
Here, include a complete list of your module's classes, types, providers,
65+
facts, along with the parameters for each. Users refer to this section (thus
66+
the name "Reference") to find specific details; most users don't read it per
67+
se.
68+
69+
## Limitations
70+
71+
This is where you list OS compatibility, version compatibility, etc. If there
72+
are Known Issues, you might want to include them under their own heading here.
73+
74+
## Development
75+
76+
Since your module is awesome, other users will want to play with it. Let them
77+
know what the ground rules for contributing are.
78+
79+
## Release Notes/Contributors/Etc. **Optional**
80+
81+
If you aren't using changelog, put your release notes here (though you should
82+
consider using changelog). You can also add any additional sections you feel
83+
are necessary or important to include here. Please use the `## ` header.

clonos_network/Rakefile

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
require 'puppetlabs_spec_helper/rake_tasks'
2+
require 'puppet-lint/tasks/puppet-lint'
3+
require 'metadata-json-lint/rake_task'
4+
5+
if RUBY_VERSION >= '1.9'
6+
require 'rubocop/rake_task'
7+
RuboCop::RakeTask.new
8+
end
9+
10+
PuppetLint.configuration.send('disable_80chars')
11+
PuppetLint.configuration.relative = true
12+
PuppetLint.configuration.ignore_paths = ['spec/**/*.pp', 'pkg/**/*.pp']
13+
14+
desc 'Validate manifests, templates, and ruby files'
15+
task :validate do
16+
Dir['manifests/**/*.pp'].each do |manifest|
17+
sh "puppet parser validate --noop #{manifest}"
18+
end
19+
Dir['spec/**/*.rb', 'lib/**/*.rb'].each do |ruby_file|
20+
sh "ruby -c #{ruby_file}" unless ruby_file =~ %r{spec/fixtures}
21+
end
22+
Dir['templates/**/*.erb'].each do |template|
23+
sh "erb -P -x -T '-' #{template} | ruby -c"
24+
end
25+
end
26+
27+
desc 'Run metadata_lint, lint, validate, and spec tests.'
28+
task :test do
29+
[:metadata_lint, :lint, :validate, :spec].each do |test|
30+
Rake::Task[test].invoke
31+
end
32+
end

clonos_network/examples/init.pp

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# The baseline for module testing used by Puppet Labs is that each manifest
2+
# should have a corresponding test manifest that declares that class or defined
3+
# type.
4+
#
5+
# Tests are then run by using puppet apply --noop (to check for compilation
6+
# errors and view a log of events) or by fully applying the test in a virtual
7+
# environment (to compare the resulting system state to the desired state).
8+
#
9+
# Learn more about module testing here:
10+
# https://docs.puppet.com/guides/tests_smoke.html
11+
#
12+
include ::clonos_network

clonos_network/manifests/init.pp

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Class: clonos_network
2+
# ===========================
3+
#
4+
# Full description of class clonos_network here.
5+
#
6+
# Parameters
7+
# ----------
8+
#
9+
# Document parameters here.
10+
#
11+
# * `sample parameter`
12+
# Explanation of what this parameter affects and what it defaults to.
13+
# e.g. "Specify one or more upstream ntp servers as an array."
14+
#
15+
# Variables
16+
# ----------
17+
#
18+
# Here you should define a list of variables that this module would require.
19+
#
20+
# * `sample variable`
21+
# Explanation of how this variable affects the function of this class and if
22+
# it has a default. e.g. "The parameter enc_ntp_servers must be set by the
23+
# External Node Classifier as a comma separated list of hostnames." (Note,
24+
# global variables should be avoided in favor of class parameters as
25+
# of Puppet 2.6.)
26+
#
27+
# Examples
28+
# --------
29+
#
30+
# @example
31+
# class { 'clonos_network':
32+
# servers => [ 'pool.ntp.org', 'ntp.local.company.com' ],
33+
# }
34+
#
35+
# Authors
36+
# -------
37+
#
38+
# Author Name <[email protected]>
39+
#
40+
# Copyright
41+
# ---------
42+
#
43+
# Copyright 2016 Your name here, unless otherwise noted.
44+
#
45+
class clonos_network (
46+
$uplink_interface = $clonos_network::params::uplink_interface,
47+
$ip4_addr = $clonos_network::params::ip4_addr,
48+
$ip4_gateway = $clonos_network::params::ip4_gateway,
49+
$ip4_mask = $clonos_network::params::ip4_mask,
50+
$hostname = $clonos_network::params::hostname,
51+
) inherits clonos_network::params {
52+
53+
Shellvar { target => '/etc/rc.conf' }
54+
55+
# interface
56+
if $uplink_interface {
57+
if $ip4_addr and $ip4_mask == undef {
58+
shellvar { "ifconfig_$uplink_interface":
59+
value => "$ip4_addr",
60+
}
61+
}
62+
63+
if $ip4_addr and $ip4_mask != undef {
64+
shellvar { "ifconfig_$uplink_interface":
65+
value => "$ip4_addr netmask $ip4_mask",
66+
}
67+
}
68+
}
69+
70+
if $hostname {
71+
shellvar { "hostname":
72+
value => "$hostname",
73+
}
74+
}
75+
76+
if $ip4_gateway {
77+
shellvar { "defaultrouter":
78+
value => "$ip4_gateway",
79+
}
80+
}
81+
82+
}

clonos_network/manifests/params.pp

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class clonos_network::params {
2+
$uplink_interface = undef
3+
$ip4_addr = undef
4+
$ip4_gateway = undef
5+
$ip4_mask = undef
6+
$hostname = undef
7+
}

clonos_network/metadata.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "clonos-clonos_network",
3+
"version": "0.1.0",
4+
"author": "clonos",
5+
"summary": null,
6+
"license": "Apache-2.0",
7+
"source": "",
8+
"project_page": null,
9+
"issues_url": null,
10+
"dependencies": [
11+
{"name":"puppetlabs-stdlib","version_requirement":">= 1.0.0"}
12+
],
13+
"data_provider": null
14+
}
15+
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
require 'spec_helper'
2+
describe 'clonos_network' do
3+
context 'with default values for all parameters' do
4+
it { should contain_class('clonos_network') }
5+
end
6+
end

clonos_network/spec/spec_helper.rb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require 'puppetlabs_spec_helper/module_spec_helper'

clonos_userspw/Gemfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
2+
3+
puppetversion = ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'] : ['>= 3.3']
4+
gem 'metadata-json-lint'
5+
gem 'puppet', puppetversion
6+
gem 'puppetlabs_spec_helper', '>= 1.0.0'
7+
gem 'puppet-lint', '>= 1.0.0'
8+
gem 'facter', '>= 1.7.0'
9+
gem 'rspec-puppet'
10+
11+
# rspec must be v2 for ruby 1.8.7
12+
if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9'
13+
gem 'rspec', '~> 2.0'
14+
gem 'rake', '~> 10.0'
15+
else
16+
# rubocop requires ruby >= 1.9
17+
gem 'rubocop'
18+
end

clonos_userspw/README.md

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# clonos_network
2+
3+
#### Table of Contents
4+
5+
1. [Description](#description)
6+
1. [Setup - The basics of getting started with clonos_network](#setup)
7+
* [What clonos_network affects](#what-clonos_network-affects)
8+
* [Setup requirements](#setup-requirements)
9+
* [Beginning with clonos_network](#beginning-with-clonos_network)
10+
1. [Usage - Configuration options and additional functionality](#usage)
11+
1. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
12+
1. [Limitations - OS compatibility, etc.](#limitations)
13+
1. [Development - Guide for contributing to the module](#development)
14+
15+
## Description
16+
17+
Start with a one- or two-sentence summary of what the module does and/or what
18+
problem it solves. This is your 30-second elevator pitch for your module.
19+
Consider including OS/Puppet version it works with.
20+
21+
You can give more descriptive information in a second paragraph. This paragraph
22+
should answer the questions: "What does this module *do*?" and "Why would I use
23+
it?" If your module has a range of functionality (installation, configuration,
24+
management, etc.), this is the time to mention it.
25+
26+
## Setup
27+
28+
### What clonos_network affects **OPTIONAL**
29+
30+
If it's obvious what your module touches, you can skip this section. For
31+
example, folks can probably figure out that your mysql_instance module affects
32+
their MySQL instances.
33+
34+
If there's more that they should know about, though, this is the place to mention:
35+
36+
* A list of files, packages, services, or operations that the module will alter,
37+
impact, or execute.
38+
* Dependencies that your module automatically installs.
39+
* Warnings or other important notices.
40+
41+
### Setup Requirements **OPTIONAL**
42+
43+
If your module requires anything extra before setting up (pluginsync enabled,
44+
etc.), mention it here.
45+
46+
If your most recent release breaks compatibility or requires particular steps
47+
for upgrading, you might want to include an additional "Upgrading" section
48+
here.
49+
50+
### Beginning with clonos_network
51+
52+
The very basic steps needed for a user to get the module up and running. This
53+
can include setup steps, if necessary, or it can be an example of the most
54+
basic use of the module.
55+
56+
## Usage
57+
58+
This section is where you describe how to customize, configure, and do the
59+
fancy stuff with your module here. It's especially helpful if you include usage
60+
examples and code samples for doing things with your module.
61+
62+
## Reference
63+
64+
Here, include a complete list of your module's classes, types, providers,
65+
facts, along with the parameters for each. Users refer to this section (thus
66+
the name "Reference") to find specific details; most users don't read it per
67+
se.
68+
69+
## Limitations
70+
71+
This is where you list OS compatibility, version compatibility, etc. If there
72+
are Known Issues, you might want to include them under their own heading here.
73+
74+
## Development
75+
76+
Since your module is awesome, other users will want to play with it. Let them
77+
know what the ground rules for contributing are.
78+
79+
## Release Notes/Contributors/Etc. **Optional**
80+
81+
If you aren't using changelog, put your release notes here (though you should
82+
consider using changelog). You can also add any additional sections you feel
83+
are necessary or important to include here. Please use the `## ` header.

0 commit comments

Comments
 (0)