- 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:

- AutoCAD 2018實用教程(第5版)
- Photoshop CC實戰從入門到精通
- Photoshop后期強:數碼攝影后期完全寶典
- Lightroom Classic完全自學一本通
- Photoshop CS6中文版基礎培訓教程
- CAD/CAM軟件應用技術
- 中文版Photoshop CC平面設計實用教程
- Photoshop CS6完美創意設計:不一樣的圖像藝術處理
- Plone 3 Intranets
- Solid Edge 機械設計基礎及應用
- After Effects印象 影視高級特效光影篇
- Microsoft SharePoint 2010 and Windows PowerShell 2.0: Expert Cookbook
- 動畫制作基礎(項目教學版)
- 零基礎學Procreate萌物繪
- MSC Fatigue疲勞分析標準教程