Created
April 22, 2011 23:27
-
-
Save kwilczynski/937936 to your computer and use it in GitHub Desktop.
Accessing fact from Facter within Puppet manifest ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # The following monstrosity ... | |
| define partitions { | |
| $fact = "partitions_${name}" | |
| $result = split(inline_template("<%= scope.lookupvar(fact) %>"), ',') | |
| notice $result | |
| partition { $result: } | |
| } | |
| define partition { | |
| notice $name | |
| } | |
| $available_disks = split($disks, ',') | |
| partitions { $available_disks: } | |
| # Will produce the following ... | |
| kwilczynski@dev04:~/Development/Sandbox$ FACTERLIB=. puppet test.pp | |
| notice: Scope(Partitions[hda]): hda1 hda2 | |
| notice: Scope(Partition[hda1]): hda1 | |
| notice: Scope(Partition[hda2]): hda2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment