summaryrefslogtreecommitdiff
path: root/lib/chef/knife/bootstrap
diff options
context:
space:
mode:
authorSerdar Sutay <serdar@opscode.com>2014-08-21 16:18:32 -0700
committerSerdar Sutay <serdar@opscode.com>2014-08-26 15:42:26 -0700
commitb03b2aa547e6c9766d9ed39e29351540209c7b06 (patch)
tree668bff138214602ff1fb3024cba43abdb5d17cb2 /lib/chef/knife/bootstrap
parent63c044871c93c9ed3fa80536a036dc8642a78d0e (diff)
downloadchef-b03b2aa547e6c9766d9ed39e29351540209c7b06.tar.gz
Fixes based on the PR comments.
Diffstat (limited to 'lib/chef/knife/bootstrap')
-rw-r--r--lib/chef/knife/bootstrap/archlinux-gems.erb62
1 files changed, 62 insertions, 0 deletions
diff --git a/lib/chef/knife/bootstrap/archlinux-gems.erb b/lib/chef/knife/bootstrap/archlinux-gems.erb
new file mode 100644
index 0000000000..bb84340c05
--- /dev/null
+++ b/lib/chef/knife/bootstrap/archlinux-gems.erb
@@ -0,0 +1,62 @@
+bash -c '
+<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
+
+if [ ! -f /usr/bin/chef-client ]; then
+ pacman -Syy
+ pacman -S --noconfirm ruby ntp base-devel
+ ntpdate -u pool.ntp.org
+ gem install ohai --no-user-install --no-document --verbose
+ gem install chef --no-user-install --no-document --verbose <%= Chef::VERSION %>
+fi
+
+mkdir -p /etc/chef
+
+cat > /etc/chef/validation.pem <<'EOP'
+<%= validation_key %>
+EOP
+chmod 0600 /etc/chef/validation.pem
+
+<% if encrypted_data_bag_secret -%>
+cat > /etc/chef/encrypted_data_bag_secret <<'EOP'
+<%= encrypted_data_bag_secret %>
+EOP
+chmod 0600 /etc/chef/encrypted_data_bag_secret
+<% end -%>
+
+<%# Generate Ohai Hints -%>
+<% unless @chef_config[:knife][:hints].nil? || @chef_config[:knife][:hints].empty? -%>
+mkdir -p /etc/chef/ohai/hints
+
+<% @chef_config[:knife][:hints].each do |name, hash| -%>
+cat > /etc/chef/ohai/hints/<%= name %>.json <<'EOP'
+<%= hash.to_json %>
+EOP
+<% end -%>
+<% end -%>
+
+cat > /etc/chef/client.rb <<'EOP'
+log_level :info
+log_location STDOUT
+chef_server_url "<%= @chef_config[:chef_server_url] %>"
+validation_client_name "<%= @chef_config[:validation_client_name] %>"
+<% if @config[:chef_node_name] -%>
+node_name "<%= @config[:chef_node_name] %>"
+<% else -%>
+# Using default node name (fqdn)
+<% end -%>
+# ArchLinux follows the Filesystem Hierarchy Standard
+file_cache_path "/var/cache/chef"
+file_backup_path "/var/lib/chef/backup"
+pid_file "/var/run/chef/client.pid"
+cache_options({ :path => "/var/cache/chef/checksums", :skip_expires => true})
+<% if knife_config[:bootstrap_proxy] %>
+http_proxy "<%= knife_config[:bootstrap_proxy] %>"
+https_proxy "<%= knife_config[:bootstrap_proxy] %>"
+<% end -%>
+EOP
+
+cat > /etc/chef/first-boot.json <<'EOP'
+<%= first_boot.to_json %>
+EOP
+
+<%= start_chef %>'