chef

Vagrant - how to print Chef's command output to stdout?

旧时模样 提交于 2019-12-06 02:26:05
问题 If we have in Chef cookbook code like: if !File.exists?('/vagrant/project/target/project/WEB-INF") || node[:compile_project] bash "build project" do user "vagrant" cwd "/vagrant/project" code <<-EOH mvn clean mvn db-migration:migrate mvn package EOH end end When run vagrant up we can see only brief information that 'build project' is executed. However wen we run 'mvn package' command from terminal we can see full command output. How to tell Vagrant/Chef to show full output? EDIT: I've tried

How to I get a chef custom lwrp to implement notifies and not_if?

℡╲_俬逩灬. 提交于 2019-12-06 02:26:01
I write a custom Lightweight resource. But the notifies and only_if is not recognized. Anyone else get this working? I use these in opsworks supplies resources. So I know I am using them correctly. Unfortunately proprietary code, so I can't post the code. Ok. RTFM. Well not really. I did not find this specific issue covered. If you write your own light weight resource and want to be able to use notifies, then use new_resource.updated_by_last_action(false) or new_resource.updated_by_last_action(true) in your resource action code. notifies will then happen (true) or not happen(false). Here is an

How to specify cookbook path in .kitchen.yml file for chef_solo provisioner?

吃可爱长大的小学妹 提交于 2019-12-06 01:48:28
I want to specify cookbook paths using chef_solo as a provisioner in Test Kitchen. We are not using Berkshelf or chef_zero at this time. I set cookbooks_path in my .kitchen.yml file, but it seems like the chef_solo provisioner ignores that flag. See stack trace, below. .kitchen.yml --- driver: name: vagrant provisioner: name: chef_solo require_chef_omnibus: 11.8.0 roles_path: '../../roles' data_bags_path: '../../data_bags' environments_path: '../../environments' cookbooks_path: '../cookbooks, ../../site-cookbooks' Stack trace: $ kitchen converge analytics-centos-65 -----> Starting Kitchen (v1

How to update nginx via Chef

主宰稳场 提交于 2019-12-06 01:07:52
Note this is a copy of a question I asked on ServerFault but was unable to get an answer for. Hoping I can get some feedback here. I am a developer who recently inherited our previous devops person's chef setup. I'm running Chef 10 server and have realized that the nginx cookbook from opscode still uses nginx version 1.2.6. Since there are many security patches that have been released I'd like to move to 1.4.1 and feel that Chef should make this very easy. However it has proven to be nightmarish. My first thought was to simply make the nginx cookbook "custom" and change the default['nginx'][

Failing To Find Chef Community Cookbooks Using Chef 12 On AWS Opsworks

送分小仙女□ 提交于 2019-12-06 00:09:13
The Problem When running custom cookbooks on AWS OpsWorks a setup_failed status appears against the instance and the following in the failure log: [2016-03-26T22:53:48+00:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at /var/chef One version per cookbook data_bags at /var/chef/runs/62832572-cb67-421a-8309-d831140d7b98/data_bags nodes at /var/chef/runs/62832572-cb67-421a-8309-d831140d7b98/nodes [2016-03-26T22:53:48+00:00] INFO: Forking chef instance to converge... [2016-03-26T22:53:48+00:00] INFO: *** Chef 12.7.2 *** [2016-03-26T22:53:48+00:00] INFO: Chef-client pid:

Overriding Cookbook Attribute in Vagrantfile Custom JSON Data

孤者浪人 提交于 2019-12-05 22:10:38
How do you access node.override using chef.json in a Vagrant file? For example, using vagrant-berkshelf , I'm trying to install a particular Maven version based on Custom JSON Data in the Vagrantfile : chef.json = { 'maven' => { 'version' => '3.0.5' } } cookbooks\maven_custom\attributes\default.rb default['maven']['version'] = "3.2.1" cookbooks\maven_custom\recipes\default.rb Chef::Log.info(node['maven']['version']) When I run vagrant provision , the following gets printed out: 3.2.1 Additionally, I tried vagrant reload --provision , yet still saw "3.2.1" print out. I would've expected 3.0.5

Chef::Exceptions::ChecksumMismatch when installing nginx-1.7.8 from source

空扰寡人 提交于 2019-12-05 21:51:51
问题 I get the following error when running vagrant up --provision to set up my development environment with vagrant... ==> default: [2014-12-08T20:33:51+00:00] ERROR: remote_file[http://nginx.org/download/nginx-1.7.8.tar.gz] (nginx::source line 58) had an error: Chef::Exceptions::ChecksumMismatch: Checksum on resource (0510af) does not match checksum on content (12f75e) My chef JSON has the following for nginx: "nginx": { "version": "1.7.8", "user": "deploy", "init_style": "init", "modules": [

Access chef resources inside ruby block

大兔子大兔子 提交于 2019-12-05 21:08:01
问题 I've been trying to find the answer to this in the chef docs and through Google, but I've not been able to come up with anything. I'm not a ruby guy (yet), so the answer to this might stem from my approaching the problem with "just enough ruby for Chef". Here's what I want to do: in my deploy resource, in the before_migrate attribute, I want to execute a resource in my current recipe. What I am doing currently is to just stuff the resource into the block itself, but I know there must be a

Chef server password reset

怎甘沉沦 提交于 2019-12-05 17:58:18
问题 I installed and run my own Chef server in my linux machine. When I access my chef server UI it ask me username and password. Unfortunately I forgot my password. I know my user name is admin . How can I recover my password? In the UI there is no forgot password option also. I changed the default password which is p@ssw0rd1 . But I forgot what I have changed. Is that password is stored in any location of my chef server or Is that anyway to reset my password? Thanks. 回答1: I guess the only thing

home directory is not created with adding user resource with chef

Deadly 提交于 2019-12-05 14:23:24
On a vagrant box precise64 (ubuntu 12.04) While creating a user resource with Chef, the home directory is not created: My recipe: user "myuser" do supports :manage_home => true shell "/bin/bash" home "/home/myuser" comment "Created by Chef" password "myencryptedpassword" system true provider Chef::Provider::User::Useradd action :create end When I authenticate: $ su - myuser Password: No directory, logging in with HOME=/ Update - The workaround for precise64 (Ubuntu 12.04 64bit) directory "/home/myuser" do owner "myuser" group "myuser" mode 00755 action :create end While system users usually