chef

How to move/copy files locally with Chef

给你一囗甜甜゛ 提交于 2019-12-17 10:25:15
问题 I haven't yet come across a Chef resource that will copy/move files locally. For example, I want to download jetty hightide and unzip it. Once done, copy all the files into a particular folder, like this: # mv /var/tmp/jetty-hightide-7.4.5.v20110725/* /opt/jetty/ BTW, jettyhightide when unzipped, gives you a folder and inside that folder rest of the files are located. Hence unzip jetty-hightide-7.4.5.v20110725.zip -d /opt/jetty/ is useless because it will create a directory /opt/jetty/jetty

How can I change a file with Chef?

人盡茶涼 提交于 2019-12-17 07:18:28
问题 I have 7 files and 1 war. I need to change values when I deploy them. I have this: ##usuario #alfresco.user=***** alfresco.user=******** ##pass #alfresco.password= sfsfs alfresco.password=sfgsf alfresco.rutaAnexos=/gthtfdh/dfgdf/cm: #atributo.type.anexo=ANEXO_INFO_OBJETO atributo.type.anexo=AN atributo.type.observaciones=OBSERVACIONES I need to comment some lines and uncomment some other lines. Then I need to make seven templates and put variables depending on the environments and create a

Compile time vs. run time in Chef recipes

岁酱吖の 提交于 2019-12-17 06:41:31
问题 I have the following (simplified) recipe called java, to install Java of course. File recipes/default.rb include_recipe "install_java" File recipes/install_java.rb # Install RPM from yum repo via yum_install library function yum_install("jdk1.7.0_51") # List the directories in /usr/java jdk_dir = `ls -ld /usr/java/jdk1.* | sort | tail -1` if jdk_dir.empty? raise "Missing JDK installation" end When I run the recipe by "chef-client -o recipe[java]" Synchronizing Cookbooks: - java Compiling

Handling multiple node by Chef

試著忘記壹切 提交于 2019-12-14 03:20:06
问题 Example, I have 1 recipe file, 5 target nodes. How do I apply the recipe file to all the target node? Any commands I need to use or ? I'm not aiming to go into each and every target node to run the chef-client, my aim is to maybe by just single command or using other methods to get this done. If you know how, do comment and give some reference answer as well. Thank you. 回答1: You can run chef-client on multiple nodes via knife ssh command like: knife ssh "role:app" "sudo chef-client" -x myuser

How to run shell command before kitchen converge in chef?

。_饼干妹妹 提交于 2019-12-14 02:53:36
问题 I am using vagrant driver and virtualbox provider for testing serverspec. I need to execute some application related script before executing kitchen converge. I have tried using vagrant provisioning, but I am trying to keep application configuration separately from vagrant configuration. Is there any way where we can pass some commands to .kitchen.yml file in kitchen? to execute some commands before converging cookbooks. 回答1: If you are trying to run the command on the host system there is

chef cookbook delivery - chef server vs. artifactory + berkshelf

给你一囗甜甜゛ 提交于 2019-12-14 02:46:14
问题 My company has been making a significant investment in Chef. We've built up a respectable library of cookbooks to automate our infrastructure. We've purposefully ignored Chef Server and the problem of cookbook sharing because we wanted to get some critical mass in our cookbooks first in order to drive how we solve that. Now we are there and we're exploring options. We already have a large investment in Artifactory and we're happily using it to store pretty much everything that comes out of

WARNING: Failed to connect to ip-xxx-xx-xx-xx

自古美人都是妖i 提交于 2019-12-14 02:43:57
问题 Error: FATAL: # nodes found, but does not have the required attribute to establish the connection. Try setting another attribute to open the connection using --attribute. The issue I'm having started with attempting to run a command using the chef knife command. The intent is to have the command run on any server part of the role as you'll see. So, when I run the command I get the following I get the following knife ssh "role:servers" "touch /home/ubuntu/file.txt" WARNING: Failed to connect

Chef Selenium: rubyzip failure to allocate memory issue on Windows Server 2008

二次信任 提交于 2019-12-14 02:32:42
问题 On Windows Server 2008 & 2008R2 the following exception occurs: ================================================================================ Error executing action `install` on resource 'chef_gem[rubyzip]' ================================================================================ Mixlib::ShellOut::ShellCommandFailed ------------------------------------ Expected process to exit with [0], but received '1' ---- Begin output of C:/opscode/chef/embedded/bin/gem install rubyzip -q --no

Using the `$` character in `ruby_block` in chef

妖精的绣舞 提交于 2019-12-13 22:55:07
问题 I want to use the following code in my recipe for ruby_block , but it's not working because of the '$' . The code cannot find $NAME , but it can find NAME . Can you give me a solution? file.search_file_replace_line("DEFAULT=/etc/default/$NAME","DEFAULT=/etc/default/tomcat7") 回答1: search_file_replace_line expects regex as the first argument. And dollar sign is a special symbol within the regular expressions, it means end of the line, basically. So you have to properly escape it if you really

How can I write a chef recipe to create a new user and password in the Nodes automatically?

你离开我真会死。 提交于 2019-12-13 22:26:30
问题 I'm new to chef. Kindly help! I have tried this user "newuser" do password: xyz end and user 'newuser' do comment 'A random user' uid '1234567' gid '1234567' home '/home/saxuser' shell '/bin/bash' password 'newpassword' end 回答1: The correct format for the user resource is the following: user "newuser" do password crypt_password end Keep in mind that the password must be in shadow format: The password shadow hash. This property requires that ruby-shadow be installed. This is part of the Debian