March 2017
Beginner to intermediate
925 pages
18h 11m
English
A neat feature of Puppet's file resource is that you can specify multiple values for the source parameter. Puppet will search them in order. If the first source isn't found, it moves on to the next, and so on. You can use this to specify a default substitute if the particular file isn't present, or even a series of increasingly generic substitutes.
This example demonstrates using multiple file sources:
class greeting {
file { '/tmp/greeting':
source => [ 'puppet:///modules/greeting/hello.txt',
'puppet:///modules/greeting/universal.txt'],
}
}modules/greeting/files/hello.txt with the following contents:Hello, world.
modules/greeting/files/universal.txt ...Read now
Unlock full access