chef

How to use chef to update-alternatives for java using execute?

倾然丶 夕夏残阳落幕 提交于 2019-11-30 07:39:33
问题 I am having syntax errors and I am unsure how to resolve them. In the roles file I have defined the fallowing: default_attributes( 'jdk' => { 'version' => '1.8.0_31' }, 'java' => { 'home' => '/usr/lib/jvm/jdk1.8.0_31' }, ) I try to use the java home in the following, but it fails to run execute "update_alt_java" do command "update-alternatives --install "/usr/bin/java" "java" "#{node['java']['home']}/bin/java" 1" action :creates end I get the following error SyntaxError ----------- /etc/chef

Access Node attributes in Chef Library

主宰稳场 提交于 2019-11-30 05:14:45
I'd like to create a Chef library that: Provides a few namespaced functions Accesses the node's attributes That library is meant to interface with an external system and retrieve some inputs from there. I need to access the node attributes to allow the user to override the inputs received from the external system: Desired Usage (Recipe) inputs = MyLib.get_inputs Library (What I have now) This is inspired by those docs . class Chef::Recipe::MyLib def self.get_inputs override_inputs = node.fetch(:mylib, Hash.new).fetch(:override_inputs, nil) unless override_inputs.nil? return override_inputs end

Chef wrapper cookbook best practices

為{幸葍}努か 提交于 2019-11-30 05:12:35
问题 In learning chef, I see conflicting patterns for wrapper cookbooks. For example. Some cookbooks use default.rb and others use customize.rb for overrides. attributes/default.rb attributes/customize.rb Which is best practice? Also, some wrapper cookbooks have parameters like this, in the recipes/default.rb file : normal['foo']['bar'] = 42 Whereas others have default['foo']['bar'] = 42 And some have node.set['foo']['bar'] = 42 Additionally some cookbooks use symbols, and other strings ['foo'][

use ssh keys with passphrase on a vagrant+chef setup

风格不统一 提交于 2019-11-30 04:57:38
I've got a vm running using vagrant, and I'm provisioning it with Chef. One of the steps involves cloning a git repo, but my ssh-key (on my host machine) has a passphrase on it. When I run vagrant up , the process fails at the git clone step with the following error: Permission denied (publickey). fatal: The remote end hung up unexpectedly (The key has been added on the host machine, with the passphrase) I tried to solve this with ssh agent forwarding by doing the following: Added config.ssh.forward_agent = true to the VagrantFile Added Defaults env_keep = "SSH_AUTH_SOCK to /etc/sudoers on the

What does `Chef::Config[:file_cache_path]` do exactly?

吃可爱长大的小学妹 提交于 2019-11-30 04:33:12
First off, I apologize for asking such a dumb question. But the reason I ask is because I'm having a hard time finding an answer. I've tried searching Chef's docs, but I have not found a clear explanation. So what exactly does Chef::Config[:file_cache_path] provide? I've read that its better to use this instead of harding coding a filepath. But what does it evaluate to? In this particular snippet newrelic_agent = Chef::Config[:file_cache_path] + '/rewrelic_nginx_agent.tar.gz' remote_file newrelic_agent do source 'http://nginx.com/download/newrelic/newrelic_nginx_agent.tar.gz' mode "0744" end

Chef chef-validator.pem security

◇◆丶佛笑我妖孽 提交于 2019-11-30 03:43:41
问题 Hi I am setting up a cluster of machines using chef at offsite locations. If one of these machines was stolen, what damage can the attacker do to my chef-server or other nodes by having possession of chef-validator.pem ? What other things can they access through chef? Thanks! 回答1: This was one of the items discussed at a recent Foodfight episode on managing "secrets" in chef. Highly recommended watching: http://foodfightshow.org/2013/07/secret-chef.html The knife bootstrap operation uploads

Adding Attributes to Test Kitchen

眉间皱痕 提交于 2019-11-30 03:21:37
问题 I'm trying to override attributes in the java cookbook with test-kitchen. When I try run kitchen converge default-centos-64 , a bad YAML error shows up. --- driver: name: vagrant customize: memory: 1024 cpuexecutioncap: 50 provisioner: name: chef_solo platforms: - name: centos-6.4 suites: - name: default run_list: - recipe[java::default] - recipe[maven::default] attributes: { java.install_flavor: "oracle", java.jdk_version: "7" } I pasted the above into http://yamllint.com/. When I hit "Go,"

Chef on Vagrant Box: Can't find encrypted data bag secret

回眸只為那壹抹淺笑 提交于 2019-11-30 03:16:48
When provisioning a vagrant box with (hosted-)chef I get the following error: No such file or directory - file not found '/tmp/encrypted_data_bag_secret' Here is the call causing the error: ssl = Chef::EncryptedDataBagItem.load("ssl", s[:id]) I also can't find the encrypted_data_bag_secret in /etc/chef where it normally resides on my other servers. Am I missing a config which uploads the data bag secret? Here's the rest of the stack trace: [2013-02-14T16:51:15+00:00] ERROR: Running exception handlers [2013-02-14T16:51:15+00:00] FATAL: Saving node information to /srv/chef/file_store/failed-run

20款开发运维必备的顶级工具

你离开我真会死。 提交于 2019-11-30 01:55:17
开发运维工具与软件开发领域的最佳实践密切相关,也与必要的规范密切相关。在整个开发生命周期涉及到一大批新旧工具,从规划、编码、测试、发布到监控。本文介绍你应该考虑添加到工具箱中的20种开发运维工具,供大家参考。 开发运维是那些还没有得到明确定义,就流传开来的科技时髦词之一。这种情况时不时出现,某个好的概念问世后,人们还无法实际上解释它为何物,就趋之若鹜。 所以,考虑到开发运维本身在大家的头脑中还是一片模糊,开发运维工具怎么样呢? 有必要说清一点:开发运维是开发和运维的混合体,因为它代表了开发实践方面的文化变化,非开发人员也参与到软件开发过程中。开发人员之外的IT专业人员参与到构建应用程序的协作和沟通过程,让产品开发完毕后使用产品的人有机会在开发过程中,而不是在开发结束后,对应用程序的构建发表意见。 成熟的开发运维环境往往遵循一种常见模式:一种灵活的软件定义平台上的迭代自动化。所以,许多开发运维工具采用了某种迭代动作。采用开发运维工具的 成功的流程既需要公司里面的文化变化,又需要实现这种变化的新工具。这意味着,在整个开发生命周期涉及到一大批新旧工具,从规划、编码、测试、发布到监 控。下面是你应该考虑添加到工具箱中的20种开发运维工具,但绝不是全部。 1.Jira Software 来自Altassian的JIRA软件是一款流行的软件开发工具,用于开发运维的一个关键部分:敏捷开发

How do you abort/end a Chef run?

懵懂的女人 提交于 2019-11-29 19:51:33
Under certain conditions, I need to abort/end a Chef run with a non-zero status code, that will then propagate back through our deployment chain and eventually to Jenkins resulting in a big, fat red ball. What is the best way to do this? For the readers coming to this question and answer in the future that may not be familiar with Chef, a Chef run "converges" the node, or brings it in line with the policy declared in the recipe(s) it is running. This is also called "convergence." This has two phases, "compile" and "execute." The compile phase is when Chef evaluates ("compiles") the recipes'