gpt4 book ai didi

puppet - 如何在运行 Puppet 客户端时打印一些内容?

转载 作者:行者123 更新时间:2023-12-03 01:12:54 24 4
gpt4 key购买 nike

我想在 Puppet 运行时打印出消息和变量。我看到有两个功能可能有帮助,但无法真正使用它们。我的 site.pp 文件:

info "running site.pp info"
debug "running site.pp debug"

当我在客户端上运行时:

puppet -t

我没有得到那些指纹。

最佳答案

这是包含所有可用的 puppet 日志功能的 puppet 脚本。

log_levels.pp

node default {
notice("try to run this script with -v and -d to see difference between log levels")
notice("function documentation is available here: http://docs.puppetlabs.com/references/latest/function.html")
notice("--------------------------------------------------------------------------")

debug("this is debug. visible only with -d or --debug")
info("this is info. visible only with -v or --verbose or -d or --debug")
alert("this is alert. always visible")
crit("this is crit. always visible")
emerg("this is emerg. always visible")
err("this is err. always visible")
warning("and this is warning. always visible")
notice("this is notice. always visible")
#fail will break execution
fail("this is fail. always visible. fail will break execution process")

}

脚本输出(在 puppet 2.7 上): different log levels colors

注意:puppet 3.x 颜色可能会改变(所有错误都将以红色打印)!

关于puppet - 如何在运行 Puppet 客户端时打印一些内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4135426/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com