May 2017
Beginner
268 pages
6h 1m
English
Iteration (doing something repeatedly) is a useful technique in your Puppet manifests to avoid lots of duplicated code. For example, consider the following manifest, which creates several files with identical properties (iteration_simple.pp):
file { '/usr/local/bin/task1':
content => "echo I am task1\n",
mode => '0755',
}
file { '/usr/local/bin/task2':
content => "echo I am task2\n",
mode => '0755',
}
file { '/usr/local/bin/task3':
content => "echo I am task3\n",
mode => '0755',
}You can see that each of these resources is identical except for the task numbers—task1, task2, and task3. Clearly this is a lot of typing, and should you later decide to change the properties of these scripts (for example, moving them to a different ...
Read now
Unlock full access