From 9642cd7ae24f0ba79ce5647c709b35ae8f06a285 Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Sun, 19 Jan 2025 21:14:51 +0100 Subject: vault backup: 2025-01-19 21:14:51 --- 3 Resources/Puppet/Declaring classes.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 3 Resources/Puppet/Declaring classes.md (limited to '3 Resources/Puppet/Declaring classes.md') diff --git a/3 Resources/Puppet/Declaring classes.md b/3 Resources/Puppet/Declaring classes.md new file mode 100644 index 0000000..793d4b3 --- /dev/null +++ b/3 Resources/Puppet/Declaring classes.md @@ -0,0 +1,27 @@ +--- +tags: + - puppet +references: + - https://www.puppet.com/docs/puppet/7/lang_classes#lang_class_declare +--- +Prefer include over resource-like; more flexible and idempotent. Resource-like to pass args without needing to use hieradata. + +> Mixing declaration types for the same class can lead to compilation errors. + +# Include-like <- preferred +Relies on external data, e.g hieradata, and defaults. +Idempotent: it is only added to the catalog once. + +### `include` +Accepts: single class, class reference (`Class[..]`), comma-seperated list of those or an array of them. + +## `require` +Same as above - but the class becomes a dependency of the container. #clarify dependency. + +## `contain` +Adheres to same rules as above. Relationships of the containing class extend to the contained class. +See [[Containment]]. + +# Resource-like +Can be declared only once. +Must be unique to avoid conflicting parameter values. \ No newline at end of file -- cgit v1.2.3