Write data: Set per-operating system data
The second level of the hierarchy uses the os
fact to locate its data file. This means it
can use different data files depending on the operating system of the current
node.
For this example,
suppose that your developers use MacBook laptops, which have an OS family of Darwin
. If a developer is running an
app instance on their laptop, it should not send data to your production backup
server, so set $backups_enabled
to
false
.
If you do not run Puppet on any Mac laptops, choose an OS family that is meaningful to your infrastructure.
- Locate the data file, by replacing
%{facts.os.family}
with the value you are targeting:/etc/puppetlabs/code/environments/production/data/
+os/
+Darwin
+.yaml
- Add the following contents:
# /etc/puppetlabs/code/environments/production/data/os/Darwin.yaml --- profile::hiera_test::backups_enabled: false
- Compile to observe that the override takes effect.
Results
Related topics: the os fact.