Sha256: 5493fb770340a34f23be58b789a3535864cd9eca7e20f9201e07176ef77de33e

Contents?: true

Size: 1.33 KB

Versions: 18

Compression:

Stored size: 1.33 KB

Contents

#
# Cookbook Name:: mu-jenkins
# Recipe:: node-ssh-config
#
# Copyright 2015, eGlobalTech, Inc
#
# All rights reserved - Do Not Redistribute
#

include_recipe 'mu-jenkins::public_key'
include_recipe 'mu-tools::disable-requiretty'
include_recipe 'chef-vault'

ssh_vault = chef_vault_item(node['jenkins_ssh_vault']['vault'], node['jenkins_ssh_vault']['item'])

case node['platform']
  when platform_family?('rhel')
    if platform?("centos")
      ssh_user = "root" if node['platform_version'].to_i == 6
      ssh_user = "centos" if node['platform_version'].to_i == 7
    else
      ssh_user = "ec2-user"
    end

    directory "#{node['jenkins']['master']['home']}/.ssh" do
      owner "jenkins"
      group "jenkins"
      mode 0700
    end

    ssh_key_path = "#{node['jenkins']['master']['home']}/.ssh/jenkins_ssh"

    template "#{node['jenkins']['master']['home']}/.ssh/config" do
      source "ssh_config.erb"
      owner "jenkins"
      group "jenkins"
      mode 0600
      variables(
          :ssh_user => ssh_user,
          :ssh_key_path => ssh_key_path,
          :ssh_urls => node['jenkins_ssh_urls']
      )
    end

    file ssh_key_path do
      owner "jenkins"
      group "jenkins"
      mode 0400
      content ssh_vault['private_key'].strip
      sensitive true
    end
  else
    Chef::Log.info("Unsupported platform #{node['platform']}")
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
cloud-mu-2.0.4 cookbooks/mu-jenkins/recipes/node-ssh-config.rb
cloud-mu-2.1.0beta cookbooks/mu-jenkins/recipes/node-ssh-config.rb
cloud-mu-2.0.3 cookbooks/mu-jenkins/recipes/node-ssh-config.rb
cloud-mu-2.0.2 cookbooks/mu-jenkins/recipes/node-ssh-config.rb
cloud-mu-2.0.1 cookbooks/mu-jenkins/recipes/node-ssh-config.rb
cloud-mu-2.0.0.pre.beta3 cookbooks/mu-jenkins/recipes/node-ssh-config.rb
cloud-mu-2.0.0.pre.beta2 cookbooks/mu-jenkins/recipes/node-ssh-config.rb
cloud-mu-2.0.0.pre.beta1 cookbooks/mu-jenkins/recipes/node-ssh-config.rb
cloud-mu-2.0.0.pre.alpha9 cookbooks/mu-jenkins/recipes/node-ssh-config.rb
cloud-mu-2.0.0.pre.alpha8 cookbooks/mu-jenkins/recipes/node-ssh-config.rb
cloud-mu-2.0.0.pre.alpha7 cookbooks/mu-jenkins/recipes/node-ssh-config.rb
cloud-mu-2.0.0.pre.alpha6 cookbooks/mu-jenkins/recipes/node-ssh-config.rb
cloud-mu-2.0.0.pre.alpha5 cookbooks/mu-jenkins/recipes/node-ssh-config.rb
cloud-mu-2.0.0.pre.alpha4 cookbooks/mu-jenkins/recipes/node-ssh-config.rb
cloud-mu-2.0.0.pre.alpha3 cookbooks/mu-jenkins/recipes/node-ssh-config.rb
cloud-mu-2.0.0.pre.alpha2 cookbooks/mu-jenkins/recipes/node-ssh-config.rb
cloud-mu-2.0.0.pre.alpha cookbooks/mu-jenkins/recipes/node-ssh-config.rb
cloud-mu-1.9.0.pre.beta cookbooks/mu-jenkins/recipes/node-ssh-config.rb