Skip to content

Instantly share code, notes, and snippets.

@akirasosa
Last active December 22, 2015 21:19
Show Gist options
  • Save akirasosa/6532700 to your computer and use it in GitHub Desktop.
Save akirasosa/6532700 to your computer and use it in GitHub Desktop.
I provision jenkins slaves by using chef. Jenkins slaves have to access to the github.com, heroku.com and so on via ssh. They have to know know_hosts.
echo "cookbook 'ssh_known_hosts', github: 'opscode-cookbooks/ssh_known_hosts'" >> Berksfile
berks install
berks upload
knife data bag create ssh_known_hosts
knife data bag from file ssh_known_hosts data_bags/ssh_known_hosts/github.json
knife data bag from file ssh_known_hosts data_bags/ssh_known_hosts/heroku.json
knife role from file roles/jenkins-slave.rb
{
"id": "github",
"fqdn": "github.com"
}
{
"id": "heroku",
"fqdn": "heroku.com"
}
# roles/jenkins-slave.rb
name "jenkins-slave"
description "jenkins slave"
run_list(
"recipe[ssh_known_hosts::default]",
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment