CenturyLinkCloud / chef-provisioning-vsphere

A chef-provisioning provisioner for VMware vSphere
MIT License
66 stars 56 forks source link

Chef-client Version #44

Open tnargnai opened 9 years ago

tnargnai commented 9 years ago

Hi all,

Has anyone been able to specify the chef-client version with the :convergence_options :install_msi_url option? I keep getting the latest version (12.5.1) no matter what I put. Below is my config. I'm pulling in my machine options from a data bag:

  node_spec = data_bag_item('nodes', 'test-ian-blank-01')

  require "chef/provisioning/vsphere_driver"
  with_vsphere_driver host: node_spec['vsphere']['vsphere_host'],
    insecure: true,
    user:     'some_user',
    password: 'some_pass'

 with_machine_options :bootstrap_options => {
    num_cpus: node_spec['vsphere']['num_cpus'],
    memory_mb: node_spec['vsphere']['memory_mb'],
    network_name: node_spec['vsphere']['networks'],
    datacenter: node_spec['vsphere']['datacenter'],
    datastore: node_spec['vsphere']['datastore'],
    additional_disk_size_gb: node_spec['vsphere']['additional_disk_size_gb'],
    host: node_spec['vsphere']['host'],
    template_name: node_spec['vsphere']['template'],
    :ssh => {
      :user => 'some_user',
      :password => 'some_pass',
      :paranoid => false
    },
    customization_spec: {
      ipsettings: {
        ip: node_spec['vsphere']['ipaddress'],
        subnetMask: node_spec['vsphere']['netmask'],
        gateway: node_spec['vsphere']['gateway'],
        dnsServerList: node_spec['vsphere']['nameservers'],
      },
      :domain => node_spec['vsphere']['domain'],
    }
  }, :convergence_options => {
    #:ssl_verify_mode => :verify_none,
    :install_msi_url => 'https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.4.3-1.el6.x86_64.rpm'
  }, :sudo => true

  require 'chef/provisioning'
  # env = node.chef_environment

  with_chef_server node['chef']['server_url'],
    :client_name => Chef::Config[:node_name],
    :signing_key_filename => Chef::Config[:client_key]

  machine node_spec['id'] do
    chef_environment node_spec['env']
    run_list node_spec['vsphere']['run_list']
    file "/etc/chef/encrypted_data_bag_secret", "#{ENV['HOME']}/.chef/encrypted_data_bag_secret"
    converge true
  end
mwrock commented 9 years ago

The :install_msi_url is intended to point to a MSI resource for windows machines.

Use [:convergence_options][:install_sh_url] for linux installs.

tnargnai commented 9 years ago

Ahh man sorry.... I haven't worked with windows since the late 90's and was not thinking about windows at all :)

Ok I thought the [:convergence_options][:install_sh_url] referred to the chef omnibus installer. If you use that then you have to execute in the following way to specify the chef-client version:

curl -LO https://www.chef.io/chef/install.sh && sudo bash ./install.sh -v 12.4.3-1 && rm install.sh

or

 curl -L https://www.chef.io/chef/install.sh | sudo bash -s -- -v 12.4.3-1

So I'm not sure how you pass that into [:convergence_options][:install_sh_url].

I've tried creating my own install script and putting it on our package repo server which is accessible via http but I just keep ending up with the latest version of chef-client.

Thanks Ian

mwrock commented 9 years ago

Looking over the chef-provisioning code here it looks like install_sh_url is no longer used. I never used that myself anyways. On linux boxes I have used the [:convergence_options][:chef_version] setting with success. It just takes a simple version string like '12.4.3'and then uses an url that makes sense for the platform you are on. Give that a shot.