aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Cooper <josh@puppet.com>2018-06-28 15:18:24 -0700
committerJosh Cooper <josh@puppet.com>2018-06-28 15:18:24 -0700
commitd3fd7f3df72ecf502c455d9ba2622ac33f1621de (patch)
treea408fc9f0cdbedea7c5ef1c4ffe46f191510a43b
parenta4160770880aa7f696e0593551795c5bffb2576c (diff)
downloadpuppet-augeas_core-d3fd7f3df72ecf502c455d9ba2622ac33f1621de.tar.gz
puppet-augeas_core-d3fd7f3df72ecf502c455d9ba2622ac33f1621de.tar.bz2
Document module using puppet strings
-rw-r--r--README.md73
-rw-r--r--REFERENCE.md172
2 files changed, 204 insertions, 41 deletions
diff --git a/README.md b/README.md
index 2add08e..2d8a18c 100644
--- a/README.md
+++ b/README.md
@@ -1,21 +1,10 @@
# augeas_core
-Welcome to your new module. A short overview of the generated parts can be found in the PDK documentation at https://puppet.com/pdk/latest/pdk_generating_modules.html .
-
-The README template below provides a starting point with details about what information to include in your README.
-
-
-
-
-
-
-
#### Table of Contents
1. [Description](#description)
2. [Setup - The basics of getting started with augeas_core](#setup)
- * [What augeas_core affects](#what-augeas_core-affects)
* [Setup requirements](#setup-requirements)
* [Beginning with augeas_core](#beginning-with-augeas_core)
3. [Usage - Configuration options and additional functionality](#usage)
@@ -25,57 +14,59 @@ The README template below provides a starting point with details about what info
## 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.
+The augeas_core module is used to manage configuration files using Augeas. The module is suitable for any host for which there are Augeas libraries and ruby bindings.
## Setup
-### What augeas_core 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:
-
-* 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, another module, etc.), mention it here.
+### Setup Requirements
-If your most recent release breaks compatibility or requires particular steps for upgrading, you might want to include an additional "Upgrading" section here.
+The augeas libraries and ruby bindings must be installed in order to use this module. If you are using `puppet-agent` packages, then those prerequisites are already satisfied for most platforms.
### Beginning with augeas_core
-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.
+To manage a configuration file using `augeas`:
+
+```
+augeas { 'add_services_entry':
+ context => '/files/etc/services',
+ incl => '/etc/services',
+ lens => 'Services.lns',
+ changes => [
+ 'ins service-name after service-name[last()]',
+ 'set service-name[last()] "Doom"',
+ 'set service-name[. = "Doom"]/port "666"',
+ 'set service-name[. = "Doom"]/protocol "udp"'
+ ]
+}
+```
## 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.
+For details on usage, please see [the augeas puppet docs](https://puppet.com/docs/puppet/latest/types/augeas.html) and [examples](https://puppet.com/docs/puppet/latest/resources_augeas.html).
## Reference
-Users need a complete list of your module's classes, types, defined types providers, facts, and functions, along with the parameters for each. You can provide this list either via Puppet Strings code comments or as a complete list in the README Reference section.
+Please see REFERENCE.md for the reference documentation.
-* If you are using Puppet Strings code comments, this Reference section should include Strings information so that your users know how to access your documentation.
+This module is documented using Puppet Strings.
-* If you are not using Puppet Strings, include a list of all of your classes, defined types, and so on, along with their parameters. Each element in this listing should include:
+For a quick primer on how Strings works, please see [this blog post](https://puppet.com/blog/using-puppet-strings-generate-great-documentation-puppet-modules) or the [README.md](https://github.com/puppetlabs/puppet-strings/blob/master/README.md) for Puppet Strings.
- * The data type, if applicable.
- * A description of what the element does.
- * Valid values, if the data type doesn't make it obvious.
- * Default value, if any.
+To generate documentation locally, run
+```
+bundle install
+bundle exec puppet strings generate ./lib/**/*.rb
+```
+This command will create a browsable `\_index.html` file in the `doc` directory. The references available here are all generated from YARD-style comments embedded in the code base. When any development happens on this module, the impacted documentation should also be updated.
## 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.
+This module is only available on platforms that have augeas libraries and ruby bindings installed.
## Development
-Since your module is awesome, other users will want to play with it. Let them know what the ground rules for contributing are.
+Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can't access the huge number of platforms and myriad of hardware, software, and deployment configurations that Puppet is intended to serve.
-## Release Notes/Contributors/Etc. **Optional**
+We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
-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.
+For more information, see our [module contribution guide.](https://docs.puppetlabs.com/forge/contributing.html)
diff --git a/REFERENCE.md b/REFERENCE.md
new file mode 100644
index 0000000..5304160
--- /dev/null
+++ b/REFERENCE.md
@@ -0,0 +1,172 @@
+# Reference
+<!-- DO NOT EDIT: This document was generated by Puppet Strings -->
+
+## Table of Contents
+
+**Resource types**
+
+* [`augeas`](#augeas): Apply a change or an array of changes to the filesystem using the augeas tool. Requires: - [Augeas](http://www.augeas.net) - The ruby-augea
+
+## Resource types
+
+### augeas
+
+Apply a change or an array of changes to the filesystem
+using the augeas tool.
+
+Requires:
+
+- [Augeas](http://www.augeas.net)
+- The ruby-augeas bindings
+
+Sample usage with a string:
+
+ augeas{"test1" :
+ context => "/files/etc/sysconfig/firstboot",
+ changes => "set RUN_FIRSTBOOT YES",
+ onlyif => "match other_value size > 0",
+ }
+
+Sample usage with an array and custom lenses:
+
+ augeas{"jboss_conf":
+ context => "/files",
+ changes => [
+ "set etc/jbossas/jbossas.conf/JBOSS_IP $ipaddress",
+ "set etc/jbossas/jbossas.conf/JAVA_HOME /usr",
+ ],
+ load_path => "$/usr/share/jbossas/lenses",
+ }
+
+#### Properties
+
+The following properties are available in the `augeas` type.
+
+##### `returns`
+
+The expected return code from the augeas command. Should not be set.
+
+Default value: 0
+
+#### Parameters
+
+The following parameters are available in the `augeas` type.
+
+##### `name`
+
+namevar
+
+The name of this task. Used for uniqueness.
+
+##### `context`
+
+Optional context path. This value is prepended to the paths of all
+changes if the path is relative. If the `incl` parameter is set,
+defaults to `/files + incl`; otherwise, defaults to the empty string.
+
+Default value: ''
+
+##### `onlyif`
+
+Optional augeas command and comparisons to control the execution of this type.
+
+Note: `values` is not an actual augeas API command. It calls `match` to retrieve an array of paths
+ in <MATCH_PATH> and then `get` to retrieve the values from each of the returned paths.
+
+Supported onlyif syntax:
+
+* `get <AUGEAS_PATH> <COMPARATOR> <STRING>`
+* `values <MATCH_PATH> include <STRING>`
+* `values <MATCH_PATH> not_include <STRING>`
+* `values <MATCH_PATH> == <AN_ARRAY>`
+* `values <MATCH_PATH> != <AN_ARRAY>`
+* `match <MATCH_PATH> size <COMPARATOR> <INT>`
+* `match <MATCH_PATH> include <STRING>`
+* `match <MATCH_PATH> not_include <STRING>`
+* `match <MATCH_PATH> == <AN_ARRAY>`
+* `match <MATCH_PATH> != <AN_ARRAY>`
+
+where:
+
+* `AUGEAS_PATH` is a valid path scoped by the context
+* `MATCH_PATH` is a valid match syntax scoped by the context
+* `COMPARATOR` is one of `>, >=, !=, ==, <=,` or `<`
+* `STRING` is a string
+* `INT` is a number
+* `AN_ARRAY` is in the form `['a string', 'another']`
+
+Default value: ''
+
+##### `changes`
+
+The changes which should be applied to the filesystem. This
+can be a command or an array of commands. The following commands are supported:
+
+* `set <PATH> <VALUE>` --- Sets the value `VALUE` at location `PATH`
+* `setm <PATH> <SUB> <VALUE>` --- Sets multiple nodes (matching `SUB` relative to `PATH`) to `VALUE`
+* `rm <PATH>` --- Removes the node at location `PATH`
+* `remove <PATH>` --- Synonym for `rm`
+* `clear <PATH>` --- Sets the node at `PATH` to `NULL`, creating it if needed
+* `clearm <PATH> <SUB>` --- Sets multiple nodes (matching `SUB` relative to `PATH`) to `NULL`
+* `touch <PATH>` --- Creates `PATH` with the value `NULL` if it does not exist
+* `ins <LABEL> (before|after) <PATH>` --- Inserts an empty node `LABEL` either before or after `PATH`.
+* `insert <LABEL> <WHERE> <PATH>` --- Synonym for `ins`
+* `mv <PATH> <OTHER PATH>` --- Moves a node at `PATH` to the new location `OTHER PATH`
+* `move <PATH> <OTHER PATH>` --- Synonym for `mv`
+* `rename <PATH> <LABEL>` --- Rename a node at `PATH` to a new `LABEL`
+* `defvar <NAME> <PATH>` --- Sets Augeas variable `$NAME` to `PATH`
+* `defnode <NAME> <PATH> <VALUE>` --- Sets Augeas variable `$NAME` to `PATH`, creating it with `VALUE` if needed
+
+If the `context` parameter is set, that value is prepended to any relative `PATH`s.
+
+##### `root`
+
+A file system path; all files loaded by Augeas are loaded underneath `root`.
+
+Default value: /
+
+##### `load_path`
+
+Optional colon-separated list or array of directories; these directories are searched for schema definitions. The agent's `$libdir/augeas/lenses` path will always be added to support pluginsync.
+
+Default value: ''
+
+##### `force`
+
+Optional command to force the augeas type to execute even if it thinks changes
+will not be made. This does not override the `onlyif` parameter.
+
+Default value: `false`
+
+##### `type_check`
+
+Valid values: `true`, `false`
+
+Whether augeas should perform typechecking. Defaults to false.
+
+Default value: `false`
+
+##### `lens`
+
+Use a specific lens, such as `Hosts.lns`. When this parameter is set, you
+must also set the `incl` parameter to indicate which file to load.
+The Augeas documentation includes [a list of available lenses](http://augeas.net/stock_lenses.html).
+
+##### `incl`
+
+Load only a specific file, such as `/etc/hosts`. This can greatly speed
+up the execution the resource. When this parameter is set, you must also
+set the `lens` parameter to indicate which lens to use.
+
+##### `show_diff`
+
+Valid values: `true`, `false`, yes, no
+
+Whether to display differences when the file changes, defaulting to
+true. This parameter is useful for files that may contain passwords or
+other secret data, which might otherwise be included in Puppet reports or
+other insecure outputs. If the global `show_diff` setting
+is false, then no diffs will be shown even if this parameter is true.
+
+Default value: `true`
+