- #!/bin/sh
- #auto install puppet client
- #wugk 2012-11-30
- #PUPPET_SERVER=192-9-117-160-app.com
- #此脚本为客户端安装,同时包含服务器端安装,根据实际需求修改即可。
- cat <<EOF
- ++++++++++++++++++++welcome to use auto install puppet ++++++++++++++++++
- +++++++++-----------------------------------------------+++++++++++++++++
- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- EOF
- #安装ruby及相关库支持
- echo "Please waiting ruby soft ........"
- rpm -ivh compat-readline5-5.2-17.1.el6.x86_64.rpm ruby-libs-1.8.7.352-7.el6_2.x86_64.rpm ruby-1.8.7.352-7.el6_2.x86_64.rpm ruby-devel-1.8.7.352-7.el6_2.x86_64.rpm
-
- echo
- echo
- #定义客户端安装函数client,即定义client命令
- client ()
-
- {
- echo "Now install puppet client rpm -ivh puppet-2.7.20-1.el6.noarch.rpm"
-
- #安装facter源码包,主要用于检测客户端本机信息,例如主机名、ip、内存等信息
- ####now install facter soft
- tar xzf facter-1.6.8.tar.gz ;cd facter-1.6.8/ ;/usr/bin/ruby install.rb
-
- #安装puppet客户端程序,这里采用rpm包安装方式
- cd ../; rpm -ivh --nodeps puppet-2.7.20-1.el6.noarch.rpm
-
- #配置config puppet puppet_Server可以手动输入,也可以指定变量
- ####sed auto puppet config
- read -p "Please insert puppet server address:" PUPPET_SERVER
- sed -i 's/^#PUPPET/PUPPET/g' /etc/sysconfig/puppet
-
- #指定服务端主机名,并配置监听端口、允许认证
- grep $PUPPET_SERVER /etc/sysconfig/puppet ;[ $? -ne 0 ]&&sed -i "/PUPPET_SERVER/s/puppet/$PUPPET_SERVER/g" /etc/sysconfig/puppet grep listen /etc/puppet/puppet.conf ;[ $? -ne 0 ]&&echo " listen = true" >> /etc/puppet/puppet.conf
- tail -2 /etc/puppet/auth.conf |grep "allow *" ;[ $? -ne 0 ]&&echo "allow *" >> /etc/puppet/auth.conf
- echo -e "[puppetrunner]\nallow * " >/etc/puppet/namespaceauth.conf
- #配置puppet master服务器端主机名和客户端本地主机名,获取本机的ip信息,并加入/etc/hosts中
- grep $PUPPET_SERVER /etc/hosts ;[ $? -ne 0 ] &&echo "`echo $PUPPET_SERVER|awk -F- '{print $1"."$2"."$3"."$4}'` $PUPPET_SERVER" >>/etc/hosts
-
- echo +++++++++++++++++++++++++++++++++++++++++++++++++++++
- ETH=`ifconfig |grep Bcast|cut -d: -f 2|awk '{print $1}'`
- echo "Please insert PUPPET_SERVER /etc/hosts :: $ETH `echo $ETH|sed 's/\./-/g'`-app.com"
-
- cat /etc/hosts |grep -v 127 |grep $ETH ;[ $? -ne 0 ] &&echo "$ETH `echo $ETH|sed 's/\./-/g'`-app.com" >>/etc/hosts
- echo "The puppet is install puppet ,please exec puppet agent --server=$PUPPET_SERVER --test"
- HOSTNAME=`echo $ETH|sed 's/\./-/g'`-app.com
- hostname $HOSTNAME
- cat /etc/hosts|grep 127.0.0.1|grep $HOSTNAME ;[ $? -ne 0 ] &&sed -i "s/127.0.0.1/127.0.0.1 $HOSTNAME/" /etc/hosts
- rm -rf facter-1.6.8
-
- } #定义服务器端安装函数server,即定义server命令
- server ()
-
- {
- echo "Now install puppet client rpm -ivh puppet-2.7.20-1.el6.noarch.rpm"
- #安装puppet master、mongrel支持Nginx+多端口puppetmaster负载均衡
- rpm -ivh --nodeps puppet-server-2.7.20-1.el6.noarch.rpm puppet-2.7.20-1.el6.noarch.rpm
- rpm -ivh --nodeps ruby-irb-1.8.7.352-7.el6_2.x86_64.rpm
- rpm -ivh --nodeps ruby-rdoc-1.8.7.352-7.el6_2.x86_64.rpm
- rpm -ivh --nodeps rubygem-daemons-1.0.10-2.el6.noarch.rpm
- rpm -ivh --nodeps rubygem-fastthread-1.0.7-2.el6.x86_64.rpm
- rpm -ivh --nodeps rubygem-gem_plugin-0.2.3-3.el6.noarch.rpm
- rpm -ivh --nodeps rubygem-mongrel-1.1.5-3.el6.x86_64.rpm
- rpm -ivh --nodeps rubygem-rake-0.8.7-2.1.el6.noarch.rpm
- rpm -ivh --nodeps rubygems-1.3.7-1.el6.noarch.rpm
- #安装facter
- ####now install facter soft
- tar xzf facter-1.6.8.tar.gz ;cd facter-1.6.8/ ;/usr/bin/ruby install.rb
-
- ####sed auto puppet config
- echo
- read -p "Please insert puppet server address:" PUPPET_SERVER
-
- grep listen /etc/puppet/puppet.conf ;[ $? -ne 0 ]&&echo " listen = true" >> /etc/puppet/puppet.conf
- grep autosign /etc/puppet/puppet.conf ;[ $? -ne 0 ]&&sed -i '/ssldir/a\ autosign = true' /etc/puppet/puppet.conf
- tail -2 /etc/puppet/auth.conf |grep "allow *" ;[ $? -ne 0 ]&&echo "allow *" >> /etc/puppet/auth.conf
- tail -1 /etc/sysconfig/puppetmaster |grep "mongrel";[ $? -ne 0 ]&& echo -e "PUPPETMASTER_PORTS=( 18140 18141 18142 18143 18144 )\nPUPPETMASTER_EXTRA_OPTS=\"-servertype=mongrel --ssl_client_header=HTTP_X_SSL_SUBJECT\"" >>/etc/sysconfig/puppetmaster
-
- #配置puppet master 、Hosts
-
- grep $PUPPET_SERVER /etc/hosts ;[ $? -ne 0 ] &&echo "`echo $PUPPET_SERVER|awk -F- '{print $1"."$2"."$3"."$4}'` $PUPPET_SERVER" >>/etc/hosts
-
- echo +++++++++++++++++++++++++++++++++++++++++++++++++++++
- echo
-
- ETH=`ifconfig |grep Bcast|cut -d: -f 2|awk '{print $1}'`
- echo "Please insert PUPPET_SERVER /etc/hosts :: $ETH `echo $ETH|sed 's/\./-/g'`-app.com"
- cat /etc/hosts |grep -v 127 |grep $ETH ;[ $? -ne 0 ] && echo "$ETH `echo $ETH|sed 's/\./-/g'`-app.com" >>/etc/hosts
-
- HOSTNAME=`echo $ETH|sed 's/\./-/g'`-app.com
- hostname $HOSTNAME
- cat /etc/hosts|grep 127.0.0.1|grep $HOSTNAME ;[ $? -ne 0 ] &&sed -i "s/127.0.0.1/127.0.0.1 $HOSTNAME/" /etc/hosts
- cd ../ ;rm -rf facter-1.6.8
-
- }
- #如下case条件语句可以选用,这里仅供参考,真实安装去掉函数定义和case方式即可。
- ###config case select
- #$1表示第一个参数
- case $1 in
-
- client )
- client
- ;;
- server )
- server
- ;;
- * )
- echo "Please exec $0 { client or server }"
- ;;
-
- esac
此脚本仅供参考,欢迎大家多交流! 很好奇,就使用rubyonrails自动化单元测试而言,你们正在做什么?您是否创建了一个脚本来在cron中运行rake作业并将结果邮寄给您?git中的预提交Hook?只是手动调用?我完全理解测试,但想知道在错误发生之前捕获错误的最佳实践是什么。让我们理所当然地认为测试本身是完美无缺的,并且可以正常工作。下一步是什么以确保他们在正确的时间将可能有害的结果传达给您? 最佳答案 不确定您到底想听什么,但是有几个级别的自动代码库控制:在处理某项功能时,您可以使用类似autotest的内容获得关于哪些有效,哪些无效的即时反馈。要确保您的提
我想为Heroku构建一个Rails3应用程序。他们使用Postgres作为他们的数据库,所以我通过MacPorts安装了postgres9.0。现在我需要一个postgresgem并且共识是出于性能原因你想要pggem。但是我对我得到的错误感到非常困惑当我尝试在rvm下通过geminstall安装pg时。我已经非常明确地指定了所有postgres目录的位置可以找到但仍然无法完成安装:$envARCHFLAGS='-archx86_64'geminstallpg--\--with-pg-config=/opt/local/var/db/postgresql90/defaultdb/po
我正在寻找执行以下操作的正确语法(在Perl、Shell或Ruby中):#variabletoaccessthedatalinesappendedasafileEND_OF_SCRIPT_MARKERrawdatastartshereanditcontinues. 最佳答案 Perl用__DATA__做这个:#!/usr/bin/perlusestrict;usewarnings;while(){print;}__DATA__Texttoprintgoeshere 关于ruby-如何将脚
我打算为ruby脚本创建一个安装程序,但我希望能够确保机器安装了RVM。有没有一种方法可以完全离线安装RVM并且不引人注目(通过不引人注目,就像创建一个可以做所有事情的脚本而不是要求用户向他们的bash_profile或bashrc添加一些东西)我不是要脚本本身,只是一个关于如何走这条路的快速指针(如果可能的话)。我们还研究了这个很有帮助的问题:RVM-isthereawayforsimpleofflineinstall?但有点误导,因为答案只向我们展示了如何离线在RVM中安装ruby。我们需要能够离线安装RVM本身,并查看脚本https://raw.github.com/wayn
我有一个奇怪的问题:我在rvm上安装了rubyonrails。一切正常,我可以创建项目。但是在我输入“railsnew”时重新启动后,我有“程序'rails'当前未安装。”。SystemUbuntu12.04ruby-v"1.9.3p194"gemlistactionmailer(3.2.5)actionpack(3.2.5)activemodel(3.2.5)activerecord(3.2.5)activeresource(3.2.5)activesupport(3.2.5)arel(3.0.2)builder(3.0.0)bundler(1.1.4)coffee-rails(
我刚刚为fedora安装了emacs。我想用emacs编写ruby。为ruby提供代码提示、代码完成类型功能所需的工具、扩展是什么? 最佳答案 ruby-mode已经包含在Emacs23之后的版本中。不过,它也可以通过ELPA获得。您可能感兴趣的其他一些事情是集成RVM、feature-mode(Cucumber)、rspec-mode、ruby-electric、inf-ruby、rinari(用于Rails)等。这是我当前用于Ruby开发的Emacs配置:https://github.com/citizen428/emacs
我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e
我有一个在Linux服务器上运行的ruby脚本。它不使用rails或任何东西。它基本上是一个命令行ruby脚本,可以像这样传递参数:./ruby_script.rbarg1arg2如何将参数抽象到配置文件(例如yaml文件或其他文件)中?您能否举例说明如何做到这一点?提前谢谢你。 最佳答案 首先,您可以运行一个写入YAML配置文件的独立脚本:require"yaml"File.write("path_to_yaml_file",[arg1,arg2].to_yaml)然后,在您的应用中阅读它:require"yaml"arg
我的最终目标是安装当前版本的RubyonRails。我在OSXMountainLion上运行。到目前为止,这是我的过程:已安装的RVM$\curl-Lhttps://get.rvm.io|bash-sstable检查已知(我假设已批准)安装$rvmlistknown我看到当前的稳定版本可用[ruby-]2.0.0[-p247]输入命令安装$rvminstall2.0.0-p247注意:我也试过这些安装命令$rvminstallruby-2.0.0-p247$rvminstallruby=2.0.0-p247我很快就无处可去了。结果:$rvminstall2.0.0-p247Search
我实际上是在尝试使用RVM在我的OSX10.7.5上更新ruby,并在输入以下命令后:rvminstallruby我得到了以下回复:Searchingforbinaryrubies,thismighttakesometime.Checkingrequirementsforosx.Installingrequirementsforosx.Updatingsystem.......Errorrunning'requirements_osx_brew_update_systemruby-2.0.0-p247',pleaseread/Users/username/.rvm/log/138121