Proof of concept implementation to integrate knife-ec2
and knife-solo Chef Knife plugins.
Adds --solo
option to knife ec2 server create
that uses knife solo bootstrap
for bootstrapping the instance. Also other solo bootstrap options are available.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# todo.txt colors for dark Solarized color scheme | |
export PRI_A=$RED | |
export PRI_B=$BROWN | |
export PRI_C=$BLUE | |
export PRI_D=$CYAN | |
export PRI_E=$LIGHT_PURPLE | |
export PRI_X=$LIGHT_CYAN | |
export COLOR_DONE=$LIGHT_GREEN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
knife[:solo_path] = 'chef-solo' # relative to $HOME, but can be '/tmp/chef-solo' etc. | |
# knife-solo sets the KNIFE_SOLO variable when runnin on the work station | |
solo_path = ENV['KNIFE_SOLO'] ? knife[:solo_path] : File.expand_path(File.dirname(__FILE__)) | |
data_bag_path File.join(solo_path, 'data_bags') | |
encrypted_data_bag_secret File.join(solo_path, 'data_bag_key') | |
cookbook_path [ File.join(solo_path, "site-cookbooks"), | |
File.join(solo_path, "cookbooks") ] | |
role_path File.join(solo_path, "roles") |
The knife-bootstrap-solo
branch of tmatilai's knife-solo fork has a proof
of concept implementation to integrate knife-solo
plugin to Opscode Chef's knife bootstrap
command, which also plugins like
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
CONF='.ec2-credentials' | |
if [ -f "$CONF" ]; then | |
# export EC2_URL=https://ec2.us-east-1.amazonaws.com/ | |
# export EC2_ACCESS_KEY='' | |
# export EC2_SECRET_KEY='' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash -c ' | |
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%> | |
exists() { | |
if command -v $1 &>/dev/null | |
then | |
return 0 | |
else | |
return 1 | |
fi |
Module | Keys | Env vars |
---|---|---|
All | config.proxy.http config.proxy.https config.proxy.no_proxy |
VAGRANT_HTTP_PROXY VAGRANT_HTTPS_PROXY VAGRANT_NO_PROXY |
Env/shell | config.env_proxy.http config.env_proxy.https config.env_proxy.no_proxy |
VAGRANT_ENV_HTTP_PROXY VAGRANT_ENV_HTTPS_PROXY VAGRANT_ENV_NO_PROXY |
Apt | config.apt_proxy.http config.apt_proxy.https |
VAGRANT_APT_HTTP_PROXY VAGRANT_APT_HTTPS_PROXY |
Yum | config.yum_proxy.http config.yum_proxy.https |
VAGRANT_YUM_HTTP_PROXY VAGRANT_YUM_HTTPS_PROXY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def run | |
# ... | |
if config_value(:sync, true) | |
generate_node_config | |
berkshelf_install if config_value(:berkshelf, true) | |
librarian_install if config_value(:librarian, true) | |
add_cookbook_path(patch_cookbooks_path) # <-- | |
sync_kitchen | |
generate_solorb | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant.configure('2') do |config| | |
# ... | |
config.vm.provider :virtualbox do |vbox| | |
vbox.customize ['modifyvm', :id, '--natdnshostresolver1', 'on'] | |
end | |
# ... | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# URI of the local (caching) HTTP proxy | |
LOCAL_HTTP_PROXY = 'http://192.168.33.200:8123' | |
# Configures vagrant-cachier and vagrant-proxyconf. | |
# Should be called only on "local machine" providers. | |
def configure_caching(config) | |
if Vagrant.has_plugin?('vagrant-cachier') | |
config.cache.enable_nfs = true | |
config.cache.enable :gem | |
config.cache.enable :npm |
OlderNewer