chef

How do I configure a berks API server?

耗尽温柔 提交于 2019-12-12 16:16:04
问题 I want to implement the Berks API in my infrastructure, comprise of Jenkins, a Git server, and a Chef 12 Enterprise server. Each cookbook is in it's own repo in the Git server, per the Berkshelf way. Basically, I just want my top level Berksfile to contain ONLY role cookbooks, and then "let" Berkshelf pull the transitive dependencies from my Git server. I've read the Berks API README for the server installation, but "where" do I install the cookbook? Do I install it on my Git server? I've

How to automate user interactive command in chef recipe

左心房为你撑大大i 提交于 2019-12-12 13:45:22
问题 I am trying to write code for automating /etc/init.d/oracleasm configure command where as it needs 4 inputs to proceed. Default user to own the driver interface [grid]: grid Default group to own the driver interface [y]: oinstall Start Oracle ASM library driver on boot (y/n) [y]: y Scan for Oracle ASM disks on boot (y/n) [y]: y Generally what is the best way to write code for achieving this. Please suggest me. 回答1: It would be better if you had a command you could run non-interactively, but

Using attributes in Chef

吃可爱长大的小学妹 提交于 2019-12-12 12:06:29
问题 Just getting started with using chef recently. I gather that attributes are stored in one large monolithic hash named node that's available for use in your recipes and templates. There seem to be multiple ways of defining attributes Directly in the recipe itself Under an attributes file - e.g. attributes/default.rb In a JSON object that's passed to the chef-solo call. e.g. chef-solo -j web.json Given the above 3, I'm curious Are those all the ways attributes can be defined? What's the order

Chef NOT_IF and ONLY_IF validation issue in Windows recipes

核能气质少年 提交于 2019-12-12 10:04:07
问题 Im runing this simple recipe block to create a web app in IIS powershell_script "create_site_my_site" do code "New-webapppool -name 'My_Web_App'; New-Website -Name 'My_Web_App' -applicationpool 'My_Web_App' -Port '80' -IPAddress * -PhysicalPath 'c:\webs\My_Web_App' " action :run not_if "get-website | where-object { $_.name -eq 'My_Web_App' }" end The problem here its that the NOT_IF part its allways True PS C:\Users\carlos> PS C:\Users\carlos> get-website | where-object { $_.name -eq

Recurring Vagrant error: operation not permitted on action `create` on an NFS resource

血红的双手。 提交于 2019-12-12 09:44:56
问题 I have a vagrant box with chef provisioner. Everything works fine except when there are operation on NFS resources. For example, I have the following synced folders: "host_path": "/Users/User/devbox/vdd/data", "guest_path": "/var/www", "type": "nfs" And in the vagrant file: # Synced Folders. config_json["vm"]["synced_folders"].each do |folder| case folder["type"] when "nfs" config.vm.synced_folder folder["host_path"], folder["guest_path"], type: "nfs" # This uses uid and gid of the user that

Dynamic Role Attributes in Chef

♀尐吖头ヾ 提交于 2019-12-12 08:14:39
问题 I would like the Chef cookbook network_interfaces to have dynamic values for ip addresses, netmasks and alike for each of my nodes. What works for me is the following: db_role.rb (block1): override_attributes( "network_interfaces" => { :device => 'eth0', :address => '123.123.123.123', } ) But that is not very dynamic. My idea was to submit the ip address(, netmask, etc.) to each node on knife bootstrap . The node would then look like so (block2): { "normal": { "network_interfaces" => {

Stuck trying to bootstrap Windows server using Chef

痞子三分冷 提交于 2019-12-12 07:58:00
问题 I am a mac girl, working on connecting with knife-windows trough Opscode's managed Chef to my Rackspace Windows servers. (I know, it sounds exotic, but these Windows servers are a customer requirment). I tried to Chef for a spin but I am stuck in trying to bootstrap the Windows 2008 Server on Rackspace with the knife-windows command. I am working on OSX, using rvm, ruby 2.1.0 and a local gemset with chef + knife-windows. I was trying to follow the steps from: https://github.com/opscode/knife

How do you create pretty json in CHEF (ruby)

余生颓废 提交于 2019-12-12 07:37:41
问题 How would you make an erb template that has human readable json? The following code works, but it makes a flat json file default.rb default['foo']['bar'] = { :herp => 'true', :derp => 42 } recipe.rb template "foo.json" do source 'foo.json.erb' variables :settings => node['foo']['bar'].to_json action :create end foo.json.erb <%= @settings %> Similar SO questions Chef and ruby templates - how to loop though key value pairs? How can I "pretty" format my JSON output in Ruby on Rails? 回答1: As

Chef: Enabling Jenkins security causes plugin installation to fail

假装没事ソ 提交于 2019-12-12 06:46:09
问题 I am currently using Chef to deploy a Jenkins instance on a managed node. I am using the following public supermarket cookbook: https://supermarket.chef.io/cookbooks/jenkins . I am using the following code in my recipe file to enable authentication: jenkins_script 'activate global security' do command <<-EOH.gsub(/^ {4}/, '') import jenkins.model.* import hudson.security.* def instance = Jenkins.getInstance() def hudsonRealm = new HudsonPrivateSecurityRealm(false) hudsonRealm.createAccount(

Trying to install knife-ec2

允我心安 提交于 2019-12-12 06:40:12
问题 my chef-client version is 11.10.0 trying to install knife-ec2 gem install knife-ec2 ERROR: While executing gem ... (Errno::EACCES) Permission denied - /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.1/.autotest i tried with other command: sudo /opt/chef/embedded/bin/gem install knife-ec2 Building native extensions. This could take a while... ERROR: Error installing knife-ec2: ERROR: Failed to build gem native extension. /opt/chef/embedded/bin/ruby extconf.rb Extracting libxml2-2.8.0