Sha256: 2eaae0a2d28d94c73fcd446cfb62f5705ad3983214786baa3b296702a6a7ba6f
Contents?: true
Size: 1.68 KB
Versions: 1
Compression:
Stored size: 1.68 KB
Contents
# frozen_string_literal: true require_relative 'rspec' # DeployRubygem - deploy a gem using rake # Containing a class module DeployRubygem # Using Project to deploy and manage Project class Workstation def clientrb { log_location: '/var/log/chef-client.log', chef_server_url: ENV['CHEF_SERVER_URL'], chef_license: 'accept', file_cache_path: '/var/chef/cache', file_backup_path: '/var/chef/backup', node_name: ENV['NODENAME'], policy_name: ENV['POLICYNAME'], policy_group: ENV['POLICYGROUP'] }.map do |key, value| [key, "'#{value}'"].join(' ') end.join("\n") end def credential (['[default]'] + { client_name: ENV['KNIFE_NAME'], client_key: File.join(ENV['HOME'], '.chef', 'cicd.pem'), chef_server_url: ENV['CHEF_SERVER_URL'] # secret_file: File.join(ENV['HOME'], '.chef', 'cicd.secret') }.map do |key, value| [key, "'#{value}'"].join(' ') end).join("\n") end def boostrap_workstation clientrb_file = '/etc/chef/client.rb' clientpem_file = '/etc/chef/client.pem' cicdpem_file = File.join(ENV['HOME'], '.chef', 'cicd.pem') cicdcredential_file = File.join(ENV['HOME'], '.chef', 'credentials') File.write(clientrb_file, clientrb) File.write(clientpem_file, ENV['CHEF_CLIENT_KEY']) File.write(cicdpem_file, ENV['CHEF_KNIFE_KEY']) File.write(cicdcredential_file, credential) FileUtils.chmod(0o600, clientrb_file) FileUtils.chmod(0o600, clientpem_file) FileUtils.chmod(0o600, cicdpem_file) FileUtils.chmod(0o600, cicdcredential_file) system('chef-client') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
deploy_rubygem-0.60.21 | lib/deploy_rubygem/workstation.rb |