我正在使用 puppet vm 来学习 puppet 教程,并具有以下清单:
# /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!":
}
Run Code Online (Sandbox Code Playgroud)
我的预期输出是:
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!'
Run Code Online (Sandbox Code Playgroud)
我的实际输出是:
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
Run Code Online (Sandbox Code Playgroud)
有人可以解释为什么我的通知被转置了。
谢谢。
小智 5
正如这个 PuppetLabs wiki 页面中关于 Puppet 订购的:
Puppet 可能以任何顺序同步它们:与过程语言不同,清单中资源的物理顺序并不意味着逻辑顺序。
您应该使用 before、require、notify、subscribe 来定义清单中资源之间的依赖关系。此外,您可以通过链接资源引用来定义依赖项。例如:
notify {
"I'm notifying you.":
}
->
notify {
"So am I!":
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
652 次 |
最近记录: |