notify资源

notify资源主要用于输出puppet的辅助提示信息,在puppet的执行过程中通过这些辅助信息了解执行的过程,它并不会改变任何操作状态.


参数:

1
2
3
4
5
6
notify { 'resource title':
  name     => # (namevar) An arbitrary tag for your own reference; the...
  message  => # The message to be sent to the...
  withpath => # Whether to show the full object path. Defaults...
  # ...plus any applicable metaparameters.
}


name:标示名.

messages:输出描述信息.

withpath:是否显示完整对象路径。


示例:

1
2
3
4
5
6
[root@sh-web1 ~]# cat notify.pp 
$sum = 8 + 4
notify {"sum":
    message => "${sum}",
    withpath => true,
}


运行结果:

1
2
3
4
5
[root@sh-web1 ~]# puppet apply notify.pp 
Notice: Compiled catalog for sh-web1.localdomain in environment production in 0.05 seconds
Notice: /Stage[main]/Main/Notify[sum]/message: 12
Notice: /Stage[main]/Main/Notify[sum]/message: defined 'message' as '12'
Notice: Finished catalog run in 0.03 seconds