puppetpuppetlabs-apache

Is there a way to define relationships between create_resources


In my puppet class i use 3 create_resources. I want to execute these create_resources in order. Thus there are relationships between each other

create_resources(change_config::cr1, $resource)

create_resources(change_config::cr2, $resource)

create_resources(change_config::cr3, $resource)

cr3 should be executed after cr2 and cr2 should be after cr1.

Is there a way to do this ?

Regards, Malintha


Solution

  • You can use Puppet Collectors here. Simply add this line into your manifest:

    Change_config::Cr1<| |> -> Change_config::Cr2<| |> -> Change_config::Cr3<| |>
    

    It will order all Cr1's before 2's before 3s. You can even put extra filtering inside the <| |> like

    Change_config::Cr1<| title == 'some_name' |> -> Change_config::Cr1<| <| title != 'some_name' |>