puppet_device
Version information
This version is compatible with:
- Puppet Enterprise 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
- Puppet > 4.7.0 < 6.0.0
- , , ,
This module has been deprecated by its author since Jun 1st 2018.
The author has suggested puppetlabs-device_manager as its replacement.
Tasks:
- puppet_device
Start using this module
Documentation
puppet_device
Table of Contents
Description
Devices require a proxy Puppet agent to request certificates, collect facts, retrieve and apply catalogs, and store reports. This module manages the configuration file used by the puppet device
command, applies the base class of configured device modules, and provides additional resources for scheduling and orchestrating puppet device
runs on those proxy Puppet agents.
What does this module provide?
- Allows for the configuration devices in
device.conf
via a manifest, the Classifier, and/or Hiera. - Provides an option for scheduling of
puppet device
runs on proxy Puppet agents. - Provides an optional task for direct orchestration of
puppet device
runs on newer proxy Puppet agents. - Provides an option for indirect orchestration of
puppet device
runs on older proxy Puppet agents. - Defines a structured fact that can be used to query PuppetDB to identify the Puppet agent proxying for a device.
- Applies the base class of associated device modules to the proxy Puppet agent.
Usage
Install
On the master(s), install the puppet_device
module:
puppet module install tkishel-puppet_device
Also, install the device-specific module on the master(s):
puppet module install f5-f5
Configure
Devices can be declared either individually via a manifest, or multiple devices can be declared via the Classifier and/or Hiera.
Note: If the same device (identified by name) is declared via the Classifier and Hiera, the Classifier will take precedence.
Declare Individual Resources via a Manifest:
Declare individual puppet_device
resources via a manifest applied to the proxy Puppet agent:
node 'agent.example.com' {
puppet_device {'bigip.example.com':
type => 'f5',
url => 'https://admin:fffff55555@10.0.0.245/',
run_interval => 30,
}
}
Declare Multiple Resources via the Classifier:
Declare multiple puppet_device
resources via the devices
parameter to the puppet_device::devices
class applied to the proxy Puppet agent via the Classifier:
{
'bigip1.example.com' => {
type => 'f5',
url => 'https://admin:fffff55555@10.0.1.245/',
run_interval => 30,
},
'bigip2.example.com' => {
type => 'f5',
url => 'https://admin:fffff55555@10.0.1.245/',
run_interval => 30,
},
}
Also, apply the class of the device-specific module to the proxy Puppet agent via the Classifier.
Declare Multiple Resources via Hiera:
Declare multiple puppet_device
resources via the puppet_device::devices
key applied to the proxy Puppet agent via Hiera:
---
puppet_device::devices:
bigip1.example.com:
type: 'f5'
url: 'https://admin:fffff55555@10.0.1.245/'
run_interval: 30
bigip2.example.com:
type: 'f5'
url: 'https://admin:fffff55555@10.0.2.245/'
run_interval: 30
... and declare the puppet_device::devices
class in a manifest applied to the proxy Puppet agent:
node 'agent.example.com' {
include puppet_device::devices
}
Run puppet device
Declaring these resources will configure device.conf
and apply the base class of associated device modules on the proxy Puppet agent, allowing it to execute puppet device
runs on behalf of its configured devices:
puppet device --user=root --verbose --target bigip.example.com
Parameters
name
Data type: String
This parameter is optional, and defaults to the title of the resource.
Specifies the certname
of the device.
ensure
Data type: String
This parameter is optional, with valid options of 'present' (the default) and 'absent'.
Setting to 'absent' deletes the device from device.conf
and the puppet_devices
fact, and negates the effect of any other parameters.
type
Data type: String
Specifies the type of the device in device.conf
on the proxy Puppet agent.
url
Data type: String
Specifies the URL of the device in device.conf
on the proxy Puppet agent.
credentials
Data type: Hash
This parameter is specific to devices that use the Puppet Resource API.
Specifies the credentials of the device in a HOCON file in confdir/devices
, and sets that file as the URL of the device in device.conf
, on the proxy Puppet agent.
puppet_device {'cisco.example.com':
type => 'cisco_ios',
credentials => {
address => '10.0.1.245',
port => 22,
username => 'admin',
password => 'cisco2600',
enable_password => 'cisco2600',
},
}
debug
Data type: Boolean
This parameter is optional, with a default of false.
Specifies transport-level debugging of the device in device.conf
on the proxy Puppet agent, and is limited to debugging the telnet and ssh transports.
Note: This parameter specifies the debug
property defined in: Config Files: device.conf rather than the --debug
option defined in: Man Page: puppet device.
include_module
Data type: Boolean, with a default of true.
Specifies automatically including the base class (if one is defined) of the associated device module (specified by the type
parameter) on the proxy Puppet agent.
Device modules may implement a base class that applies an install
class. Automatically including that class will automatically install any requirements of the device module.
run_interval
Data type: Integer
This parameter is optional, with a default of 0.
Setting run_interval
to a value between 1 and 1440 will create a Cron (or on Windows, a Scheduled Task) resource for the device that executes puppet device --target
every run_interval
minutes (with a randomized offset) on the proxy Puppet agent. When creating a Cron resource, values greater than thirty minutes will be rounded up to the nearest hour.
puppet_device {'bigip.example.com':
type => 'f5',
url => 'https://admin:fffff55555@10.0.0.245/',
run_interval => 30,
}
Note: On versions of Puppet (lower than Puppet 5.x.x) that do not support puppet device --target
, this parameter will instead create one Cron (or Scheduled Task) resource that executes puppet device
for all devices in device.conf
every 60 minutes (at a randomized minute) on the proxy Puppet agent.
run_via_exec (deprecated)
Data type: Boolean
This parameter is optional, with a default of false.
Setting run_via_exec
to true will create an Exec resource for the device that executes puppet device --target
during each puppet agent
on the proxy Puppet agent. This parameter is deprecated in favor of run_interval
, as run_via_exec
will increase the execution time of a puppet agent
run by the execution time of each puppet device
run.
puppet_device {'bigip.example.com':
type => 'f5',
url => 'https://admin:fffff55555@10.0.0.245/',
run_via_exec => true,
}
Note: On versions of Puppet (lower than Puppet 5.x.x) that do not support puppet device --target
, this parameter will instead create one Exec resource that executes puppet device
for all devices in device.conf
.
Orchestration
Puppet Tasks
On versions of Puppet Enterprise (2017.3.x or higher) that support Puppet Tasks, this module provides a puppet_device
task which can be used by the puppet task
command to orchestrate a puppet device
run on the proxy Puppet agent. Help for this task is available via: puppet task show puppet_device
command.
Examples:
To run puppet device
for all devices in device.conf
on the specified proxy Puppet agent:
puppet task run puppet_device --nodes 'agent.example.com'
To run puppet device
for all devices in device.conf
on the proxy Puppet agent identified by a PuppetDB query:
puppet task run puppet_device --query 'inventory { facts.puppet_devices."bigip.example.com" = true }'
To run puppet device --target
for a specific device in device.conf
on the proxy Puppet agent identified by a PuppetDB query:
puppet task run puppet_device --query 'inventory { facts.puppet_devices."bigip.example.com" = true }' target=bigip.example.com
Puppet Job (deprecated)
On versions of Puppet Enterprise (2017.2.x or lower) that do not support Puppet Tasks, this module provides an run_via_exec
parameter which can be used by the puppet job
command to indirectly orchestrate a puppet device
run via an orchestrated puppet agent
run on the proxy Puppet agent.
Examples:
To run puppet device
for each device with run_via_exec
set to true on the specified proxy Puppet agent:
puppet job run --nodes 'agent.example.com'
To run puppet device
for each device with run_via_exec
set to true on the proxy Puppet agent identified by a PuppetDB query:
puppet job run --query 'inventory { facts.puppet_devices."bigip.example.com" = true }'
Reference
For more information, see:
What are tasks?
Modules can contain tasks that take action outside of a desired state managed by Puppet. It’s perfect for troubleshooting or deploying one-off changes, distributing scripts to run across your infrastructure, or automating changes that need to happen in a particular order as part of an application deployment.
Tasks in this module release
Release 2.5.0
- Add include_module parameter and functionality.
- Prepare for adoption.
Release 2.4.7
- Clarify documentation.
Release 2.4.6
- Allow specifying devices via a classifier and/or Hiera.
- Support the Puppet Resource API and its credential files.
Release 2.4.5
- PDK 1.5
Release 2.4.4
- Add classification guard.
Release 2.4.3
- Add LICENSE to accommodate users who need it in a top-level file.
- Update Puppet documentation URLs.
Release 2.4.2
- Minor changes.
Release 2.4.1
- Namespace custom facts.
- Prefer os.family fact over legacy osfamily fact.
Release 2.4.0
- Specify '--verbose' by default.
- Deprecate 'run_via_exec' parameter
Release 2.3.7
- Use ensure_resource to prevent duplicate resource for facter/facts.s path (credit: Kris Amundson).
Release 2.3.6
- Replace reference to run_via_cron with run_interval (credit: Kris Amundson).
Release 2.3.5
- Minor changes.
Release 2.3.4
- Sanitize
Release 2.3.3
- Rewrite task using methods
- Update run_interval function
Release 2.3.1
- Typo in README.
- Tune run_interval.
Release 2.3.0
- Restore run_interval parameter for cron and scheduled_task.
Release 2.2.0
- Abstract cron and scheduled_task.
- Correct fact location on Windows.
Release 2.1.2
- Added documentation.
- Tuneup cron, and prepare a scheduled_task.
Release 2.1.1
Minor changes.
- Cleanup parameter handling.
Release 2.1.0
Parameter changes.
- Rename the autorun parameter to run_via_exec.
- Implement a beta run_via_cron parameter.
Release 2.0.1
- Fix anchor in README.
- Simplify run.
Summary
Minor changes.
Release 2.0.0
- Add support for tasks.
- Rename the run parameter to autorun.
- Change structured fact format from array to hash.
- Fully qualify the path to the test command.
- Normalize the waitforcert and user parameters of the puppet device command.
Summary
This release adds support for tasks, and uses Puppet Development Kit (PDK).
Release 1.1.1
Summary
Minor changes.
Changed
- Test version to choose between hiera_hash and lookup.
- Use show_diff=false in concat to not log changes to device.conf.
Release 1.1.0
Summary
Minor changes.
Changed
- Use hiera_hash to improve compatibility.
- Use iteration instead of create_resource to improve readability.
Release 1.0.9
Summary
This release allows users to declare devices as a hash of hashes in Hiera.
Features/Improvements
- Implement a CHANGELOG.
- Adds support for declaring devices in Hiera.
Dependencies
- puppetlabs/concat (>= 3.0.0 < 5.0.0)
- puppetlabs/hocon (>= 1.0.0 < 5.0.0)
- puppetlabs/stdlib (>= 4.10.0 < 5.0.0)
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2018 Thomas Kishel Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.