我试图运行puppet来configuration虚拟机。 它失败的命令是Exec。
exec { 'configure openssl-arm': logoutput => on_failure, loglevel => verbose, command => '/opt/openssl-1.0.1g/Configure dist --prefix=/opt/openssl-1.0.1g/armbuild', cwd => '/opt/openssl-1.0.1g', user => root, environment => 'CC=arm-axis-linux-gnueabi-gcc' }
我很有信心,这更像是一个傀儡问题。
我试图运行的命令是通过exec 。 如果我stream浪ssh,我可以手动运行命令。
puppet: err:/ Stage [main] //执行[configurationopenssl-arm] /返回:从notrun改为0失败:/opt/openssl-1.0.1g/Configure dist –prefix = / opt / openssl-1.0。 1g / armbuild在/tmp/vagrant-puppet-6/manifests/default.pp:36返回1而不是[0]中的一个
手册 :
local> vagrant ssh vagrant@precise32 > sudu su root@precise32 > export CC=arm-axis-linux-gnuabi-gcc root@precise32 > /opt/openssl-1.0.1g/Configure dist --prefix=/opt/openssl-1.0.1g/armbuild .... .... lots of output .... root@precise32 > echo $? 0
sudo木偶申请
debug: /Schedule[hourly]: Skipping device resources because running on a host debug: Exec[configure openssl-arm](provider=posix): Executing '/opt/openssl-1.0.1g/Configure dist --prefix=/opt/openssl-1.0.1g/armbuild' debug: Executing '/opt/openssl-1.0.1g/Configure dist --prefix=/opt/openssl-1.0.1g/armbuild' err: /Stage[main]//Exec[configure openssl-arm]/returns: change from notrun to 0 failed: /opt/openssl-1.0.1g/Configure dist --prefix=/opt/openssl-1.0.1g/armbuild returned 1 instead of one of [0] at /tmp/build.pp:1 debug: /Schedule[never]: Skipping device resources because running on a host debug: /Schedule[weekly]: Skipping device resources because running on a host debug: /Schedule[puppet]: Skipping device resources because running on a host debug: Finishing transaction -613771238
stream浪盒子 https://drive.google.com/file/d/0B7B7RIseycQkTGxXczRqVGdDVGs/edit?usp=sharing
听起来像更多的环境变量是需要运行你的脚本,不会出现在木偶运行; 我曾经遇到与Maven构建脚本相同的问题。 编辑你的Exec命令以在构建命令之前获得你的配置文件,所以最终的“脚本”运行如下所示:
#!/bin/bash source $HOME/.bash_profile export CC=arm-axis-linux-gnuabi-gcc /opt/openssl-1.0.1g/Configure dist .......
所以,在傀儡术语中:
exec { 'configure openssl-arm': command => 'source $HOME/.bash_profile; /opt/openssl-1.0.1g/Configure dist --prefix=/opt/openssl-1.0.1g/armbuild', cwd => '/opt/openssl-1.0.1g', user => root, environment => 'CC=arm-axis-linux-gnueabi-gcc' }
另外,不要忘记检查脚本返回的实际值。 也许它正在运行,但由于某种神秘的原因返回非零。 这不是我第一次用Puppet部署一个包,由于“状态”命令执行不当,服务初始化脚本需要一些后期调整。