chef

chef cookbook fails on ohai undefined method `[]' for nil:NilClass

妖精的绣舞 提交于 2019-12-19 08:05:11
问题 I'm working on a chef cookbook to set up a vanilla ubuntu 12.04.2 with nginx postgresql and unicorn on my vagrant box, but I'm getting into troubles with nginx, there's an exception undefined method `[]' for nil:NilClass when installing it that seem to relate to ohai configuration. I've posted all I have here: https://github.com/DonGiulio/mychef here's the output from chef-solo: Starting Chef Client, version 11.4.0 Compiling Cookbooks... =======================================================

Chef: How do I check to see if a service is installed?

試著忘記壹切 提交于 2019-12-19 07:29:23
问题 In a recipe I want to check to see if a service is installed, and if it is not notify the 3 resources needed to install it. I tried the service resource, which correctly identifies the service when it is installed, but throws an exception if the service is not installed. I'm not sure what action to use here. :nothing just skips the resource so it ever get executed, but any of the other actions will error when they attempt to act on a service that doesn't exist. How do I detect whether a

How to specify cookbook path in .kitchen.yml file?

别来无恙 提交于 2019-12-18 18:55:57
问题 I have my Chef cookbooks stored in chef/cookbooks/ folder. When running kitchen converge I am still getting notice Berksfile, Cheffile, cookbooks/, or metadata.rb not found so Chef will run with effectively no cookbooks. Is this intended? I tried many options, for example: suites: - name: default run_list: recipe[git] cookbook_path: "chef/cookbooks" but I can't find the proper solution. How to specify the cookbooks' and roles' paths? 回答1: You'll want to put the path in your berksfile, which

Puppet,Chef,Ansible的共性

前提是你 提交于 2019-12-18 16:03:19
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 本文试图找到类似Puppet、Chef、Ansible这样自动化配置管理工具的共性,以不至于迷失在杂乱的尘世中。总会有各种人为各种目的造 概念 ,来让世界更复杂。 本文同样适用于没有运维经验的人。因为我就是一个没有运维经验的人。欢迎斧正。 与这仨之间的历史 本人接触自动化运维的时间比较晚,也就一年前才知道Puppet及自动化运维(只限于知道),而Chef、Ansible就更晚了。然而在学习它们之前,我对运维要做哪些事情并没有概念。这就对我学习Puppet,Chef和Ansible造成的障碍。因为不知道这三个工具在运维领域的位置,解决运维过程中的哪些问题。我对这三个工具的最初印象就是有了它们,不用我手工的SSH上服务器,然后一条条命令去执行安装软件,不用SCP war包上服务器等,对服务器的操作都可以自动化了。 这个最初印象也就是我跟它们的历史。为什么要说这些呢?就是因为这个最初印象,让我觉得它们是有共性。所谓共性就是存在一些共通的概念或原理之类的东西,掌握这些“东西”,我就可以站在一个更高的高度去思考。Puppet, Chef, Ansible都是工具,对于工具来说,共性指的是它们共同要解决的问题。 但是当我翻了不少文章后依然没有结果。所以,我决定自己去找它们的共性,并记录下来。 自制一个自动化运维工具

Data bag encryption encrypts on Chef server, but how to encrypt local copy?

假如想象 提交于 2019-12-18 15:09:05
问题 I have a full Chef configuration set of roles, cookbooks, databags, etc., in a private git repository. I see that I can use the --secret-file option to encrypt a databag when it's uploaded to the Chef server. But I want to store those databags encrypted in the git repository as well. The only thing that comes to mind is making a plaintext json file locally, uploading it to Chef with encryption, then taking the encrypted JSON from the Chef web page and pasting it into my repository copy. Has

/usr/bin/env ruby_noexec_wrapper fails with no file or directory

前提是你 提交于 2019-12-18 14:52:33
问题 When I try to start chef-solr as service it's failing with the following error # service chef-solr start Starting chef-solr: /usr/bin/env: ruby_noexec_wrapper: No such file or directory [FAILED] But when I run it manually from command line it's running successfully # chef-solr -d -c /etc/chef/solr.rb -L /var/log/chef/solr.log -P /var/run/chef/solr.pid # echo $? 0 # ps -ef | grep chef root 2691 1 12 04:19 ? 00:00:01 java -Xmx256M -Xms256M -Dsolr.data.dir=/var/lib/chef/solr/data -Dsolr.solr

/usr/bin/env ruby_noexec_wrapper fails with no file or directory

拥有回忆 提交于 2019-12-18 14:52:29
问题 When I try to start chef-solr as service it's failing with the following error # service chef-solr start Starting chef-solr: /usr/bin/env: ruby_noexec_wrapper: No such file or directory [FAILED] But when I run it manually from command line it's running successfully # chef-solr -d -c /etc/chef/solr.rb -L /var/log/chef/solr.log -P /var/run/chef/solr.pid # echo $? 0 # ps -ef | grep chef root 2691 1 12 04:19 ? 00:00:01 java -Xmx256M -Xms256M -Dsolr.data.dir=/var/lib/chef/solr/data -Dsolr.solr

how to require my library in chef ruby_block

一笑奈何 提交于 2019-12-18 14:40:24
问题 I'm developing a cookbook to deploy a simple ROR application. I write an app_helper.rb and put it into the libraries directory of my cookbook, here is the content: module AppHelper def self.find_gem if File.exists?("/usr/local/rvm/bin/rvm") return `/usr/local/rvm/bin/rvm default exec which gem`.chomp else return "/usr/bin/gem" end end end In the recipes/default.rb, I mix in the above module into Chef::Recipe class class Chef::Recipe include AppHelper end As you know, the find_gem function can

How to uninstall chef-client and the whole Chef package

天大地大妈咪最大 提交于 2019-12-18 12:49:10
问题 Is uninstalling Chef-Client just as easy as removing the directory, and making sure its not in the rc files? Is there a way to use knife to uninstall chef-client? --2013-06-26_EDIT-- Updating this question to say, how to remove chef and all its other pieces from OS X, and Linux after using 1.) The Omnibus installer, and 2.) A bootstrapped node? Since I was trying to use Chef on my Mac, and had RVM installed, chef would not work, so now, I need to figure out how to remove chef. --2015-03-08

How do I determine the password attribute value for the Chef “user” resource?

天大地大妈咪最大 提交于 2019-12-18 12:22:41
问题 I'm trying to create a user account using Chef 11, and am not sure how to calculate the password attribute's value. I've read the User Resource documentation http://docs.opscode.com/resource_user.html, specifically the section "Password Shadow Hash", and am still unsure what exactly to do. This user is being created on an Ubuntu system, so do I use the openssl example they provided and pass the output of that command as the password attribute value? openssl passwd -1 "theplaintextpassword"