chake 0.6 → 0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1eb55dbcfe2c5a55b4f25f91577343bdcb012e2b
4
- data.tar.gz: 5a5bba8b619a44b1b020dd1b08dbadf4a13b6f60
3
+ metadata.gz: 41bab755897f490a53f097a252bc9b67ec0f36c9
4
+ data.tar.gz: a63cf815c00c0698f39e7786f43f57ce97f09e1f
5
5
  SHA512:
6
- metadata.gz: adbbf6f0e28b6786f237d3fe98b6328dc392f29270c3cdc8237bb79b5ed650fdfc096fae134f252d03a25af9b8ee2a3bb50a44c2d0bdd4b2d390cbd9313f6369
7
- data.tar.gz: 28aa419d152a89658fccc7abe108cf68743c3e79babe5a8f249836f62fcc35949f18a79a459cd23f5086002ccca4ba2262cdf98a120182abd64e76bba18ab164
6
+ metadata.gz: 7c19065bb9da3196b99040a53ea4d8ee1472b721658b9492a64e93ae650eece308d9ea1797eff52b163a4b2afb9ca675e1326de255720cd7d9188a99738a4330
7
+ data.tar.gz: 87b95fd2d51d8791b74542825e4cefac9d34b5a44a17e6c1676fd6517e7c8dd612fc00e252616a3ff923dec2cb1c4e1f6f4b75248cef5cccebf524422d2e62a4
@@ -1,3 +1,11 @@
1
+ # 0.7
2
+
3
+ * gemspec: improve summary and description
4
+ * Also for encrypted files under $cookbook/files/, and not only under
5
+ $cookbook/files/\*/.
6
+ * Allow overriding tmpdir with `$CHAKE_TMPDIR`
7
+ * Stop cloud-init from resetting the hostname
8
+
1
9
  # 0.6
2
10
 
3
11
  * Support a ssh prefix command by setting `$CHAKE_SSH_PREFIX` in the
data/README.md CHANGED
@@ -209,7 +209,8 @@ vice-versa.
209
209
  | `$CHAKE_SSH_CONFIG` | local SSH configuration file | `.ssh_config` |
210
210
  | `$CHAKE_SSH_PREFIX` | Command to prefix SSH (and rsync over SSH) calls with | _none_ |
211
211
  | `$CHAKE_RSYNC_OPTIONS` | extra options to pass to `rsync`. Useful to e.g. exclude large files from being upload to each server | _none_ |
212
- | `$CHAKE_NODES` | File containing the list of servers to be managed | _nodes.yaml` |
212
+ | `$CHAKE_NODES` | File containing the list of servers to be managed | `nodes.yaml` |
213
+ | `$CHAKE_TMPDIR` | Directory used to store temporary cache files | `tmp/chake` |
213
214
 
214
215
  ## Contributing
215
216
 
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Chake::VERSION
9
9
  spec.authors = ["Antonio Terceiro"]
10
10
  spec.email = ["terceiro@softwarelivre.org"]
11
- spec.summary = %q{Simple host management with chef and rake. No chef server required.}
12
- spec.description = %q{chake provides a set of rake tasks that you can use to manage any number of hosts via SSH. It doesn't require a chef server; all you need is a workstation from where you can SSH into all your hosts.}
11
+ spec.summary = %q{serverless configuration management tool for chef}
12
+ spec.description = %q{chake allows one to manage a number of hosts via SSH by combining chef (solo) and rake. It doesn't require a chef server; all you need is a workstation from where you can SSH into all your hosts. chake automates copying the configuration management repository to the target host (including managing encrypted files), running chef on them, and arbitraty commands on the hosts.}
13
13
  spec.homepage = "https://gitlab.com/terceiro/chake"
14
14
  spec.license = "MIT"
15
15
 
@@ -11,7 +11,7 @@ require 'chake/node'
11
11
  nodes_file = ENV['CHAKE_NODES'] || 'nodes.yaml'
12
12
  node_data = File.exists?(nodes_file) && YAML.load_file(nodes_file) || {}
13
13
  $nodes = node_data.map { |node,data| Chake::Node.new(node, data) }.reject(&:skip?).uniq(&:hostname)
14
- $chake_tmpdir = 'tmp/chake'
14
+ $chake_tmpdir = ENV.fetch('CHAKE_TMPDIR', 'tmp/chake')
15
15
 
16
16
  desc "Initializes current directory with sample structure"
17
17
  task :init do
@@ -75,7 +75,8 @@ task :nodes do
75
75
  end
76
76
 
77
77
  def encrypted_for(node)
78
- Dir.glob("**/files/{default,host-#{node}}/*.{asc,gpg}").inject({}) do |hash, key|
78
+ encrypted_files = Dir.glob("**/files/{default,host-#{node}}/*.{asc,gpg}") + Dir.glob("**/files/*.{asc,gpg}")
79
+ encrypted_files.inject({}) do |hash, key|
79
80
  hash[key] = key.sub(/\.(asc|gpg)$/, '')
80
81
  hash
81
82
  end
@@ -104,21 +105,19 @@ def write_json_file(file, data)
104
105
  end
105
106
  end
106
107
 
107
- platforms = Dir.glob(File.expand_path('chake/bootstrap/*.sh', File.dirname(__FILE__))).sort
108
+ bootstrap_steps = Dir.glob(File.expand_path('chake/bootstrap/*.sh', File.dirname(__FILE__))).sort
108
109
 
109
110
  $nodes.each do |node|
110
111
 
111
112
  hostname = node.hostname
112
113
  bootstrap_script = File.join($chake_tmpdir, 'bootstrap-' + hostname)
113
114
 
114
- file bootstrap_script => platforms do |t|
115
+ file bootstrap_script => bootstrap_steps do |t|
115
116
  mkdir_p(File.dirname(bootstrap_script))
116
117
  File.open(t.name, 'w') do |f|
117
118
  f.puts '#!/bin/sh'
118
119
  f.puts 'set -eu'
119
- f.puts "echo '#{hostname}' > /etc/hostname"
120
- f.puts 'hostname --file /etc/hostname'
121
- platforms.each do |platform|
120
+ bootstrap_steps.each do |platform|
122
121
  f.puts(File.read(platform))
123
122
  end
124
123
  end
@@ -139,7 +138,7 @@ $nodes.each do |node|
139
138
  sh *scp, bootstrap_script, node.scp_dest + target
140
139
 
141
140
  # run bootstrap script
142
- node.run_as_root(target)
141
+ node.run_as_root("#{target} #{hostname}")
143
142
 
144
143
  # overwrite config with current contents
145
144
  mkdir_p File.dirname(config)
@@ -0,0 +1,9 @@
1
+ hostname="$1"
2
+
3
+ echo "$hostname" > /etc/hostname
4
+ hostname --file /etc/hostname
5
+
6
+ # Stop cloud-init from resetting the hostname
7
+ if [ -f /etc/cloud/cloud.cfg ]; then
8
+ sed -i -e '/^\s*-\s*\(set_hostname\|update_hostname\)/d' /etc/cloud/cloud.cfg
9
+ fi
@@ -1,3 +1,3 @@
1
1
  module Chake
2
- VERSION = "0.6"
2
+ VERSION = "0.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chake
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.6'
4
+ version: '0.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antonio Terceiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-14 00:00:00.000000000 Z
11
+ date: 2015-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,9 +52,11 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description: chake provides a set of rake tasks that you can use to manage any number
56
- of hosts via SSH. It doesn't require a chef server; all you need is a workstation
57
- from where you can SSH into all your hosts.
55
+ description: chake allows one to manage a number of hosts via SSH by combining chef
56
+ (solo) and rake. It doesn't require a chef server; all you need is a workstation
57
+ from where you can SSH into all your hosts. chake automates copying the configuration
58
+ management repository to the target host (including managing encrypted files), running
59
+ chef on them, and arbitraty commands on the hosts.
58
60
  email:
59
61
  - terceiro@softwarelivre.org
60
62
  executables:
@@ -79,8 +81,9 @@ files:
79
81
  - lib/chake/backend.rb
80
82
  - lib/chake/backend/local.rb
81
83
  - lib/chake/backend/ssh.rb
82
- - lib/chake/bootstrap/00_centos7.sh
83
- - lib/chake/bootstrap/00_debian.sh
84
+ - lib/chake/bootstrap/00_set_hostname.sh
85
+ - lib/chake/bootstrap/01_centos7.sh
86
+ - lib/chake/bootstrap/01_debian.sh
84
87
  - lib/chake/bootstrap/99_unsupported.sh
85
88
  - lib/chake/node.rb
86
89
  - lib/chake/version.rb
@@ -112,7 +115,7 @@ rubyforge_project:
112
115
  rubygems_version: 2.2.2
113
116
  signing_key:
114
117
  specification_version: 4
115
- summary: Simple host management with chef and rake. No chef server required.
118
+ summary: serverless configuration management tool for chef
116
119
  test_files:
117
120
  - spec/chake/backend/local_spec.rb
118
121
  - spec/chake/backend/ssh_spec.rb