Chef infra Chef "missing required authentication"

When I came back from the weekend I was greeted by the following error when attempting to deploy a new node using chef. I have tried to restart the server and Googled quite a bit but found no solid solution and still have no idea why this would suddenly happen. We made no changes to the server or the Chef configuration. Any ideas and suggestions would be greatly appreciated. merb : chef-server (api) : worker (port 4000) ~ Started request handling: Mon Jul 02 09:57:24 +0200 2012 merb : chef-

Chef infra How to setup my new vps quickly?

Recently I knew some words puppet chef salt. It seems that they are used to setup env for thousands of machines with a master machine. But I just have one or two vps. How can I create a production env quick with these tools? I found some docs from salt but most of its docs talk about how to use master to create a new production server. So is there some good way to create a product env for only vps.

Chef infra Berkshelf cookbooks are not being copied to the Vagrant directory

I am trying to provision a Vagrant machine using Chef-solo, Berkshelf, and the vagrant-berkshelf plugin. However, the provisioning fails with this error: Berkshelf::CookbookNotFound: Cookbook <cookbook name> not found in any of the default locations berks install successfully installs everything to ~/.berkshelf/cookbooks/, but the cookbooks are never copied over to ~./berkshelf/default/vagrant/berkshelf-20131017-8441-pqghfq-default which is where Berkshelf reports it is updating, right b

Chef infra Parameterize chef recipe

I have a recipe in chef, which I want to use multiple times (in multiple roles), only with a few parameters different. I want to be able to use multiple such roles on the same node. How can I "parameterize" the recipe? I can't use attributes, because those are on node, so one role would override another's attributes.

Chef infra How do I assign a value to a variable inside my chef recipe at runtime

In scripting languages like shell/perl, I could use variables to get a specific directory name at run time which can be used in the script. But inside a chef recipe how do I make use of variables without passing them as parameters I want to assign output of a shell command line to a variable- How do I achieve it within a chef recipe. I am using chef-solo. Shell example: install_dir=`grep install /tmp/my_info.txt | cut -d"/" -f4` cd /dev/install_dir

Chef infra How to pass attributes to chef in local mode

I want to override a default attribute that I have defined in my default attributes file in the cookbook: /attributes/default.rb: default[:server][:name] = "test" default[:server][:port] = "8080" I am running chef-client in local mode: chef-client -z -j node.json with this node.json: { "name": "mycookbook", "default__attributes": { "server": { "name": "myCustomName" } }, "run_list": [ "recipe[mycookbook]" ] } The cookbook is running without complaining but th

Chef infra Chef Mount must be root to use options

I have the following mount command as part of my recipe. I am needing this to run as root, because I get an error message that only root can use options. Thanks for the help in adavance. mount mounted_dir do action :mount fstype 'cifs' device '//' enabled node['smart-mobile']['share']['mount_share'] options "username=testuser,password=testpwd,domain=domain,file_mode=0777,dir_mode=0777,uid=0" end

Chef infra AWS SDK with Chef 12.5 or greater

Process: 1. Store passwords that are aws-kms encrypted in as default attribute in an array. Unencrypt at runtime with creds that are stored in protected location .aws/creds Set plaintext array back into node array Parse node array in template Discard plaintext passwords I am trying to reference a node.runstate variable that is set in a custom resource in another resource. Custom Resource: resource_name :secrets_kms property :password, String, name_property: true property :region, Strin

Chef infra Chef remote_file resource error Chef::Exceptions::ContentLengthMismatch

When downloading file using remote_file I got the following error: [2017-05-16T09:31:36+00:00] INFO: AWS OpsWorks instance ******, Agent version 4023-20170402215230, Command: setup with id 521be6b3-f80a-476f-9964-17fcfe056bef [2017-05-16T09:31:38+00:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at /opt/aws/opsworks/current One version per cookbook data_bags at /var/lib/aws/opsworks/data.internal/data_bags n

Chef infra Download remote_file based on url generated from bash script

I have a scenario where I must download a file from a remote server, but the url for that file is generated via a bash script that I've included in `mycookbook/files/default/' I'm not sure how to go about crafting a recipe that executes the script from files/default, captures its stdout and uses the URL it spits out as the source attribute for the remote_file resource that will ultimately download the file.

Chef infra Randomly pick a key value from an array

Need some expertise help, I'm trying to see if there is a way to randomly pick a attribute from an array doing a chef client run. Example, I have this attribute default['collectors_a'] = { a, b, c, d, e} and In the recipe I want to randomly choose one of this element from the array. Does anyone know how to go about it? Thanks so much for helping out!!!!

Chef infra Chef server - permissions to specific cookbook

Does chef-server have any way to allow/disallow downloading specific cookbook? Let us say, organization has few projects and there are cookbooks installing environment for them. I would like to set client A permission to download only A cookbook and B - only B. Maybe this could be achieved by creating multpiple organizations, for example per project?

Chef infra knife ssh -P without password on command line

Currently we use knife to run instructions on a bunch of servers. But we end up having to specify our passwords using -P "Password". I was wondering if there's a way we can have the knife ssh take the password from a file more like "sshpass" does? I don't like it when i have to type my password on the command line and anyone with a sudo access can later go in to see the history and get my password.

Chef infra How to parse the Chef server nodes into Rundeck server

I'd like to get the nodes being added to my Chef server into my Rundeck server. I'm successful with getting those nodes into my Rundeck using chef-rundeck but it seems that I'm unable to execute commands because the user@host column is stated as unset. Is there a way that I can parse the username so that Rundeck will automatically set the user@host field?

Chef infra When two different resources from two cookbooks have the same name, how can I specify which one to call?

I have a recipe that calls a custom resource called sysctl_param: sysctl_param 'net.ipv4.tcp_syncookies' do value 1 end However, as of Chef 14, sysctl_param is a built-in resource. So when I tested my recipe against Chef 14, it used the Chef-built-in sysctl_param resource instead of my custom one. This is breaking some of my tests because the built-in resource has slightly different behavior than the custom one. How can I force Chef to use the custom sysctl_param resource instead of the

Chef infra How to run a Chef recipe

On one of my nodes I have three cookbooks in my run list. When the Chef client runs I can see the two of the recipes are executed, but the third is not. What are the possible causes to this? When I execute the chef client I see: resolving cookbooks for run list: ["vim", "vim::vimrc", "ssh-keys"] Then: Converging 2 resources Recipe: vim::default * package[vim] action install (up to date) Recipe: vim::vimrc * template[/etc/vim/vimrc.local] action create (up to date) But the ssh-keys recip

Chef infra How to append the content in the file for chef cookbook?

I'm new in chef and cookbook. I'm creating a cookbook, and I want to append at the end of file some contents (text). At the moment, I'm using: file "#{node['dir']}/#{params[:name]}.txt" do content "my full text" end but I must always append in the "content" the old content because it will overwrite. Is there another way to append contents? Thank you pasquy

Chef infra Recipes executing out of order

I'm on RedHat 6.5, and I want to use the mysql55 package from the IUS repo rather than the 5.1 package from base. In my attributes I have: override['mysql']['server']['packages'] = %w{mysql55-server} override['mysql']['client']['packages'] = %w{mysql55} And the first two lines of my recipe are: include_recipe 'yum::ius' include_recipe 'mysql::server' But I keep getting the error: Chef::Exceptions::Package: No version specified, and no candidate version available for mysql55 Because it s

Chef infra Setting and Accessing Custom Ohai attributes in Chef

I set a list of attributes to ohai as follows. Ohai.plugin(:mycustom) do provides "mycustom" collect_data do configs = ["sss=fdf", "tryet=werw"]"Adding #{configs.length} ohai parameters..........................") configs.each { |param| if param.to_s.strip.length != 0 key_value_pair = param.split("=").map(&:strip) mycustom mycustom["mycustom_#{key_value_pair[0].downcase}"] =

Chef infra How to unzip tar.Z file through CHEF cookbooks

I'm using a Chef hosted server, a workstation and nodes and have run cookbooks on the nodes to install Java, update hosts file. I'm not able to find a reference in sites to unzip tar files. Could you please help me out here or direct to some site which has the information. Thanks in advance.

Chef infra How does chef know how to install a package from its package name?

I am new to Chef. I have learnt that Chef provides a declarative interface to resources. Let's say: I have simple recipe.rb file with the follo line: package 'foo' This line is enough for Chef to know how to install the package foo on whichever environment the recipe is running on. So I run: chef-apply recipe.rb My question is.. What does chef do internally to translate the "declarative" recipe into a "procedural" one in context of the package resource? (i.e. what are the steps it takes

Chef infra How to disable cookbook synchronization with chef-client?

I would like to test/debug cookbooks. However, using chef-client to restart a chef run, this requires me to modify cookbooks, upload them to the chef server & synchronize cookbooks. I would like to be able to modify the cookbooks that were synchronized and stored in the cache, instead of having to upload every single little change I make at each iteration. Is this possible? Thanks tl;dr in chef-client, how to use the cached cookbooks instead of synchronizing them every time

Chef infra How can I know from Chef Management if my "chef-client" failed during update?

I have a question about CHEF. I deployed several nodes on my Chef Server (using Chef Hosting) with different configuration but with one common cookbook. I have "cron" on my nodes which run 'chef-client' each day. My question is: Is it possible to know from Chef Management, if the 'chef-client' failed on my nodes WITHOUT the need to connect to each node to check manually ? Because currently when I force a fail on a node, I don't see any change on my Chef Management. I mean, I can't see the dif

Chef infra In chef, how do I update environment attributes from a recipe?

I defined environment attributes in an environment file, used to override the default settings in a node. In my case, I would like to update an environment attribute in a recipe so when running chef-client on b_node_name the environment attribute will change from this: default_attributes "hosts" => ["a_node_name"] to this: default_attributes "hosts" => ["a_node_name", "b_node_name"] Doing this I want the new b_node_name where I ran chef-client added to the array so all nodes will ge

Chef infra How to declare state_attrs in Chef recipe

I had a requirement to track run history of a set of cookbooks. Chef reporting provides a good base, it can capture the cookbook run history as well as resources updated. But I still need to capture the initial state and final state of the resource updated. For some recipes, it uses some default resource, like file, then in the Chef Reporting -> Run History -> Details -> Parameters it can show the initial and final state, for example they are checksum, mode, group, owner attributes for

Chef infra Manage custom, machine specific configuration files in Salt

I am relatively new to Configuration Management tools for big infrastructure. The company will be using Salt for Linux and Windows, but I guess the question does not relate to specific tool. The thing I don't get is, let's imagine we have 30 machines in cloud and couple of custom services installed for each of them. Versions can be different, depending on customer subscription. And each service has a config file that can have machine specific data. How you update config files for those services

Chef infra Chef client for SLES 11 on PowerPC

I'd like to install chef client in a SLES 11 with IBM Power hardware, does anybody knows if there is any way to install chef client for that distribution and hardware type ? I've been told to use the RHEL packages but I haven't found any for PPC. Thank you!

Chef infra Chef knife issue with ssh command

I am trying to do ssh to my servers using knife command by running below command: knife ssh "name:myserverhost" "pwd" But it throws me with below error: /usr/local/rbenv/versions/1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1637:in `raise_if_conflicts': Unable to activate net-ssh-gateway-1.2.0, because net-ssh-2.2.2 conflicts with net-ssh (>= 2.6.5) (Gem::LoadError) from /usr/local/rbenv/versions/1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:746:in `ac

Chef infra unable to create a user in chef ( ruby error )

I am learning chef and I am facing an issue in creating a user for chef command to execute: chef-server-ctl user-create USER_NAME FIRST_NAME [MIDDLE_NAME] LAST_NAME EMAIL 'PASSWORD' --filepath /path/to/username.pem Error: /opt/opscode/embedded/service/omnibus-ctl/wrap-knife-opc.rb:43:in `block (2 levels) in load_file': undefined method `exitstatus' for nil:NilClass (NoMethodError) from /opt/opscode/embedded/lib/ruby/gems/2.1.0/gems/omnibus-ctl-0.5.0/lib/omnibus-ctl.rb:199:in `call'

Elasticsearch Is it possible to dynamically build an Elastic cluster with a single run list?

I'm using the Elasticsearch cookbook. My ultimate goal: Have 4 or more previously deployed VMs that are unconfigured to run ES I apply the same recipe/runlist to all of these nodes and it installs and configures an ES cluster for me Before I start going down this road I want to know if this is even possible or are there node specific configurations that make it impossible to accomplish this with a single run list. If the nodes are preconfigured with my desired hostnames and IPs I can use n

Chef infra Deploy MSI package from Sonatype Nexus using chef

I want to install the msi package from sonatype Nexus using Chef. Here what I need to achieve is , If the new version of msi is arrived in nexus repository chef should take the latest and deploy it automatically. Can you tell me how can I do it. Thanks, Ram

Chef infra Use consul key value store instead of chef databags?

I've tried googling for this but I can't seem to find anything on using consul's kv store instead of chef's databags. Does anyone have any suggestion on how this can be done? Is it a bad idea? I've found 'consul_kv' cookbook but it's for setting and deleting kv pairs in consul from chef. I'm looking for a way to read kv pairs from consul instead of using chef attributes and databag items.

Chef infra Chef: Install java failed

My configuration is: node.default['java']['install_flavor'] = 'oracle' node.default['java']['jdk_version'] = '8' node.default['java']['oracle']['accept_oracle_download_terms'] = true include_recipe 'java' I'm getting this message from chef client: digitalocean_droplet.web (chef): digitalocean_droplet.web (chef): ================================================================================ digitalocean_droplet.web (chef): Error executing action `install` on resource 'java_ark[jdk]

Chef infra How to stub two level of json data bag in chef spec

I'm trying to write the unit test for chef and stubbing the encrypted data bag as below. Recipe part variables(car_model: Chef::EncryptedDataBagItem.load('databagname', node.environment, key_name)['cardetails']['car_model']) Doing stub in below pattern Chef::EncryptedDataBagItem.stub(:load).with('databagname', 'test', 'somekey').and_return( "cardetails": { 'car_model' => 'abc' } ) Getting error as undefined method NoMethodError undefined method `[]' for nil:NilClass Cookbook

Chef infra Chef recipe to install System Center Endpoint Protection

I want to install System Center Endpoint Protection (SCEP) using Chef Recipe in the Windows 2012 server. I am using the script below to install the exe file (scepinstall.exe). Looks like this is not the right recipe. Please help windows_package 'SCEP' do source 'C:/foldername/scepinstall.exe' installer_type :custom options '/Q' end

Chef infra How to print test output or log at the end of "Kitchen Converge"?

We are compiling cucumber tests using Kitchen. We could able to run the test cases and everything is good. What we want is, printing the test report at the end of the Kitchen Converge. Is it possible to run a chef recipe in debug mode. We know "kitchen converge -l Debug" will print the whole output, but we don't want all the log. Just particular test report.

Chef infra Using chef/artifactory-client as chef remote_file provider

Chef developed a Ruby gem for interacting with Artifactory that Chef cookbooks could use to download artifacts and perform other actions. I assumed it would be leveraged as a provider for resources like remote_file, however there is no example code provided, documentation on using it explicitly in Chef, or others who have taken this approach. How have you integrated Chef with Artifactory? Are your cookbooks/recipes redistributable without tight coupling to Artifactory?

Chef infra How to create a user and group in chef without 'cloning resource' warning

I recently used following recipe to create a specific user, group: sysadmin = data_bag_item('users','sysadmin') group 'sysadmin' do action :create gid sysadmin['gid'].to_i end user 'sysadmin' do uid sysadmin['uid'].to_i gid sysadmin['gid'].to_i manage_home true shell sysadmin['shell'] action :create end group 'sysadmin' do action :modify members 'sysadmin' append true end And get following warnings: Cloning resource attributes for group[sysadmin] from prior resource

Chef infra pool 'sqerl' failed to start member chef server

Chef server was running perfectly for one week and then suddenly i encountered this error, after that i am not able to do anything. 2018-05-16 22:23:47.623 [error] Unable to start database connection: econnrefused 2018-05-16 22:23:47.623 [error] pool 'sqerl' failed to start member: {error,econnrefused} 2018-05-16 22:23:47.623 [error] CRASH REPORT Process <0.15278.27> with 1 neighbours exited with reason: econnrefused in gen_server:init_it/6 line 344 2018-05-16 22:23:47.623 [error] gen_ser

Chef infra Data bag 'aws_opsworks_instance' not available

Does anyone have any idea why instance = search('aws_opsworks_instance', 'self:true').first # ... instance_host: instance['hostname'] would intermittently result in undefined method `[]' for nil:NilClass on OpsWorks? I've been searching for hours now and didn't find anything, so I am starting to think this is a byproduct, not the actual issue. Since it happens every once in a while, I am thinking it may be a "race condition". Maybe OpsWorks takes a while to inject this, so Ch

  1    2   3   4   5   6  ... 下一页 最后一页 共 10 页