catfish 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +16 -7
- data/lib/catfish/cli/clean.rb +9 -0
- data/lib/catfish/cli/init.rb +5 -1
- data/lib/catfish/cli/provision.rb +6 -5
- data/lib/catfish/cli.rb +19 -4
- data/lib/catfish/templates/Catfishfile.tt +1 -1
- data/lib/catfish/templates/Vagrantfile.tt +25 -10
- data/lib/catfish/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e52c11f61f31793e6c0ac553a99194d1561c109d
|
4
|
+
data.tar.gz: 6b4cb85095aaf1ea865c98b6a526b189c7ed69a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b206cc2edbd443ece2160f6aca5a60760d345a2cf05ac91610d3744e255970faeb2f70bd291c976473f2ab98c77d5e8f7ff48aa5824f1ff9198da79bc630a61
|
7
|
+
data.tar.gz: da9abc0e61b1afea9954e19d371c46a7ce12ae708699b60d338b8f2c60be05cac34c358adfbc704f7e14c24112c0773c729f85d3bd56e008621f2e4378dc9cb3
|
data/README.md
CHANGED
@@ -27,22 +27,32 @@ Catfishfile and a Vagrantfile at a minimum.
|
|
27
27
|
|
28
28
|
$ catfish init
|
29
29
|
|
30
|
-
|
30
|
+
Include two shell script provisioners
|
31
31
|
|
32
|
-
$ catfish init --
|
32
|
+
$ catfish init --shell --shell-paths=./script/a.sh ./script/b.sh
|
33
33
|
|
34
|
-
|
34
|
+
You can template out a puppet repository
|
35
35
|
|
36
|
-
$ catfish init --
|
36
|
+
$ catfish init --puppet
|
37
37
|
|
38
|
-
|
38
|
+
Initialize a Windows configuration using winrm
|
39
|
+
|
40
|
+
$ catfish init --windows
|
41
|
+
|
42
|
+
### Managed servers
|
43
|
+
Catfish can also help you manage pre-existing servers that can communicate over
|
44
|
+
SSH or WinRM. To enable managed mode, make sure to pass the `--managed` flag to init
|
45
|
+
|
46
|
+
$ catfish init --managed --ssh-username=YOUR_USERNAME --ssh-private-key-path=YOUR_SSH_KEY_PATH
|
47
|
+
|
48
|
+
Add the target servers in your Catfishfile
|
39
49
|
|
40
50
|
```ruby
|
41
51
|
server 'myserver1.mydomain.com'
|
42
52
|
server 'myserver2.mydomain.com'
|
43
53
|
```
|
44
54
|
|
45
|
-
|
55
|
+
Provisioning
|
46
56
|
|
47
57
|
$ catfish provision
|
48
58
|
|
@@ -66,7 +76,6 @@ plugin 'vagrant-hostmaster'
|
|
66
76
|
|
67
77
|
## TODO
|
68
78
|
|
69
|
-
- Puppet provisioner support
|
70
79
|
- Add some spec tests
|
71
80
|
|
72
81
|
## Contributing
|
data/lib/catfish/cli/init.rb
CHANGED
@@ -23,6 +23,10 @@ module Catfish
|
|
23
23
|
plugins << 'vagrant-librarian-puppet' if options['puppet-librarian-puppet']
|
24
24
|
|
25
25
|
opts = {
|
26
|
+
local: options[:local],
|
27
|
+
local_box: options['local-box'],
|
28
|
+
local_box_url: options['local-box-url'],
|
29
|
+
managed: options[:managed],
|
26
30
|
provisioners: provisioners || [],
|
27
31
|
shell_paths: options['shell-paths'] || ['{{PATH_TO_YOUR_SCRIPT}}'],
|
28
32
|
puppet_hiera: options['puppet-hiera'],
|
@@ -32,7 +36,7 @@ module Catfish
|
|
32
36
|
winrm_password: options['winrm-password'] || '{{YOUR_WINRM_PASSWORD}}',
|
33
37
|
ssh_username: options['ssh-username'] || '{{YOUR_SSH_USERNAME}}',
|
34
38
|
ssh_private_key_path: options['ssh-private-key-path'] || '{{PATH_TO_YOUR_SSH_PRIVATE_KEY}}',
|
35
|
-
|
39
|
+
managed_servers: options['managed-servers'] || [],
|
36
40
|
plugins: plugins || []
|
37
41
|
}
|
38
42
|
|
@@ -7,14 +7,14 @@ module Catfish
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def run
|
10
|
-
|
10
|
+
puts 'Provisioning to servers using Catfishfile.lock'
|
11
11
|
vagrant_version
|
12
12
|
begin
|
13
13
|
# Connect to the servers. The --provider=managed is the key here.
|
14
|
-
system("vagrant up --provider=#{options[:provider]}")
|
14
|
+
system("vagrant up /managed/ --provider=#{options[:provider]}")
|
15
15
|
|
16
16
|
# Confirm the connectivity
|
17
|
-
status = `vagrant status --machine-readable`
|
17
|
+
status = `vagrant status /managed/ --machine-readable`
|
18
18
|
if status.include? 'not reachable'
|
19
19
|
abort 'ERROR DEPLOYING: One or more servers could not be connected to'
|
20
20
|
end
|
@@ -24,7 +24,7 @@ module Catfish
|
|
24
24
|
ensure
|
25
25
|
|
26
26
|
# Disconnect from all of the servers
|
27
|
-
system 'vagrant destroy -f'
|
27
|
+
system 'vagrant destroy -f /managed/'
|
28
28
|
|
29
29
|
end
|
30
30
|
end
|
@@ -50,7 +50,8 @@ module Catfish
|
|
50
50
|
|
51
51
|
threads.each(&:join)
|
52
52
|
else
|
53
|
-
|
53
|
+
command = 'vagrant provision /managed/'
|
54
|
+
system command
|
54
55
|
end
|
55
56
|
end
|
56
57
|
end
|
data/lib/catfish/cli.rb
CHANGED
@@ -22,6 +22,11 @@ module Catfish
|
|
22
22
|
TODO: Long description
|
23
23
|
D
|
24
24
|
method_option 'provisioners', type: :array, banner: 'A list of vagrant provisiners to use'
|
25
|
+
method_option 'local', type: :boolean, default: true, banner: 'Set up a local vm for use with vagrant'
|
26
|
+
method_option 'local-box', type: :string, banner: 'Vagrant box for use with local VM'
|
27
|
+
method_option 'local-box-url', type: :string, banner: 'Vagrant box url for use with local VM'
|
28
|
+
method_option 'managed', type: :boolean, default: false, banner: 'Set up capability for vagrant-managed-servers'
|
29
|
+
method_option 'managed-servers', type: :array, banner: 'Initial list of servers to include in Catfishfile'
|
25
30
|
method_option 'communicator', type: :string, banner: 'The communicator. ssh (default) or winrm'
|
26
31
|
method_option 'windows', type: :boolean, banner: 'Shorthand for --communicator=winrm'
|
27
32
|
method_option 'winrm-username', type: :string, banner: 'Username for winrm. Used with --communicator=winrm'
|
@@ -31,10 +36,9 @@ module Catfish
|
|
31
36
|
method_option 'ssh-username', type: :string, banner: 'SSH username'
|
32
37
|
method_option 'ssh-private-key-path', type: :string, banner: 'Path to SSH private key'
|
33
38
|
method_option 'puppet', type: :boolean, banner: 'Shorthand for provisioners=puppet'
|
34
|
-
method_option 'puppet-librarian-puppet', type: :boolean, default:
|
39
|
+
method_option 'puppet-librarian-puppet', type: :boolean, default: true,
|
35
40
|
banner: 'Whether or not to include a default Puppetfile and librarian puppet plugin'
|
36
|
-
method_option 'puppet-hiera', type: :boolean, default:
|
37
|
-
method_option 'servers', type: :array, banner: 'Initial list of servers to include in Catfishfile'
|
41
|
+
method_option 'puppet-hiera', type: :boolean, default: true, banner: 'Include hiera templates. Only applies to puppet provisioner'
|
38
42
|
method_option 'plugins', type: :array, banner: 'Vagrant plugins to be installed'
|
39
43
|
def init
|
40
44
|
require 'catfish/cli/init'
|
@@ -53,14 +57,25 @@ module Catfish
|
|
53
57
|
Plugin.new(options.dup).run
|
54
58
|
end
|
55
59
|
|
60
|
+
desc 'clean', 'Clean Catfishfile.lock'
|
61
|
+
def clean
|
62
|
+
require 'catfish/cli/clean'
|
63
|
+
Clean.new.run
|
64
|
+
end
|
65
|
+
|
56
66
|
desc 'provision [OPTIONS]', 'Provision to the servers specified in Catfishfile.lock'
|
57
67
|
method_option 'provider', type: :string, default: 'managed', banner: 'Vagrant provider to use.'
|
58
|
-
method_option 'parallel', type: :boolean, default:
|
68
|
+
method_option 'parallel', type: :boolean, default: false, banner: 'Run provisioning in parallel'
|
59
69
|
def provision
|
70
|
+
exists_before_resolve = File.exist?('Catfishfile.lock')
|
60
71
|
invoke :resolve
|
61
72
|
invoke :plugin
|
62
73
|
require 'catfish/cli/provision'
|
63
74
|
Provision.new(options.dup).run
|
75
|
+
|
76
|
+
# If the Catfishfile.lock existed before the start of the run, then
|
77
|
+
# we should leave it there. Otherwise, we should clean it up.
|
78
|
+
FileUtils.rm 'Catfishfile.lock', force: true unless exists_before_resolve
|
64
79
|
end
|
65
80
|
end
|
66
81
|
end
|
@@ -3,7 +3,6 @@
|
|
3
3
|
|
4
4
|
Vagrant.configure("2") do |config|
|
5
5
|
|
6
|
-
config.vm.box = "tknerr/managed-server-dummy"
|
7
6
|
<% if config[:provisioners].include? 'shell' -%>
|
8
7
|
<% config[:shell_paths].each do |path| -%>
|
9
8
|
config.vm.provision 'shell', path: '<%= path %>'
|
@@ -21,20 +20,36 @@ Vagrant.configure("2") do |config|
|
|
21
20
|
<% end -%>
|
22
21
|
<% if config[:communicator] == 'winrm' -%>
|
23
22
|
config.vm.communicator = '<%= config[:communicator] %>'
|
24
|
-
config.vm.winrm.username = '<%= config[:winrm_username] %>'
|
25
|
-
config.vm.winrm.password = '<%= config[:winrm_password] %>'
|
26
23
|
<% end -%>
|
27
24
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
25
|
+
<% if config[:local] -%>
|
26
|
+
config.vm.define 'local' do |local|
|
27
|
+
local.vm.box = "<%= config[:local_box] %>"
|
28
|
+
<% if config[:local_box_url] -%>
|
29
|
+
local.vm.box_url = "<%= config[:local_box_url] %>"
|
30
|
+
<% end -%>
|
31
|
+
end
|
32
|
+
<% end -%>
|
33
|
+
|
34
|
+
<% if config[:managed] -%>
|
35
|
+
if File.exist?('Catfishfile.lock')
|
36
|
+
instances = File.readlines('Catfishfile.lock').map(&:chomp)
|
37
|
+
instances.each do |instance|
|
38
|
+
config.vm.define "managed-#{instance}" do |box|
|
39
|
+
box.vm.box = "tknerr/managed-server-dummy"
|
40
|
+
box.vm.provider :managed do |managed, override|
|
41
|
+
managed.server = instance
|
33
42
|
<% if config[:communicator] == 'ssh' -%>
|
34
|
-
|
35
|
-
|
43
|
+
override.ssh.username = '<%= config[:ssh_username] %>'
|
44
|
+
override.ssh.private_key_path = '<%= config[:ssh_private_key_path] %>'
|
36
45
|
<% end -%>
|
46
|
+
<% if config[:communicator] == 'winrm' -%>
|
47
|
+
instance.vm.winrm.username = '<%= config[:winrm_username] %>'
|
48
|
+
instance.vm.winrm.password = '<%= config[:winrm_password] %>'
|
49
|
+
<% end -%>
|
50
|
+
end
|
37
51
|
end
|
38
52
|
end
|
39
53
|
end
|
54
|
+
<% end -%>
|
40
55
|
end
|
data/lib/catfish/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: catfish
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Baldauf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- catfish.gemspec
|
86
86
|
- lib/catfish.rb
|
87
87
|
- lib/catfish/cli.rb
|
88
|
+
- lib/catfish/cli/clean.rb
|
88
89
|
- lib/catfish/cli/init.rb
|
89
90
|
- lib/catfish/cli/plugin.rb
|
90
91
|
- lib/catfish/cli/provision.rb
|