class Seedee::Chef

Talk to Chef Server

Public Instance Methods

bootstrap(droplet, node_name, recipes) click to toggle source
# File lib/seedee/chef.rb, line 6
    def bootstrap(droplet, node_name, recipes)
      run_list = "recipe[#{Array(recipes).join(' ')}]"

      command = <<~COMMAND
        #{File.join('knife')} bootstrap #{droplet.public_ip} \
          --ssh-user #{ssh_user} \
          --sudo \
          --node-name #{node_name.to_s.strip} \
          --run-list '#{run_list}' \
          --ssh-identity-file #{ssh_identity_file} \
          --yes
      COMMAND

      system(command)
    end

Private Instance Methods

chef_configuration_file() click to toggle source
# File lib/seedee/chef.rb, line 37
def chef_configuration_file
  ENV['CHEF_CONFIGURATION_PATH']
end
ssh_identity_file() click to toggle source
# File lib/seedee/chef.rb, line 28
def ssh_identity_file
  File.join(
    travis_build_dir,
    'secrets',
    'ssh_keys',
    'travis_ci_rsa'
  )
end
ssh_user() click to toggle source
# File lib/seedee/chef.rb, line 24
def ssh_user
  'root'
end
travis_build_dir() click to toggle source
# File lib/seedee/chef.rb, line 41
def travis_build_dir
  ENV['TRAVIS_BUILD_DIR'] || File.join('~', 'work')
end