- Puppet 2.7 Cookbook
- John Arundel
- 252字
- 2021-04-02 18:19:59
Producing automatic HTML documentation
"An expert is someone who is one page ahead of you in the manual."—David Knight
Like most engineers, I never read the manual, unless and until the product actually catches fire. However, as your manifests get bigger and more complex, it can be helpful to create HTML documentation for your nodes and classes using Puppet's automatic documentation tool, puppet doc
.
How to do it…
Run puppet doc
over your manifest as follows:
puppet doc --all --outputdir=/var/www/html/puppet --mode rdoc --manifestdir=/etc/puppet/manifests/

How it works…
puppet doc
creates a structured HTML documentation tree in /var/www/html/puppet
similar to that produced by RDoc, the popular Ruby documentation generator. This makes it easier to understand how different parts of the manifest relate to one another, as you can click on an included class name and see its definition.
There's more…
puppet doc
will generate basic documentation of your manifests as they are at present. However, you can include more useful information by adding comments to your manifest files, using the standard RDoc syntax. Here's an example of some documentation comments added to a class:
class puppet { # This class sets up the Puppet client. # # ==Actions # Install a cron job to run Puppet. # # ==Requires # * Package["puppet"] # cron { "run-puppet": command => "/usr/sbin/puppet agent --test >/dev/null 2>&1", minute => inline_template("<%= hostname.hash.abs % 60 %>"), } }
Your comments are added to the documentation for each class in the resulting HTML files as shown in the following screenshot:

- ANSYS 14熱力學·電磁學·耦合場分析自學手冊
- CoffeeScript Application Development
- 好的PPT會說話:如何打造完美幻燈片
- MLOps實戰(zhàn):機器學習模型的開發(fā)、部署與應用
- BIM與Unity 3D開發(fā)實例詳解
- 中文版Photoshop CS6全能一本通·全彩版
- IT Inventory and Resource Management with OCS Inventory NG 1.02
- 中文版Photoshop CC平面設(shè)計實用教程
- Unity 3 Game Development Hotshot
- Moodle 2.0 for Business Beginner's Guide
- Microsoft Dynamics Sure Step 2010
- jQuery 1.3 with PHP
- Alfresco 3 Cookbook
- SAI+Photoshop漫畫繪制技法從入門到精通(第2版)
- UG NX 9.0模具設(shè)計工廠實訓