我可以用Puppet运行shell内置命令吗?

前端之家收集整理的这篇文章主要介绍了我可以用Puppet运行shell内置命令吗?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我希望〜/ .bashrc在改变其内容时将成为源码.我用这样的东西创建了一个bashrc类:
file { "/root/.bashrc":
    ensure  => present,owner   => root,group   => root,mode    => 0644,source  => "puppet:///bashrc/root/.bashrc"
}

exec { "root_bashrc":
    command     => "source /root/.bashrc",subscribe   => File["/root/.bashrc"],}

但是如你所知,source是一个shell内置命令,运行代理时出现以下错误

# puppet agent --no-daemonize --verbose
notice: Starting Puppet client version 2.7.1
info: Caching catalog for svr051-4170
info: Applying configuration version '1311563901'
err: /Stage[main]/Bashrc/Exec[root_bashrc]/returns: change from notrun to 0 Failed: Could not find command 'source'
notice: Finished catalog run in 2.28 seconds
notice: Caught INT; calling stop

有没有办法解决这个问题?

在Puppet中重新获取新的.bashrc是没有意义的,因为它将在子shell中运行,并且更改不会传播到您当前的shell(我认为,这是您尝试做的事情).你不能做你想做的事(我想).
原文链接:https://www.f2er.com/bash/385631.html

猜你在找的Bash相关文章