... | ... | @@ -686,6 +686,50 @@ Revocation procedures problems were discussed in [33587][] and [33446][]. |
|
|
|
|
|
5. Run `puppet agent -t` to have puppet running on the client again.
|
|
|
|
|
|
### Generating a batch of resources from Hiera
|
|
|
|
|
|
Say you have a class (let's call it `sbuild::qemu`) and you want it to
|
|
|
generate some resources from a class parameter (and, by extension,
|
|
|
Hiera). Let's call those parameters `sbuild::qemu::image`. How do we
|
|
|
do this?
|
|
|
|
|
|
The simplest way is to just use the `.each` construct and iterate over
|
|
|
each parameter from the class:
|
|
|
|
|
|
```
|
|
|
# configure a qemu sbuilder
|
|
|
class sbuild::qemu (
|
|
|
Hash[String, Hash] $images = { 'unstable' => {}, },
|
|
|
) {
|
|
|
include sbuild
|
|
|
|
|
|
package { 'sbuild-qemu':
|
|
|
ensure => 'installed',
|
|
|
}
|
|
|
|
|
|
$images.each |$image, $values| {
|
|
|
sbuild::qemu::image { $image: * => $values }
|
|
|
}
|
|
|
}
|
|
|
```
|
|
|
|
|
|
That will create, by default, an `unstable` image with the default
|
|
|
parameters defined in `sbuild::qemu::image`. Some parameters could be
|
|
|
set by default there as well, for example:
|
|
|
|
|
|
```
|
|
|
$images.each |$image, $values| {
|
|
|
$_values = $values + {
|
|
|
override => "foo",
|
|
|
}
|
|
|
sbuild::qemu::image { $image: * => $_values }
|
|
|
}
|
|
|
```
|
|
|
|
|
|
Going beyond that allows for pretty complicated rules including
|
|
|
validation and so on, for example if the data comes from an untrusted
|
|
|
YAML file. See this [immerda snippet](https://code.immerda.ch/immerda/puppet-modules/webhosting/-/blob/6514c36043679d0ddbb49e2cdd237d921146feeb/manifests/common.pp#L428-463) for an example.
|
|
|
|
|
|
## Deployments
|
|
|
|
|
|
### Listing all hosts under puppet
|
... | ... | |