Declaring dependencies

The easiest way to bring order to such a straightforward manifest is resource chaining. The syntax for this is a simple ASCII arrow between two resources:

package { 'haproxy':  ensure => 'installed',}->file { '/etc/haproxy/haproxy.cfg':  ensure => file,  owner  => 'root',  group  => 'root',  mode   => '0644',  source => 'puppet:///modules/haproxy/etc/haproxy/haproxy.cfg',}->service {'haproxy':  ensure => 'running',}

This is only viable if all the related resources can be written next to each other. In other words, if the graphic representation of the dependencies does not form a straight chain, but more of a tree, star, or any other shape, this syntax is not sufficient.

Internally, Puppet will construct an ordered graph of resources ...

Get Puppet 5 Essentials - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.