knife

Knife ssh not loading environment variables

心不动则不痛 提交于 2020-01-17 03:52:25
问题 On my node node_name I've got $JAVA_HOME and other environment variables set in /etc/profile . I'm aware (found that out) that knife ssh isn't a login shell, and so doesn't load the environment variables. Is there a way to load the environment variables without having to source it? Right now I'm forced to do knife ssh 'name:nod_name' 'source /etc/profile; echo $JAVA_HOME' I'm chaining in a few commands during knife ssh including some of the environment variables and loading the /etc/profile

Knife ssh not loading environment variables

霸气de小男生 提交于 2020-01-17 03:52:04
问题 On my node node_name I've got $JAVA_HOME and other environment variables set in /etc/profile . I'm aware (found that out) that knife ssh isn't a login shell, and so doesn't load the environment variables. Is there a way to load the environment variables without having to source it? Right now I'm forced to do knife ssh 'name:nod_name' 'source /etc/profile; echo $JAVA_HOME' I'm chaining in a few commands during knife ssh including some of the environment variables and loading the /etc/profile

To setup chef workstation

两盒软妹~` 提交于 2020-01-09 11:59:08
问题 Trying to setup chef workstation knife configure -i previous it worked but now its not working i am unable to create knife.rb it says the following error: /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.10.0/lib/chef/config_fetcher.rb:53:in `realpath': Not a directory - /home/ubuntu/.chef/knife.rb (Errno::ENOTDIR) from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.10.0/lib/chef/config_fetcher.rb:53:in `realpath' from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.10.0/lib/chef

ruby unexplained syntax error ** unexpected tPOW

我怕爱的太早我们不能终老 提交于 2020-01-07 03:05:57
问题 running this : knife cookbook upload compat_resource failing due to syntax error: FATAL: /apps/chef-repo/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/property.rb:56: syntax error, unexpected tPOW, expecting ')' FATAL: new(**options) FATAL: ^ I'm suspecting that the version that's running the knife is under 2. how can I run knife with a specific ruby verion. how can I reinstall chef with ruby > 2 ? gem env RubyGems Environment: - RUBYGEMS VERSION: 1.8.23 - RUBY VERSION

Chef Server return 404 for all knife and chef-client request

元气小坏坏 提交于 2020-01-06 13:12:06
问题 I am trying to setup chef-server and chef-client for automatic deployment of packages on virtual machines run on Openstack. I am following the instructions on https://docs.chef.io/install_server.html. The version of the package is chef-server 12.0.8, on ubuntu 14.04 server (chef-server-core_12.0.8-1_amd64.deb). Several attempts have been made, always with a clean machine, and always with the same result, even with a slightly older chef-server version (12.0.3, I believe). User gets created,

Chef - create template with dynamic variable?

谁都会走 提交于 2020-01-01 08:59:11
问题 I'm having a bit of a challenge on a Chef recipe. I'm new to Chef, so please bear with me. Step 1: My chef recipe installs Ruby Passenger, then compiles the Passenger nginx module along with Nginx. # Install passenger and nginx module bash "Install Passenger" do code <<-EOF source /usr/local/rvm/scripts/rvm gem install passenger EOF user "root" not_if { `gem list`.lines.grep(/^passenger \(.*\)/).count > 0 } end # Install passenger # Note that we have to explicitly include the RVM script

Chef clients and validators

痴心易碎 提交于 2019-12-31 09:24:40
问题 I'm trying to understand the concept of Chef clients and validators, and their relationship to the bootstrapping process. According to this article, the chef-client will use the /etc/chef/validation.pem private key to authenticate itself for the initial run, because /etc/chef/client.pem doesn't exist yet. This initial run will, somehow, produce that client.pem , which is then used for all subsequent client requests. My questions: What process places the /etc/chef/validation.pem file on the

Encrypt data bag from inside of ruby without relying on knife

好久不见. 提交于 2019-12-31 03:41:19
问题 At the moment to encrypt a data bag, I have to do : system "knife data bag from file TemporaryEncrypting \"#{enc_file_path}\" --secret-file #{Secret_Key_Path}" and that doesn't work because knife can't find a config file and I can't seem to get it read the one in C:\chef . How do I do this from within ruby? 回答1: I worked out how to encrypt inside of ruby, just use this code: require 'chef/knife' #require 'chef/encrypted_data_bag_item' #you need to do this in chef version 12, they've moved it

How can I edit a chef attribute of an ec2 node using knife

和自甴很熟 提交于 2019-12-30 04:55:06
问题 I want to edit ec2 node's node_data using a knife node command. I can manually do it by using below command. knife node edit NODE_NAME It will generate a json which I need to edit. "name": "NODE-1", 3 "chef_environment": "test", 4 "normal": { 5 "node_data": { 6 "version": "23690ecc9c572e47db242bfad1296388f91da1e9", 7 "depot_path": "https://s3.amazonaws.com/builds/", 8 "source_repo": "softwares/" 9 }, 10 "tags": [ 11 12 ] 13 }, 14 "run_list": [ 15 "role[my-role]" 16 ] 17 } I want to edit node

Why am I getting prompted for sudo password via knife-vsphere when giving --ssh-user & --ssh-password params?

ε祈祈猫儿з 提交于 2019-12-25 04:18:13
问题 I'm trying to get knife-vsphere working in my vCenter environment. I have a script working that spins up a VM from a template then bootstraps it and runs cookbook recipes to completion. However, I get prompted to supply a sudo password. Is this expected? I supplied the '--ssh-user' and '--ssh-password' params and, upon being prompted, I'm typing the same password in and then chef build continues. isn't there a way to make this hands off? what may I have missed? Thanks! 回答1: As pointed out in