Blame view
docs/modules.md
3.62 KB
|
94b10f220
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# Writing Puppet modules for Boxen
Writing Puppet modules for Boxen is easy.
## Tooling
* Always use Bundler
* Always use librarian-puppet
* Always use puppet-lint
* Always use rspec-puppet
## Directory structure
We follow Puppet's recommended structure very closely.
Here's the directory structure from the boxen Puppet module:
```
├── Gemfile
├── Gemfile.lock
├── README.md
├── files
│ ├── README.md
│ └── gemrc
├── lib
│ ├── facter
│ │ ├── boxen.rb
│ │ └── root_encrypted.rb
│ └── puppet
│ ├── parser
│ │ └── functions
│ │ ├── file_exists.rb
│ │ ├── include_all_projects.rb
│ │ └── include_projects_from_boxen_cli.rb
│ ├── provider
│ │ ├── package
│ │ │ ├── compressed_app.rb
│ │ │ ├── hax.rb
│ │ │ └── homebrew.rb
│ │ ├── repository
│ │ │ └── git.rb
│ │ └── service
│ │ └── ghlaunchd.rb
│ └── type
│ └── repository.rb
├── manifests
│ ├── bin.pp
│ ├── config.pp
│ ├── development
│ │ └── project.pp
│ ├── development.pp
│ ├── environment.pp
│ ├── gemrc.pp
│ ├── janitor.pp
│ ├── osx_defaults.pp
│ ├── personal.pp
│ ├── profile.pp
│ ├── project.pp
│ ├── repo.pp
│ ├── security.pp
│ ├── sudoers.pp
│ └── zipped_widget.pp
├── script
│ ├── bootstrap
│ ├── cibuild
│ ├── lint
│ ├── specs
│ └── syntax
├── spec
│ ├── classes
│ │ ├── bin_spec.rb
│ │ └── environment_spec.rb
│ ├── fixtures
│ │ ├── Puppetfile
│ │ ├── Puppetfile.lock
│ │ ├── manifests
│ │ │ └── site.pp
│ │ └── modules
│ │ ├── boxen
│ │ │ ├── files -> ../../../../files
│ │ │ ├── lib -> ../../../../lib
│ │ │ ├── manifests -> ../../../../manifests
│ │ │ └── templates -> ../../../../templates
│ │ └── projects
│ │ └── manifests
│ │ └── test.pp
│ ├── spec_helper.rb
│ └── unit
│ └── puppet
│ └── type
│ └── repository_spec.rb
└── templates
├── config.sh.erb
├── env.sh.erb
└── gh_creds.sh.erb
```
Of note, we do not use things like `rake` to drive specs.
Instead, we bias towards simple, portable shell scripts that can be consumed
by other shell scripts.
## Facts and variables
The core boxen module provides [a number of variables to use](https://github.com/boxen/puppet-boxen/blob/master/manifests/config.pp#L2-L14).
In addition to these, you may always assume the presence of a `boxen_user` fact,
which is the local user running Boxen.
Other modules may provider their own globally available variables.
The recommendation is to put any variables that might be consumed by
multiple classes/manifests should be in a scoped config class
(e.g. `modules/boxen/manifests/config.pp`).
|