1

I'm using the puppet vm to follow the puppet tutorial, and have the following manifest:

# /root/learning-manifests/2.file.pp

file {
  '/tmp/test1':
  ensure        => present,
  content => "Hi.",
}

file {
  '/tmp/test2':
  ensure     => directory,
  mode => 0644,
}

file {
  '/tmp/test3':
  ensure       => link,
  target => '/tmp/test1',
}

notify {
  "I'm notifying you.":
}

notify {
  "So am I!":
}

My expected output is:

notice: I'm notifying you.
notice: /Stage[main]//Notify[I'm notifying you.]/message: defined 'message' as 'I'm notifying you.'
notice: So am I!
notice: /Stage[main]//Notify[So am I!]/message: defined 'message' as 'So am I!'

My actual output is:

notice: So am I!
notice: /Stage[main]//Notify[So am I!]/message: defined 'message' as 'So am I!'
notice: I'm notifying you.
notice: /Stage[main]//Notify[I'm notifying you.]/message: defined 'message' as 'I'm notifying you.'
notice: Finished catalog run in 0.06 seconds

Can someone please explain why my notices are transposed.

Thanks.

2 Answers 2

5

As written in this PuppetLabs wiki page about Puppet ordering:

Puppet might sync them in any order: unlike with a procedural language, the physical order of resources in a manifest doesn’t imply a logical order.

You should use before, require, notify, subscribe to define dependencies between resources in your manifests. Also, you can define your dependencies by chaining your resource references. E.g:

notify {
  "I'm notifying you.":
}
-> 
notify {
  "So am I!":
}
1
  • Ordering came later in the tutorial - thanks for the example
    – Romski
    Dec 22, 2012 at 12:11
1

To guarantee order of execution in puppet you need to have some class hierarchy.

Definitions inside single class can be executed in any order, you cannot influence that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .