├── .gitignore ├── .travis.yml ├── Gemfile ├── LICENSE ├── README.md ├── install.sh ├── skeleton ├── .fixtures.yml.erb ├── .gitignore ├── .pmtignore ├── .rspec ├── .rubocop.yml ├── .travis.yml ├── .yardopts ├── CHANGELOG ├── CONTRIBUTING.md ├── CONTRIBUTORS.erb ├── Gemfile ├── Guardfile ├── LICENSE ├── README.markdown.erb ├── Rakefile ├── files │ └── .gitkeep ├── lib │ └── puppet │ │ ├── provider │ │ └── .gitkeep │ │ └── type │ │ └── .gitkeep ├── manifests │ ├── config.pp.erb │ ├── init.pp.erb │ ├── install.pp.erb │ ├── params.pp.erb │ └── service.pp.erb ├── metadata.json.erb ├── spec │ ├── acceptance │ │ ├── class_spec.rb.erb │ │ └── nodesets │ │ │ ├── centos-511-x64.yml │ │ │ ├── centos-66-x64.yml │ │ │ ├── centos-7-x64.yml │ │ │ ├── debian-609-x64.yml │ │ │ ├── debian-78-x64.yml │ │ │ ├── default.yml │ │ │ ├── fedora-20-x64.yml │ │ │ ├── ubuntu-1204-x64.yml │ │ │ └── ubuntu-1404-x64.yml │ ├── classes │ │ ├── coverage_spec.rb │ │ └── example_spec.rb.erb │ ├── fixtures │ │ ├── hiera.yaml │ │ └── hieradata │ │ │ └── default.yaml │ ├── spec_helper.rb │ └── spec_helper_acceptance.rb.erb ├── templates │ └── .gitkeep └── tests │ └── init.pp.erb └── test.sh /.gitignore: -------------------------------------------------------------------------------- 1 | Gemfile.lock 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: ruby 3 | before_script: 4 | - ./install.sh 5 | - puppet module generate user-module --skip-interview 6 | sudo: false 7 | env: 8 | - PUPPET_GEM_VERSION="~> 3.7.0" 9 | - PUPPET_GEM_VERSION="~> 3.8.0" 10 | - PUPPET_GEM_VERSION="~> 4.1.0" 11 | - PUPPET_GEM_VERSION="~> 4.2.0" 12 | rvm: 13 | - 1.9.3 14 | - 2.0 15 | - 2.1 16 | - 2.2 17 | script: ./test.sh 18 | matrix: 19 | exclude: 20 | - rvm: 2.2 21 | env: PUPPET_GEM_VERSION="~> 3.7.0" 22 | - rvm: 2.2 23 | env: PUPPET_GEM_VERSION="~> 3.8.0" 24 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "puppet", ENV['PUPPET_GEM_VERSION'] || '~> 3.8.0' 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, and 10 | distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by the 13 | copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all other 16 | entities that control, are controlled by, or are under common control with 17 | that entity. For the purposes of this definition, "control" means (i) the 18 | power, direct or indirect, to cause the direction or management of such 19 | entity, whether by contract or otherwise, or (ii) ownership of 20 | fifty percent (50%) or more of the outstanding shares, or (iii) beneficial 21 | ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity exercising 24 | permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation source, 28 | and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical transformation 31 | or translation of a Source form, including but not limited to compiled 32 | object code, generated documentation, and conversions to 33 | other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or Object 36 | form, made available under the License, as indicated by a copyright notice 37 | that is included in or attached to the work (an example is provided in the 38 | Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object form, 41 | that is based on (or derived from) the Work and for which the editorial 42 | revisions, annotations, elaborations, or other modifications represent, 43 | as a whole, an original work of authorship. For the purposes of this 44 | License, Derivative Works shall not include works that remain separable 45 | from, or merely link (or bind by name) to the interfaces of, the Work and 46 | Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including the original 49 | version of the Work and any modifications or additions to that Work or 50 | Derivative Works thereof, that is intentionally submitted to Licensor for 51 | inclusion in the Work by the copyright owner or by an individual or 52 | Legal Entity authorized to submit on behalf of the copyright owner. 53 | For the purposes of this definition, "submitted" means any form of 54 | electronic, verbal, or written communication sent to the Licensor or its 55 | representatives, including but not limited to communication on electronic 56 | mailing lists, source code control systems, and issue tracking systems 57 | that are managed by, or on behalf of, the Licensor for the purpose of 58 | discussing and improving the Work, but excluding communication that is 59 | conspicuously marked or otherwise designated in writing by the copyright 60 | owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity on 63 | behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. 67 | 68 | Subject to the terms and conditions of this License, each Contributor 69 | hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, 70 | royalty-free, irrevocable copyright license to reproduce, prepare 71 | Derivative Works of, publicly display, publicly perform, sublicense, 72 | and distribute the Work and such Derivative Works in 73 | Source or Object form. 74 | 75 | 3. Grant of Patent License. 76 | 77 | Subject to the terms and conditions of this License, each Contributor 78 | hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, 79 | royalty-free, irrevocable (except as stated in this section) patent 80 | license to make, have made, use, offer to sell, sell, import, and 81 | otherwise transfer the Work, where such license applies only to those 82 | patent claims licensable by such Contributor that are necessarily 83 | infringed by their Contribution(s) alone or by combination of their 84 | Contribution(s) with the Work to which such Contribution(s) was submitted. 85 | If You institute patent litigation against any entity (including a 86 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 87 | Contribution incorporated within the Work constitutes direct or 88 | contributory patent infringement, then any patent licenses granted to 89 | You under this License for that Work shall terminate as of the date such 90 | litigation is filed. 91 | 92 | 4. Redistribution. 93 | 94 | You may reproduce and distribute copies of the Work or Derivative Works 95 | thereof in any medium, with or without modifications, and in Source or 96 | Object form, provided that You meet the following conditions: 97 | 98 | 1. You must give any other recipients of the Work or Derivative Works a 99 | copy of this License; and 100 | 101 | 2. You must cause any modified files to carry prominent notices stating 102 | that You changed the files; and 103 | 104 | 3. You must retain, in the Source form of any Derivative Works that You 105 | distribute, all copyright, patent, trademark, and attribution notices from 106 | the Source form of the Work, excluding those notices that do not pertain 107 | to any part of the Derivative Works; and 108 | 109 | 4. If the Work includes a "NOTICE" text file as part of its distribution, 110 | then any Derivative Works that You distribute must include a readable copy 111 | of the attribution notices contained within such NOTICE file, excluding 112 | those notices that do not pertain to any part of the Derivative Works, 113 | in at least one of the following places: within a NOTICE text file 114 | distributed as part of the Derivative Works; within the Source form or 115 | documentation, if provided along with the Derivative Works; or, within a 116 | display generated by the Derivative Works, if and wherever such 117 | third-party notices normally appear. The contents of the NOTICE file are 118 | for informational purposes only and do not modify the License. 119 | You may add Your own attribution notices within Derivative Works that You 120 | distribute, alongside or as an addendum to the NOTICE text from the Work, 121 | provided that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and may 125 | provide additional or different license terms and conditions for use, 126 | reproduction, or distribution of Your modifications, or for any such 127 | Derivative Works as a whole, provided Your use, reproduction, and 128 | distribution of the Work otherwise complies with the conditions 129 | stated in this License. 130 | 131 | 5. Submission of Contributions. 132 | 133 | Unless You explicitly state otherwise, any Contribution intentionally 134 | submitted for inclusion in the Work by You to the Licensor shall be under 135 | the terms and conditions of this License, without any additional 136 | terms or conditions. Notwithstanding the above, nothing herein shall 137 | supersede or modify the terms of any separate license agreement you may 138 | have executed with Licensor regarding such Contributions. 139 | 140 | 6. Trademarks. 141 | 142 | This License does not grant permission to use the trade names, trademarks, 143 | service marks, or product names of the Licensor, except as required for 144 | reasonable and customary use in describing the origin of the Work and 145 | reproducing the content of the NOTICE file. 146 | 147 | 7. Disclaimer of Warranty. 148 | 149 | Unless required by applicable law or agreed to in writing, Licensor 150 | provides the Work (and each Contributor provides its Contributions) 151 | on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 152 | either express or implied, including, without limitation, any warranties 153 | or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS 154 | FOR A PARTICULAR PURPOSE. You are solely responsible for determining the 155 | appropriateness of using or redistributing the Work and assume any risks 156 | associated with Your exercise of permissions under this License. 157 | 158 | 8. Limitation of Liability. 159 | 160 | In no event and under no legal theory, whether in tort 161 | (including negligence), contract, or otherwise, unless required by 162 | applicable law (such as deliberate and grossly negligent acts) or agreed 163 | to in writing, shall any Contributor be liable to You for damages, 164 | including any direct, indirect, special, incidental, or consequential 165 | damages of any character arising as a result of this License or out of 166 | the use or inability to use the Work (including but not limited to damages 167 | for loss of goodwill, work stoppage, computer failure or malfunction, 168 | or any and all other commercial damages or losses), even if such 169 | Contributor has been advised of the possibility of such damages. 170 | 171 | 9. Accepting Warranty or Additional Liability. 172 | 173 | While redistributing the Work or Derivative Works thereof, You may choose 174 | to offer, and charge a fee for, acceptance of support, warranty, 175 | indemnity, or other liability obligations and/or rights consistent with 176 | this License. However, in accepting such obligations, You may act only 177 | on Your own behalf and on Your sole responsibility, not on behalf of any 178 | other Contributor, and only if You agree to indemnify, defend, and hold 179 | each Contributor harmless for any liability incurred by, or claims 180 | asserted against, such Contributor by reason of your accepting any such 181 | warranty or additional liability. 182 | 183 | END OF TERMS AND CONDITIONS 184 | 185 | APPENDIX: How to apply the Apache License to your work 186 | 187 | To apply the Apache License to your work, attach the following boilerplate 188 | notice, with the fields enclosed by brackets "[]" replaced with your own 189 | identifying information. (Don't include the brackets!) The text should be 190 | enclosed in the appropriate comment syntax for the file format. We also 191 | recommend that a file or class name and description of purpose be included 192 | on the same "printed page" as the copyright notice for easier 193 | identification within third-party archives. 194 | 195 | Copyright 2013 Gareth Rushgrove 196 | 197 | Licensed under the Apache License, Version 2.0 (the "License"); 198 | you may not use this file except in compliance with the License. 199 | You may obtain a copy of the License at 200 | 201 | http://www.apache.org/licenses/LICENSE-2.0 202 | 203 | Unless required by applicable law or agreed to in writing, software 204 | distributed under the License is distributed on an "AS IS" BASIS, 205 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 206 | or implied. See the License for the specific language governing 207 | permissions and limitations under the License. 208 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Puppet modules often take on the same file system structure. The 2 | built-in puppet-module tool makes starting modules easy, but the build 3 | in skeleton module is very simple. This skeleton is very opinionated. 4 | It's going to assume you're going to start out with tests (both unit and 5 | system), that you care about the puppet style guide, test using Travis, 6 | keep track of releases and structure your modules according to strong 7 | conventions. 8 | 9 | [![Build 10 | Status](https://travis-ci.org/garethr/puppet-module-skeleton.svg?branch=master)](https://travis-ci.org/garethr/puppet-module-skeleton) 11 | 12 | ## Installation 13 | 14 | As a feature, puppet module tool will use `~/.puppet/var/puppet-module/skeleton` 15 | (or `~/.puppetlabs/opt/puppet/cache/puppet-module/` for Puppet 4) as template for 16 | its `generate` command. The files provided here are meant to be better templates 17 | for use with the puppet module tool. 18 | 19 | ## Manual install 20 | 21 | As we don't want to have our .git files and this README in our skeleton, we export it like this : 22 | 23 | ### for puppet 3.x: 24 | 25 | git clone https://github.com/garethr/puppet-module-skeleton 26 | cd puppet-module-skeleton 27 | find skeleton -type f | git checkout-index --stdin --force --prefix="$HOME/.puppet/var/puppet-module/" -- 28 | 29 | ### for puppet 4.x 30 | 31 | git clone https://github.com/garethr/puppet-module-skeleton 32 | cd puppet-module-skeleton 33 | find skeleton -type f | git checkout-index --stdin --force --prefix="$HOME/.puppetlabs/opt/puppet/cache/puppet-module/" -- 34 | 35 | ## the install.sh 36 | 37 | I provided a script installing the skeleton in the right place depending on the detected puppet version 38 | 39 | ## Usage 40 | 41 | Then just generate your new module structure like so: 42 | 43 | puppet module generate user-module 44 | 45 | Once you have your module then install the development dependencies: 46 | 47 | cd user-module 48 | bundle install 49 | 50 | Now you should have a bunch of rake commands to help with your module 51 | development: 52 | 53 | bundle exec rake -T 54 | rake acceptance # Run acceptance tests 55 | rake build # Build puppet module package 56 | rake clean # Clean a built module package 57 | rake contributors # Populate CONTRIBUTORS file 58 | rake coverage # Generate code coverage information 59 | rake help # Display the list of available rake tasks 60 | rake lint # Check puppet manifests with puppet-lint / Run puppet-lint 61 | rake spec # Run spec tests in a clean fixtures directory 62 | rake spec_clean # Clean up the fixtures directory 63 | rake spec_prep # Create the fixtures directory 64 | rake spec_standalone # Run spec tests on an existing fixtures directory 65 | rake syntax # Syntax check Puppet manifests and templates 66 | rake syntax:manifests # Syntax check Puppet manifests 67 | rake syntax:templates # Syntax check Puppet templates 68 | 69 | Of particular interst should be: 70 | 71 | * `rake spec` - run unit tests 72 | * `rake lint` - checks against the puppet style guide 73 | * `rake syntax` - to check your have valid puppet and erb syntax 74 | * `rake metadata_lint` - to check your have a valid metadata.json file 75 | 76 | ## Thanks 77 | 78 | The trick used in the installation above, and a few other bits came from 79 | another excellent module skeleton from [spiette](https://github.com/spiette/puppet-module-skeleton). 80 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | install_dir=$(puppet apply --configprint module_working_dir)/ 4 | 5 | find skeleton -type f -not -name .gitkeep | git checkout-index --stdin --force --prefix=$install_dir 6 | -------------------------------------------------------------------------------- /skeleton/.fixtures.yml.erb: -------------------------------------------------------------------------------- 1 | fixtures: 2 | repositories: 3 | stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git" 4 | symlinks: 5 | <%= metadata.name %>: "#{source_dir}" 6 | -------------------------------------------------------------------------------- /skeleton/.gitignore: -------------------------------------------------------------------------------- 1 | .*.sw? 2 | /pkg 3 | /spec/fixtures/manifests 4 | /spec/fixtures/modules 5 | /.rspec_system 6 | /.vagrant 7 | /.bundle 8 | /vendor 9 | /Gemfile.lock 10 | /junit 11 | /log 12 | .yardoc 13 | coverage 14 | -------------------------------------------------------------------------------- /skeleton/.pmtignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | -------------------------------------------------------------------------------- /skeleton/.rspec: -------------------------------------------------------------------------------- 1 | --format documentation 2 | --color 3 | -------------------------------------------------------------------------------- /skeleton/.rubocop.yml: -------------------------------------------------------------------------------- 1 | AllCops: 2 | Exclude: 3 | # Ignore HTML related things 4 | - '**/*.erb' 5 | # Ignore vendored gems 6 | - 'vendor/**/*' 7 | # Ignore code from test fixtures 8 | - 'spec/fixtures/**/*' 9 | 10 | Lint/ConditionPosition: 11 | Enabled: true 12 | 13 | Lint/ElseLayout: 14 | Enabled: true 15 | 16 | Lint/UnreachableCode: 17 | Enabled: true 18 | 19 | Lint/UselessComparison: 20 | Enabled: true 21 | 22 | Lint/EnsureReturn: 23 | Enabled: true 24 | 25 | Lint/HandleExceptions: 26 | Enabled: true 27 | 28 | Lint/LiteralInCondition: 29 | Enabled: true 30 | 31 | Lint/ShadowingOuterLocalVariable: 32 | Enabled: true 33 | 34 | Lint/LiteralInInterpolation: 35 | Enabled: true 36 | 37 | Style/RedundantReturn: 38 | Enabled: true 39 | 40 | Lint/AmbiguousOperator: 41 | Enabled: true 42 | 43 | Lint/AssignmentInCondition: 44 | Enabled: true 45 | 46 | Style/SpaceBeforeComment: 47 | Enabled: true 48 | 49 | # DISABLED - not useful 50 | Style/HashSyntax: 51 | Enabled: false 52 | 53 | # USES: as shortcut for non nil&valid checking a = x() and a.empty? 54 | # DISABLED - not useful 55 | Style/AndOr: 56 | Enabled: false 57 | 58 | # DISABLED - not useful 59 | Style/RedundantSelf: 60 | Enabled: false 61 | 62 | # DISABLED - not useful 63 | Metrics/MethodLength: 64 | Enabled: false 65 | 66 | # DISABLED - not useful 67 | Style/WhileUntilModifier: 68 | Enabled: false 69 | 70 | # DISABLED - the offender is just haskell envy 71 | Lint/AmbiguousRegexpLiteral: 72 | Enabled: false 73 | 74 | # DISABLED 75 | Lint/Eval: 76 | Enabled: false 77 | 78 | # DISABLED 79 | Lint/BlockAlignment: 80 | Enabled: false 81 | 82 | # DISABLED 83 | Lint/DefEndAlignment: 84 | Enabled: false 85 | 86 | # DISABLED 87 | Lint/EndAlignment: 88 | Enabled: false 89 | 90 | # DISABLED 91 | Lint/DeprecatedClassMethods: 92 | Enabled: false 93 | 94 | # DISABLED 95 | Lint/Loop: 96 | Enabled: false 97 | 98 | # DISABLED 99 | Lint/ParenthesesAsGroupedExpression: 100 | Enabled: false 101 | 102 | Lint/RescueException: 103 | Enabled: false 104 | 105 | Lint/StringConversionInInterpolation: 106 | Enabled: false 107 | 108 | Lint/UnusedBlockArgument: 109 | Enabled: false 110 | 111 | Lint/UnusedMethodArgument: 112 | Enabled: false 113 | 114 | Lint/UselessAccessModifier: 115 | Enabled: true 116 | 117 | Lint/UselessAssignment: 118 | Enabled: true 119 | 120 | Lint/Void: 121 | Enabled: true 122 | 123 | Style/AccessModifierIndentation: 124 | Enabled: false 125 | 126 | Style/AccessorMethodName: 127 | Enabled: false 128 | 129 | Style/Alias: 130 | Enabled: false 131 | 132 | Style/AlignArray: 133 | Enabled: false 134 | 135 | Style/AlignHash: 136 | Enabled: false 137 | 138 | Style/AlignParameters: 139 | Enabled: false 140 | 141 | Metrics/BlockNesting: 142 | Enabled: false 143 | 144 | Style/AsciiComments: 145 | Enabled: false 146 | 147 | Style/Attr: 148 | Enabled: false 149 | 150 | Style/BracesAroundHashParameters: 151 | Enabled: false 152 | 153 | Style/CaseEquality: 154 | Enabled: false 155 | 156 | Style/CaseIndentation: 157 | Enabled: false 158 | 159 | Style/CharacterLiteral: 160 | Enabled: false 161 | 162 | Style/ClassAndModuleCamelCase: 163 | Enabled: false 164 | 165 | Style/ClassAndModuleChildren: 166 | Enabled: false 167 | 168 | Style/ClassCheck: 169 | Enabled: false 170 | 171 | Metrics/ClassLength: 172 | Enabled: false 173 | 174 | Style/ClassMethods: 175 | Enabled: false 176 | 177 | Style/ClassVars: 178 | Enabled: false 179 | 180 | Style/WhenThen: 181 | Enabled: false 182 | 183 | # DISABLED - not useful 184 | Style/WordArray: 185 | Enabled: false 186 | 187 | Style/UnneededPercentQ: 188 | Enabled: false 189 | 190 | Style/Tab: 191 | Enabled: false 192 | 193 | Style/SpaceBeforeSemicolon: 194 | Enabled: false 195 | 196 | Style/TrailingBlankLines: 197 | Enabled: false 198 | 199 | Style/SpaceInsideBlockBraces: 200 | Enabled: false 201 | 202 | Style/SpaceInsideBrackets: 203 | Enabled: false 204 | 205 | Style/SpaceInsideHashLiteralBraces: 206 | Enabled: false 207 | 208 | Style/SpaceInsideParens: 209 | Enabled: false 210 | 211 | Style/LeadingCommentSpace: 212 | Enabled: false 213 | 214 | Style/SingleSpaceBeforeFirstArg: 215 | Enabled: false 216 | 217 | Style/SpaceAfterColon: 218 | Enabled: false 219 | 220 | Style/SpaceAfterComma: 221 | Enabled: false 222 | 223 | Style/SpaceAfterControlKeyword: 224 | Enabled: false 225 | 226 | Style/SpaceAfterMethodName: 227 | Enabled: false 228 | 229 | Style/SpaceAfterNot: 230 | Enabled: false 231 | 232 | Style/SpaceAfterSemicolon: 233 | Enabled: false 234 | 235 | Style/SpaceAroundEqualsInParameterDefault: 236 | Enabled: false 237 | 238 | Style/SpaceAroundOperators: 239 | Enabled: false 240 | 241 | Style/SpaceBeforeBlockBraces: 242 | Enabled: false 243 | 244 | Style/SpaceBeforeComma: 245 | Enabled: false 246 | 247 | Style/CollectionMethods: 248 | Enabled: false 249 | 250 | Style/CommentIndentation: 251 | Enabled: false 252 | 253 | Style/ColonMethodCall: 254 | Enabled: false 255 | 256 | Style/CommentAnnotation: 257 | Enabled: false 258 | 259 | Metrics/CyclomaticComplexity: 260 | Enabled: false 261 | 262 | Style/ConstantName: 263 | Enabled: false 264 | 265 | Style/Documentation: 266 | Enabled: false 267 | 268 | Style/DefWithParentheses: 269 | Enabled: false 270 | 271 | Style/DeprecatedHashMethods: 272 | Enabled: false 273 | 274 | Style/DotPosition: 275 | Enabled: false 276 | 277 | # DISABLED - used for converting to bool 278 | Style/DoubleNegation: 279 | Enabled: false 280 | 281 | Style/EachWithObject: 282 | Enabled: false 283 | 284 | Style/EmptyLineBetweenDefs: 285 | Enabled: false 286 | 287 | Style/IndentArray: 288 | Enabled: false 289 | 290 | Style/IndentHash: 291 | Enabled: false 292 | 293 | Style/IndentationConsistency: 294 | Enabled: false 295 | 296 | Style/IndentationWidth: 297 | Enabled: false 298 | 299 | Style/EmptyLines: 300 | Enabled: false 301 | 302 | Style/EmptyLinesAroundAccessModifier: 303 | Enabled: false 304 | 305 | Style/EmptyLiteral: 306 | Enabled: false 307 | 308 | Metrics/LineLength: 309 | Enabled: false 310 | 311 | Style/MethodCallParentheses: 312 | Enabled: false 313 | 314 | Style/MethodDefParentheses: 315 | Enabled: false 316 | 317 | Style/LineEndConcatenation: 318 | Enabled: false 319 | 320 | Style/TrailingWhitespace: 321 | Enabled: false 322 | 323 | Style/StringLiterals: 324 | Enabled: false 325 | 326 | Style/TrailingComma: 327 | Enabled: false 328 | 329 | Style/GlobalVars: 330 | Enabled: false 331 | 332 | Style/GuardClause: 333 | Enabled: false 334 | 335 | Style/IfUnlessModifier: 336 | Enabled: false 337 | 338 | Style/MultilineIfThen: 339 | Enabled: false 340 | 341 | Style/NegatedIf: 342 | Enabled: false 343 | 344 | Style/NegatedWhile: 345 | Enabled: false 346 | 347 | Style/Next: 348 | Enabled: false 349 | 350 | Style/SingleLineBlockParams: 351 | Enabled: false 352 | 353 | Style/SingleLineMethods: 354 | Enabled: false 355 | 356 | Style/SpecialGlobalVars: 357 | Enabled: false 358 | 359 | Style/TrivialAccessors: 360 | Enabled: false 361 | 362 | Style/UnlessElse: 363 | Enabled: false 364 | 365 | Style/VariableInterpolation: 366 | Enabled: false 367 | 368 | Style/VariableName: 369 | Enabled: false 370 | 371 | Style/WhileUntilDo: 372 | Enabled: false 373 | 374 | Style/EvenOdd: 375 | Enabled: false 376 | 377 | Style/FileName: 378 | Enabled: false 379 | 380 | Style/For: 381 | Enabled: false 382 | 383 | Style/Lambda: 384 | Enabled: false 385 | 386 | Style/MethodName: 387 | Enabled: false 388 | 389 | Style/MultilineTernaryOperator: 390 | Enabled: false 391 | 392 | Style/NestedTernaryOperator: 393 | Enabled: false 394 | 395 | Style/NilComparison: 396 | Enabled: false 397 | 398 | Style/FormatString: 399 | Enabled: false 400 | 401 | Style/MultilineBlockChain: 402 | Enabled: false 403 | 404 | Style/Semicolon: 405 | Enabled: false 406 | 407 | Style/SignalException: 408 | Enabled: false 409 | 410 | Style/NonNilCheck: 411 | Enabled: false 412 | 413 | Style/Not: 414 | Enabled: false 415 | 416 | Style/NumericLiterals: 417 | Enabled: false 418 | 419 | Style/OneLineConditional: 420 | Enabled: false 421 | 422 | Style/OpMethod: 423 | Enabled: false 424 | 425 | Style/ParenthesesAroundCondition: 426 | Enabled: false 427 | 428 | Style/PercentLiteralDelimiters: 429 | Enabled: false 430 | 431 | Style/PerlBackrefs: 432 | Enabled: false 433 | 434 | Style/PredicateName: 435 | Enabled: false 436 | 437 | Style/RedundantException: 438 | Enabled: false 439 | 440 | Style/SelfAssignment: 441 | Enabled: false 442 | 443 | Style/Proc: 444 | Enabled: false 445 | 446 | Style/RaiseArgs: 447 | Enabled: false 448 | 449 | Style/RedundantBegin: 450 | Enabled: false 451 | 452 | Style/RescueModifier: 453 | Enabled: false 454 | 455 | Style/RegexpLiteral: 456 | Enabled: false 457 | 458 | Lint/UnderscorePrefixedVariableName: 459 | Enabled: false 460 | 461 | Metrics/ParameterLists: 462 | Enabled: false 463 | 464 | Lint/RequireParentheses: 465 | Enabled: false 466 | 467 | Lint/SpaceBeforeFirstArg: 468 | Enabled: false 469 | 470 | Style/ModuleFunction: 471 | Enabled: false 472 | 473 | Lint/Debugger: 474 | Enabled: false 475 | 476 | Style/IfWithSemicolon: 477 | Enabled: false 478 | 479 | Style/Encoding: 480 | Enabled: false 481 | -------------------------------------------------------------------------------- /skeleton/.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | sudo: false 3 | language: ruby 4 | bundler_args: --without development system_tests 5 | before_install: rm Gemfile.lock || true 6 | rvm: 7 | - 1.8.7 8 | - 1.9.3 9 | - 2.0.0 10 | - 2.1.0 11 | script: bundle exec rake test 12 | env: 13 | - PUPPET_GEM_VERSION="~> 2.7.0" 14 | - PUPPET_GEM_VERSION="~> 3.2.0" 15 | - PUPPET_GEM_VERSION="~> 3.3.0" 16 | - PUPPET_GEM_VERSION="~> 3.4.0" 17 | - PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES=yes 18 | - PUPPET_GEM_VERSION="~> 3.6.0" STRICT_VARIABLES=yes 19 | - PUPPET_GEM_VERSION="~> 3.7.0" STRICT_VARIABLES=yes 20 | - PUPPET_GEM_VERSION="~> 3.8.0" STRICT_VARIABLES=yes FUTURE_PARSER=yes 21 | matrix: 22 | exclude: 23 | # Ruby 1.9.3 24 | - rvm: 1.9.3 25 | env: PUPPET_GEM_VERSION="~> 2.7.0" 26 | 27 | # Ruby 2.0.0 28 | - rvm: 2.0.0 29 | env: PUPPET_GEM_VERSION="~> 2.7.0" 30 | 31 | # Ruby 2.1.0 32 | - rvm: 2.1.0 33 | env: PUPPET_GEM_VERSION="~> 2.7.0" 34 | - rvm: 2.1.0 35 | env: PUPPET_GEM_VERSION="~> 3.2.0" 36 | - rvm: 2.1.0 37 | env: PUPPET_GEM_VERSION="~> 3.3.0" 38 | - rvm: 2.1.0 39 | env: PUPPET_GEM_VERSION="~> 3.4.0" 40 | -------------------------------------------------------------------------------- /skeleton/.yardopts: -------------------------------------------------------------------------------- 1 | --markup markdown 2 | -------------------------------------------------------------------------------- /skeleton/CHANGELOG: -------------------------------------------------------------------------------- 1 | YYYY-MM-DD Release 0.1.0 2 | - something you did 3 | - something else you did 4 | -------------------------------------------------------------------------------- /skeleton/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | This module has grown over time based on a range of contributions from 2 | people using it. If you follow these contributing guidelines your patch 3 | will likely make it into a release a little quicker. 4 | 5 | 6 | ## Contributing 7 | 8 | 1. Fork the repo. 9 | 10 | 2. Run the tests. We only take pull requests with passing tests, and 11 | it's great to know that you have a clean slate. 12 | 13 | 3. Add a test for your change. Only refactoring and documentation 14 | changes require no new tests. If you are adding functionality 15 | or fixing a bug, please add a test. 16 | 17 | 4. Make the test pass. 18 | 19 | 5. Push to your fork and submit a pull request. 20 | 21 | 22 | ## Dependencies 23 | 24 | The testing and development tools have a bunch of dependencies, 25 | all managed by [Bundler](http://bundler.io/) according to the 26 | [Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions). 27 | 28 | By default the tests use a baseline version of Puppet. 29 | 30 | If you have Ruby 2.x or want a specific version of Puppet, 31 | you must set an environment variable such as: 32 | 33 | export PUPPET_VERSION="~> 3.2.0" 34 | 35 | Install the dependencies like so... 36 | 37 | bundle install 38 | 39 | ## Syntax and style 40 | 41 | The test suite will run [Puppet Lint](http://puppet-lint.com/) and 42 | [Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to 43 | check various syntax and style things. You can run these locally with: 44 | 45 | bundle exec rake lint 46 | bundle exec rake syntax 47 | 48 | ## Running the unit tests 49 | 50 | The unit test suite covers most of the code, as mentioned above please 51 | add tests if you're adding new functionality. If you've not used 52 | [rspec-puppet](http://rspec-puppet.com/) before then feel free to ask 53 | about how best to test your new feature. Running the test suite is done 54 | with: 55 | 56 | bundle exec rake spec 57 | 58 | Note also you can run the syntax, style and unit tests in one go with: 59 | 60 | bundle exec rake test 61 | 62 | ### Automatically run the tests 63 | 64 | During development of your puppet module you might want to run your unit 65 | tests a couple of times. You can use the following command to automate 66 | running the unit tests on every change made in the manifests folder. 67 | 68 | bundle exec guard 69 | 70 | ## Integration tests 71 | 72 | The unit tests just check the code runs, not that it does exactly what 73 | we want on a real machine. For that we're using 74 | [Beaker](https://github.com/puppetlabs/beaker). 75 | 76 | Beaker fires up a new virtual machine (using Vagrant) and runs a series of 77 | simple tests against it after applying the module. You can run our 78 | Beaker tests with: 79 | 80 | bundle exec rake acceptance 81 | 82 | This will use the host described in `spec/acceptance/nodeset/default.yml` 83 | by default. To run against another host, set the `BEAKER_set` environment 84 | variable to the name of a host described by a `.yml` file in the 85 | `nodeset` directory. For example, to run against CentOS 6.4: 86 | 87 | BEAKER_set=centos-64-x64 bundle exec rake acceptance 88 | 89 | If you don't want to have to recreate the virtual machine every time you 90 | can use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will 91 | at least need `BEAKER_provision` set to yes (the default). The Vagrantfile 92 | for the created virtual machines will be in `.vagrant/beaker_vagrant_files`. 93 | -------------------------------------------------------------------------------- /skeleton/CONTRIBUTORS.erb: -------------------------------------------------------------------------------- 1 | <%= metadata.author %> 2 | -------------------------------------------------------------------------------- /skeleton/Gemfile: -------------------------------------------------------------------------------- 1 | source ENV['GEM_SOURCE'] || "https://rubygems.org" 2 | 3 | group :test do 4 | gem "rake" 5 | gem "puppet", ENV['PUPPET_GEM_VERSION'] || '~> 3.8.0' 6 | gem "rspec", '< 3.2.0' 7 | gem "rspec-puppet" 8 | gem "puppetlabs_spec_helper" 9 | gem "metadata-json-lint" 10 | gem "rspec-puppet-facts" 11 | gem 'rubocop', '0.33.0' 12 | gem 'simplecov', '>= 0.11.0' 13 | gem 'simplecov-console' 14 | 15 | gem "puppet-lint-absolute_classname-check" 16 | gem "puppet-lint-leading_zero-check" 17 | gem "puppet-lint-trailing_comma-check" 18 | gem "puppet-lint-version_comparison-check" 19 | gem "puppet-lint-classes_and_types_beginning_with_digits-check" 20 | gem "puppet-lint-unquoted_string-check" 21 | gem 'puppet-lint-resource_reference_syntax' 22 | 23 | gem 'json_pure', '<= 2.0.1' if RUBY_VERSION < '2.0.0' 24 | end 25 | 26 | group :development do 27 | gem "travis" if RUBY_VERSION >= '2.1.0' 28 | gem "travis-lint" if RUBY_VERSION >= '2.1.0' 29 | gem "puppet-blacksmith" 30 | gem "guard-rake" if RUBY_VERSION >= '2.2.5' # per dependency https://rubygems.org/gems/ruby_dep 31 | end 32 | 33 | group :system_tests do 34 | gem "beaker" 35 | gem "beaker-rspec" 36 | gem "beaker-puppet_install_helper" 37 | end 38 | -------------------------------------------------------------------------------- /skeleton/Guardfile: -------------------------------------------------------------------------------- 1 | notification :off 2 | 3 | guard 'rake', :task => 'test' do 4 | watch(%r{^manifests\/(.+)\.pp$}) 5 | end 6 | -------------------------------------------------------------------------------- /skeleton/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /skeleton/README.markdown.erb: -------------------------------------------------------------------------------- 1 | #### Table of Contents 2 | 3 | 1. [Overview](#overview) 4 | 2. [Module Description - What the module does and why it is useful](#module-description) 5 | 3. [Setup - The basics of getting started with <%= metadata.name %>](#setup) 6 | * [What <%= metadata.name %> affects](#what-<%= metadata.name %>-affects) 7 | * [Setup requirements](#setup-requirements) 8 | * [Beginning with <%= metadata.name %>](#beginning-with-<%= metadata.name %>) 9 | 4. [Usage - Configuration options and additional functionality](#usage) 10 | 5. [Reference - An under-the-hood peek at what the module is doing and how](#reference) 11 | 5. [Limitations - OS compatibility, etc.](#limitations) 12 | 6. [Development - Guide for contributing to the module](#development) 13 | 14 | ## Overview 15 | 16 | A one-maybe-two sentence summary of what the module does/what problem it solves. This is your 30 second elevator pitch for your module. Consider including OS/Puppet version it works with. 17 | 18 | ## Module Description 19 | 20 | If applicable, this section should have a brief description of the technology the module integrates with and what that integration enables. This section should answer the questions: "What does this module *do*?" and "Why would I use it?" 21 | 22 | If your module has a range of functionality (installation, configuration, management, etc.) this is the time to mention it. 23 | 24 | ## Setup 25 | 26 | ### What <%= metadata.name %> affects 27 | 28 | * A list of files, packages, services, or operations that the module will alter, impact, or execute on the system it's installed on. 29 | * This is a great place to stick any warnings. 30 | * Can be in list or paragraph form. 31 | 32 | ### Setup Requirements **OPTIONAL** 33 | 34 | If your module requires anything extra before setting up (pluginsync enabled, etc.), mention it here. 35 | 36 | ### Beginning with <%= metadata.name %> 37 | 38 | The very basic steps needed for a user to get the module up and running. 39 | 40 | If your most recent release breaks compatibility or requires particular steps for upgrading, you may wish to include an additional section here: Upgrading (For an example, see http://forge.puppetlabs.com/puppetlabs/firewall). 41 | 42 | ## Usage 43 | 44 | Put the classes, types, and resources for customizing, configuring, and doing the fancy stuff with your module here. 45 | 46 | ## Reference 47 | 48 | Here, list the classes, types, providers, facts, etc contained in your module. This section should include all of the under-the-hood workings of your module so people know what the module is touching on their system but don't need to mess with things. (We are working on automating this section!) 49 | 50 | ## Limitations 51 | 52 | This is where you list OS compatibility, version compatibility, etc. 53 | 54 | ## Development 55 | 56 | Since your module is awesome, other users will want to play with it. Let them know what the ground rules for contributing are. 57 | 58 | ## Release Notes/Contributors/Etc **Optional** 59 | 60 | If you aren't using changelog, put your release notes here (though you should consider using changelog). You may also add any additional sections you feel are necessary or important to include here. Please use the `## ` header. 61 | -------------------------------------------------------------------------------- /skeleton/Rakefile: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'bundler/setup' 3 | 4 | require 'puppetlabs_spec_helper/rake_tasks' 5 | require 'puppet/version' 6 | require 'puppet-lint/tasks/puppet-lint' 7 | require 'puppet-syntax/tasks/puppet-syntax' 8 | require 'metadata-json-lint/rake_task' 9 | require 'rubocop/rake_task' 10 | 11 | if Puppet.version.to_f >= 4.9 12 | require 'semantic_puppet' 13 | elsif Puppet.version.to_f >= 3.6 && Puppet.version.to_f < 4.9 14 | require 'puppet/vendor/semantic/lib/semantic' 15 | end 16 | 17 | # These gems aren't always present, for instance 18 | # on Travis with --without development 19 | begin 20 | require 'puppet_blacksmith/rake_tasks' 21 | rescue LoadError # rubocop:disable Lint/HandleExceptions 22 | end 23 | 24 | RuboCop::RakeTask.new 25 | 26 | exclude_paths = [ 27 | "bundle/**/*", 28 | "pkg/**/*", 29 | "vendor/**/*", 30 | "spec/**/*", 31 | ] 32 | 33 | # Coverage from puppetlabs-spec-helper requires rcov which 34 | # doesn't work in anything since 1.8.7 35 | Rake::Task[:coverage].clear 36 | 37 | Rake::Task[:lint].clear 38 | 39 | PuppetLint.configuration.relative = true 40 | PuppetLint.configuration.disable_80chars 41 | PuppetLint.configuration.disable_class_inherits_from_params_class 42 | PuppetLint.configuration.disable_class_parameter_defaults 43 | PuppetLint.configuration.fail_on_warnings = true 44 | 45 | PuppetLint::RakeTask.new :lint do |config| 46 | config.ignore_paths = exclude_paths 47 | end 48 | 49 | PuppetSyntax.exclude_paths = exclude_paths 50 | 51 | desc "Run acceptance tests" 52 | RSpec::Core::RakeTask.new(:acceptance) do |t| 53 | t.pattern = 'spec/acceptance' 54 | end 55 | 56 | desc "Populate CONTRIBUTORS file" 57 | task :contributors do 58 | system("git log --format='%aN' | sort -u > CONTRIBUTORS") 59 | end 60 | 61 | desc "Run syntax, lint, and spec tests." 62 | task :test => [ 63 | :metadata_lint, 64 | :syntax, 65 | :lint, 66 | :rubocop, 67 | :spec, 68 | ] 69 | -------------------------------------------------------------------------------- /skeleton/files/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/garethr/puppet-module-skeleton/3cfdcf303d0bfe3fbe196b65c0e6ae8d00691966/skeleton/files/.gitkeep -------------------------------------------------------------------------------- /skeleton/lib/puppet/provider/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/garethr/puppet-module-skeleton/3cfdcf303d0bfe3fbe196b65c0e6ae8d00691966/skeleton/lib/puppet/provider/.gitkeep -------------------------------------------------------------------------------- /skeleton/lib/puppet/type/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/garethr/puppet-module-skeleton/3cfdcf303d0bfe3fbe196b65c0e6ae8d00691966/skeleton/lib/puppet/type/.gitkeep -------------------------------------------------------------------------------- /skeleton/manifests/config.pp.erb: -------------------------------------------------------------------------------- 1 | # == Class <%= metadata.name %>::config 2 | # 3 | # This class is called from <%= metadata.name %> for service config. 4 | # 5 | class <%= metadata.name %>::config { 6 | } 7 | -------------------------------------------------------------------------------- /skeleton/manifests/init.pp.erb: -------------------------------------------------------------------------------- 1 | # Class: <%= metadata.name %> 2 | # =========================== 3 | # 4 | # Full description of class <%= metadata.name %> here. 5 | # 6 | # Parameters 7 | # ---------- 8 | # 9 | # * `sample parameter` 10 | # Explanation of what this parameter affects and what it defaults to. 11 | # e.g. "Specify one or more upstream ntp servers as an array." 12 | # 13 | class <%= metadata.name %> ( 14 | $package_name = $::<%= metadata.name %>::params::package_name, 15 | $service_name = $::<%= metadata.name %>::params::service_name, 16 | ) inherits ::<%= metadata.name %>::params { 17 | 18 | # validate parameters here 19 | 20 | class { '::<%= metadata.name %>::install': } -> 21 | class { '::<%= metadata.name %>::config': } ~> 22 | class { '::<%= metadata.name %>::service': } -> 23 | Class['::<%= metadata.name %>'] 24 | } 25 | -------------------------------------------------------------------------------- /skeleton/manifests/install.pp.erb: -------------------------------------------------------------------------------- 1 | # == Class <%= metadata.name %>::install 2 | # 3 | # This class is called from <%= metadata.name %> for install. 4 | # 5 | class <%= metadata.name %>::install { 6 | 7 | package { $::<%= metadata.name %>::package_name: 8 | ensure => present, 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /skeleton/manifests/params.pp.erb: -------------------------------------------------------------------------------- 1 | # == Class <%= metadata.name %>::params 2 | # 3 | # This class is meant to be called from <%= metadata.name %>. 4 | # It sets variables according to platform. 5 | # 6 | class <%= metadata.name %>::params { 7 | case $::osfamily { 8 | 'Debian': { 9 | $package_name = '<%= metadata.name %>' 10 | $service_name = '<%= metadata.name %>' 11 | } 12 | 'RedHat', 'Amazon': { 13 | $package_name = '<%= metadata.name %>' 14 | $service_name = '<%= metadata.name %>' 15 | } 16 | default: { 17 | fail("${::operatingsystem} not supported") 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /skeleton/manifests/service.pp.erb: -------------------------------------------------------------------------------- 1 | # == Class <%= metadata.name %>::service 2 | # 3 | # This class is meant to be called from <%= metadata.name %>. 4 | # It ensure the service is running. 5 | # 6 | class <%= metadata.name %>::service { 7 | 8 | service { $::<%= metadata.name %>::service_name: 9 | ensure => running, 10 | enable => true, 11 | hasstatus => true, 12 | hasrestart => true, 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /skeleton/metadata.json.erb: -------------------------------------------------------------------------------- 1 | { 2 | "name": "<%= metadata.full_module_name %>", 3 | "version": "<%= metadata.version %>", 4 | "author": "<%= metadata.author %>", 5 | "summary": "<%= metadata.summary %>", 6 | "license": "<%= metadata.license %>", 7 | "source": "<%= metadata.source %>", 8 | "project_page": "<%= metadata.project_page %>", 9 | "issues_url": "<%= metadata.issues_url %>", 10 | "dependencies": [ 11 | { 12 | "name": "puppetlabs-stdlib", 13 | "version_requirement": ">= 1.0.0" 14 | } 15 | ], 16 | "operatingsystem_support": [ 17 | { 18 | "operatingsystem": "Debian", 19 | "operatingsystemrelease": [ 20 | "6", 21 | "7" 22 | ] 23 | }, 24 | { 25 | "operatingsystem": "RedHat", 26 | "operatingsystemrelease": [ 27 | "5", 28 | "6", 29 | "7" 30 | ] 31 | } 32 | ] 33 | } 34 | -------------------------------------------------------------------------------- /skeleton/spec/acceptance/class_spec.rb.erb: -------------------------------------------------------------------------------- 1 | require 'spec_helper_acceptance' 2 | 3 | describe '<%= metadata.name %> class' do 4 | context 'default parameters' do 5 | # Using puppet_apply as a helper 6 | it 'should work idempotently with no errors' do 7 | pp = <<-EOS 8 | class { '<%= metadata.name %>': } 9 | EOS 10 | 11 | # Run it twice and test for idempotency 12 | apply_manifest(pp, :catch_failures => true) 13 | apply_manifest(pp, :catch_changes => true) 14 | end 15 | 16 | describe package('<%= metadata.name %>') do 17 | it { is_expected.to be_installed } 18 | end 19 | 20 | describe service('<%= metadata.name %>') do 21 | it { is_expected.to be_enabled } 22 | it { is_expected.to be_running } 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /skeleton/spec/acceptance/nodesets/centos-511-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-511-x64: 3 | roles: 4 | - master 5 | platform: el-5-x86_64 6 | box: puppetlabs/centos-5.11-64-nocm 7 | box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-5.11-64-nocm 8 | hypervisor: vagrant 9 | 10 | CONFIG: 11 | log_level: verbose 12 | type: foss 13 | -------------------------------------------------------------------------------- /skeleton/spec/acceptance/nodesets/centos-66-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-66-x64: 3 | roles: 4 | - master 5 | platform: el-6-x86_64 6 | box: puppetlabs/centos-6.6-64-nocm 7 | box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-6.6-64-nocm 8 | hypervisor: vagrant 9 | CONFIG: 10 | log_level: verbose 11 | type: foss 12 | -------------------------------------------------------------------------------- /skeleton/spec/acceptance/nodesets/centos-7-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | centos-7-x64: 3 | roles: 4 | - master 5 | platform: el-7-x86_64 6 | box: puppetlabs/centos-7.0-64-nocm 7 | box_url: https://vagrantcloud.com/puppetlabs/boxes/centos-7.0-64-nocm 8 | hypervisor: vagrant 9 | CONFIG: 10 | log_level: verbose 11 | type: foss -------------------------------------------------------------------------------- /skeleton/spec/acceptance/nodesets/debian-609-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | debian-609-x64: 3 | roles: 4 | - master 5 | platform: debian-6-amd64 6 | box: puppetlabs/debian-6.0.9-64-nocm 7 | box_url: https://vagrantcloud.com/puppetlabs/boxes/debian-6.0.9-64-nocm 8 | hypervisor: vagrant 9 | 10 | CONFIG: 11 | log_level: verbose 12 | type: foss 13 | -------------------------------------------------------------------------------- /skeleton/spec/acceptance/nodesets/debian-78-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | debian-78-x64: 3 | roles: 4 | - master 5 | platform: debian-7-amd64 6 | box: puppetlabs/debian-7.8-64-nocm 7 | box_url: https://vagrantcloud.com/puppetlabs/boxes/debian-7.8-64-nocm 8 | hypervisor: vagrant 9 | 10 | CONFIG: 11 | log_level: verbose 12 | type: foss 13 | -------------------------------------------------------------------------------- /skeleton/spec/acceptance/nodesets/default.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-server-1204-x64: 3 | roles: 4 | - master 5 | platform: ubuntu-1204-amd64 6 | box: puppetlabs/ubuntu-12.04-64-nocm 7 | box_url: https://vagrantcloud.com/puppetlabs/boxes/ubuntu-12.04-64-nocm 8 | hypervisor: vagrant 9 | 10 | CONFIG: 11 | log_level: verbose 12 | type: foss 13 | -------------------------------------------------------------------------------- /skeleton/spec/acceptance/nodesets/fedora-20-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | fedora-20-x64: 3 | roles: 4 | - master 5 | platform: el-7-x86_64 6 | box: chef/fedora-20 7 | box_url: https://vagrantcloud.com/chef/boxes/fedora-20 8 | hypervisor: vagrant 9 | 10 | CONFIG: 11 | log_level: verbose 12 | type: foss 13 | -------------------------------------------------------------------------------- /skeleton/spec/acceptance/nodesets/ubuntu-1204-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-1204-x64: 3 | roles: 4 | - master 5 | platform: ubuntu-1204-amd64 6 | box: puppetlabs/ubuntu-12.04-64-nocm 7 | box_url: https://vagrantcloud.com/puppetlabs/boxes/ubuntu-12.04-64-nocm 8 | hypervisor: vagrant 9 | 10 | CONFIG: 11 | log_level: verbose 12 | color: false 13 | type: foss 14 | -------------------------------------------------------------------------------- /skeleton/spec/acceptance/nodesets/ubuntu-1404-x64.yml: -------------------------------------------------------------------------------- 1 | HOSTS: 2 | ubuntu-1404-x64: 3 | roles: 4 | - master 5 | platform: ubuntu-1404-amd64 6 | box: puppetlabs/ubuntu-14.04-64-nocm 7 | box_url: https://vagrantcloud.com/puppetlabs/boxes/ubuntu-14.04-64-nocm 8 | hypervisor: vagrant 9 | 10 | CONFIG: 11 | log_level: verbose 12 | type: foss 13 | -------------------------------------------------------------------------------- /skeleton/spec/classes/coverage_spec.rb: -------------------------------------------------------------------------------- 1 | at_exit { RSpec::Puppet::Coverage.report! } 2 | -------------------------------------------------------------------------------- /skeleton/spec/classes/example_spec.rb.erb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe '<%= metadata.name %>' do 4 | context 'supported operating systems' do 5 | on_supported_os.each do |os, facts| 6 | context "on #{os}" do 7 | let(:facts) do 8 | facts 9 | end 10 | 11 | context "<%= metadata.name %> class without any parameters" do 12 | it { is_expected.to compile.with_all_deps } 13 | 14 | it { is_expected.to contain_class('<%= metadata.name %>::params') } 15 | it { is_expected.to contain_class('<%= metadata.name %>::install').that_comes_before('<%= metadata.name %>::config') } 16 | it { is_expected.to contain_class('<%= metadata.name %>::config') } 17 | it { is_expected.to contain_class('<%= metadata.name %>::service').that_subscribes_to('<%= metadata.name %>::config') } 18 | 19 | it { is_expected.to contain_service('<%= metadata.name %>') } 20 | it { is_expected.to contain_package('<%= metadata.name %>').with_ensure('present') } 21 | end 22 | end 23 | end 24 | end 25 | 26 | context 'unsupported operating system' do 27 | describe '<%= metadata.name %> class without any parameters on Solaris/Nexenta' do 28 | let(:facts) do 29 | { 30 | :osfamily => 'Solaris', 31 | :operatingsystem => 'Nexenta', 32 | } 33 | end 34 | 35 | it { expect { is_expected.to contain_package('<%= metadata.name %>') }.to raise_error(Puppet::Error, /Nexenta not supported/) } 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /skeleton/spec/fixtures/hiera.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | :backends: 3 | - yaml 4 | :yaml: 5 | :datadir: './spec/fixtures/hieradata' 6 | :hierarchy: 7 | - '%{::clientcert}' 8 | - 'default' 9 | -------------------------------------------------------------------------------- /skeleton/spec/fixtures/hieradata/default.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Default key/value pairs 3 | -------------------------------------------------------------------------------- /skeleton/spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'puppetlabs_spec_helper/module_spec_helper' 2 | require 'rspec-puppet-facts' 3 | 4 | include RspecPuppetFacts 5 | 6 | require 'simplecov' 7 | require 'simplecov-console' 8 | 9 | SimpleCov.start do 10 | add_filter '/spec' 11 | add_filter '/vendor' 12 | formatter SimpleCov::Formatter::MultiFormatter.new([ 13 | SimpleCov::Formatter::HTMLFormatter, 14 | SimpleCov::Formatter::Console 15 | ]) 16 | end 17 | 18 | RSpec.configure do |c| 19 | c.hiera_config = File.expand_path(File.join(__FILE__, '../fixtures/hiera.yaml')) 20 | end 21 | -------------------------------------------------------------------------------- /skeleton/spec/spec_helper_acceptance.rb.erb: -------------------------------------------------------------------------------- 1 | require 'beaker-rspec/spec_helper' 2 | require 'beaker-rspec/helpers/serverspec' 3 | require 'beaker/puppet_install_helper' 4 | 5 | run_puppet_install_helper unless ENV['BEAKER_provision'] == 'no' 6 | 7 | RSpec.configure do |c| 8 | # Project root 9 | proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) 10 | 11 | # Readable test descriptions 12 | c.formatter = :documentation 13 | 14 | # Configure all nodes in nodeset 15 | c.before :suite do 16 | # Install module and dependencies 17 | puppet_module_install(:source => proj_root, :module_name => '<%= metadata.name %>') 18 | hosts.each do |host| 19 | on host, puppet('module', 'install', 'puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] } 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /skeleton/templates/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/garethr/puppet-module-skeleton/3cfdcf303d0bfe3fbe196b65c0e6ae8d00691966/skeleton/templates/.gitkeep -------------------------------------------------------------------------------- /skeleton/tests/init.pp.erb: -------------------------------------------------------------------------------- 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 | # http://docs.puppetlabs.com/guides/tests_smoke.html 11 | # 12 | include ::<%= metadata.name %> 13 | -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -xv 2 | # Change in behaviour between Puppet versions 3 | if [ $(puppet --version |sed -e 's/\..*$//' ) -gt 3 ]; then 4 | cd module 5 | else 6 | cd user-module 7 | fi 8 | # Otherwise we pick up the parent bundle 9 | export BUNDLE_GEMFILE=./Gemfile 10 | bundle install --without system_tests development 11 | # Not running metadata checks as module generate uses invalid license string 12 | bundle exec rake lint syntax rubocop spec 13 | --------------------------------------------------------------------------------