catfish 0.0.4 → 0.0.5
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/.gitignore +3 -0
- data/.travis.yml +13 -0
- data/README.md +11 -1
- data/Rakefile +4 -1
- data/lib/catfish/cli.rb +6 -9
- data/lib/catfish/cli/init.rb +32 -10
- data/lib/catfish/cli/provision.rb +2 -2
- data/lib/catfish/templates/Vagrantfile.tt +10 -2
- data/lib/catfish/templates/puppet/Puppetfile.tt +7 -0
- data/lib/catfish/templates/puppet/hiera.yaml.tt +10 -0
- data/lib/catfish/templates/puppet/hiera/common.yaml.tt +2 -0
- data/lib/catfish/templates/puppet/manifests/default.pp.tt +3 -0
- data/lib/catfish/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd4f16456fc2a0292aaa6f563b208221a7d773f1
|
4
|
+
data.tar.gz: 5427abeed216170b88c413e07c561bfed507579b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d66e6106c7a1b0d6b3e3dc145fd1d5fe43e35a98f94d14c6c63e3289f46bf620a7b9883381950e43ed6d97d76f77936d735d063162f438afbfbad7de76cb26d
|
7
|
+
data.tar.gz: 8d57477e3863d3660c7d9804b8ec04ef0e8a4c272ebcdb7d5f291a58c97e767d5f66994184c7629363e5cdc88c8ba2b5a626407c2dec2776bbb9d58ee574b89d
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 1.9.3
|
4
|
+
- 2.0.0
|
5
|
+
notifications:
|
6
|
+
email:
|
7
|
+
- chris.baldauf@gmail.com
|
8
|
+
deploy:
|
9
|
+
provider: rubygems
|
10
|
+
on:
|
11
|
+
tags: true
|
12
|
+
api_key:
|
13
|
+
secure: rt3BC6VAszR2ZxjlEmW6AJiqDa/12GdY5KXL4VEXnagyIT9UEjCBHzaNdBTFeSagEskMlMxgNi/UCpGg8eWXbSoesIpFdVBo8W8drNDf13eCMgfJaI5TeWnc5DYRJEduXRNdWTmznUQ8DYZylExeTFKxAAZdiceGBq4bJGFtzc8=
|
data/README.md
CHANGED
@@ -50,6 +50,16 @@ And you can even run the provisioning in parallel
|
|
50
50
|
|
51
51
|
$ catfish provision --parallel
|
52
52
|
|
53
|
+
### Plugins
|
54
|
+
You can have catfish ensure that vagrant plugins are installed via the 'plugin'
|
55
|
+
directive in your Catfishfile.
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
plugin 'vagrant-hostmaster'
|
59
|
+
```
|
60
|
+
|
61
|
+
$ catfish plugin
|
62
|
+
|
53
63
|
### Getting help
|
54
64
|
|
55
65
|
$ catfish help
|
@@ -57,7 +67,7 @@ And you can even run the provisioning in parallel
|
|
57
67
|
## TODO
|
58
68
|
|
59
69
|
- Puppet provisioner support
|
60
|
-
-
|
70
|
+
- Add some spec tests
|
61
71
|
|
62
72
|
## Contributing
|
63
73
|
|
data/Rakefile
CHANGED
@@ -2,6 +2,9 @@ require 'bundler/gem_tasks'
|
|
2
2
|
require 'rubocop/rake_task'
|
3
3
|
require 'rake/clean'
|
4
4
|
|
5
|
-
CLEAN.include('Catfishfile', 'Catfishfile.lock', 'Vagrantfile'
|
5
|
+
CLEAN.include('Catfishfile', 'Catfishfile.lock', 'Vagrantfile', 'modules',
|
6
|
+
'Puppetfile*', 'manifests', 'hiera.yaml', 'hiera')
|
6
7
|
|
7
8
|
RuboCop::RakeTask.new
|
9
|
+
|
10
|
+
task default: :install
|
data/lib/catfish/cli.rb
CHANGED
@@ -5,15 +5,6 @@ module Catfish
|
|
5
5
|
class CLI < Thor
|
6
6
|
include Thor::Actions
|
7
7
|
|
8
|
-
# def self.start(*)
|
9
|
-
# super
|
10
|
-
# rescue Exception => e
|
11
|
-
# Bundler.ui = UI::Shell.new
|
12
|
-
# raise e
|
13
|
-
# ensure
|
14
|
-
# Bundler.cleanup
|
15
|
-
# end
|
16
|
-
|
17
8
|
def initialize(*args)
|
18
9
|
super
|
19
10
|
rescue UnknownArgumentError => e
|
@@ -32,11 +23,17 @@ module Catfish
|
|
32
23
|
D
|
33
24
|
method_option 'provisioners', type: :array, banner: 'A list of vagrant provisiners to use'
|
34
25
|
method_option 'communicator', type: :string, banner: 'The communicator. ssh (default) or winrm'
|
26
|
+
method_option 'windows', type: :boolean, banner: 'Shorthand for --communicator=winrm'
|
35
27
|
method_option 'winrm-username', type: :string, banner: 'Username for winrm. Used with --communicator=winrm'
|
36
28
|
method_option 'winrm-password', type: :string, banner: 'Password for winrm. Used with --communicator=winrm'
|
29
|
+
method_option 'shell', type: :boolean, banner: 'Shorthand for provisioners=shell'
|
37
30
|
method_option 'shell-paths', type: :array, banner: 'A list of paths to use if shell provisioning is selected'
|
38
31
|
method_option 'ssh-username', type: :string, banner: 'SSH username'
|
39
32
|
method_option 'ssh-private-key-path', type: :string, banner: 'Path to SSH private key'
|
33
|
+
method_option 'puppet', type: :boolean, banner: 'Shorthand for provisioners=puppet'
|
34
|
+
method_option 'puppet-librarian-puppet', type: :boolean, default: 'true',
|
35
|
+
banner: 'Whether or not to include a default Puppetfile and librarian puppet plugin'
|
36
|
+
method_option 'puppet-hiera', type: :boolean, default: 'true', banner: 'Include hiera templates. Only applies to puppet provisioner'
|
40
37
|
method_option 'servers', type: :array, banner: 'Initial list of servers to include in Catfishfile'
|
41
38
|
method_option 'plugins', type: :array, banner: 'Vagrant plugins to be installed'
|
42
39
|
def init
|
data/lib/catfish/cli/init.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'pp'
|
2
|
+
|
1
3
|
module Catfish
|
2
4
|
class CLI
|
3
5
|
class Init
|
@@ -11,30 +13,50 @@ module Catfish
|
|
11
13
|
def run
|
12
14
|
p 'Initializing Catfish repository'
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
16
|
+
provisioners = options[:provisioners] || []
|
17
|
+
plugins = options[:plugins] || []
|
18
|
+
|
19
|
+
# Shorthand aliases
|
20
|
+
options[:communicator] = 'winrm' if options[:windows]
|
21
|
+
provisioners << 'shell' if options[:shell]
|
22
|
+
provisioners << 'puppet' if options[:puppet]
|
23
|
+
plugins << 'vagrant-librarian-puppet' if options['puppet-librarian-puppet']
|
18
24
|
|
19
25
|
opts = {
|
20
|
-
provisioners:
|
26
|
+
provisioners: provisioners || [],
|
21
27
|
shell_paths: options['shell-paths'] || ['{{PATH_TO_YOUR_SCRIPT}}'],
|
28
|
+
puppet_hiera: options['puppet-hiera'],
|
29
|
+
puppet_librarian_puppet: options['puppet-librarian-puppet'],
|
22
30
|
communicator: options[:communicator] || 'ssh',
|
23
31
|
winrm_username: options['winrm-username'] || '{{YOUR_WINRM_USERNAME}}',
|
24
32
|
winrm_password: options['winrm-password'] || '{{YOUR_WINRM_PASSWORD}}',
|
25
33
|
ssh_username: options['ssh-username'] || '{{YOUR_SSH_USERNAME}}',
|
26
34
|
ssh_private_key_path: options['ssh-private-key-path'] || '{{PATH_TO_YOUR_SSH_PRIVATE_KEY}}',
|
27
35
|
servers: options['servers'] || [],
|
28
|
-
plugins:
|
36
|
+
plugins: plugins || []
|
37
|
+
}
|
38
|
+
|
39
|
+
templates = {
|
40
|
+
'Catfishfile.tt' => 'Catfishfile',
|
41
|
+
'Vagrantfile.tt' => 'Vagrantfile'
|
29
42
|
}
|
30
43
|
|
44
|
+
if provisioners.include? 'puppet'
|
45
|
+
templates.merge!('puppet/manifests/default.pp.tt' => 'manifests/default.pp')
|
46
|
+
templates.merge!('puppet/Puppetfile.tt' => 'Puppetfile') if options['puppet-librarian-puppet']
|
47
|
+
|
48
|
+
if options['puppet-hiera']
|
49
|
+
templates.merge!('puppet/hiera.yaml.tt' => 'hiera.yaml')
|
50
|
+
templates.merge!('puppet/hiera/common.yaml.tt' => 'hiera/common.yaml')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
31
54
|
templates.each do |src, dst|
|
32
55
|
thor.template(src, dst, opts)
|
33
56
|
end
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
p ' - Run catfish resolve'
|
57
|
+
puts 'Repository initialized. Remember to:'
|
58
|
+
puts ' - Check your Vagrantfile and replace any placeholders'
|
59
|
+
puts ' - Edit your Catfish file and list target servers'
|
38
60
|
end
|
39
61
|
end
|
40
62
|
end
|
@@ -19,7 +19,7 @@ module Catfish
|
|
19
19
|
abort 'ERROR DEPLOYING: One or more servers could not be connected to'
|
20
20
|
end
|
21
21
|
|
22
|
-
provision
|
22
|
+
provision status
|
23
23
|
|
24
24
|
ensure
|
25
25
|
|
@@ -36,7 +36,7 @@ module Catfish
|
|
36
36
|
fail "#{vagrant_version} or greater is a prerequisite" unless `vagrant --version`.include? vagrant_version
|
37
37
|
end
|
38
38
|
|
39
|
-
def provision
|
39
|
+
def provision(status)
|
40
40
|
if options[:parallel]
|
41
41
|
machines = status.split("\n").collect do |line|
|
42
42
|
line.split(',')[1]
|
@@ -4,12 +4,20 @@
|
|
4
4
|
Vagrant.configure("2") do |config|
|
5
5
|
|
6
6
|
config.vm.box = "tknerr/managed-server-dummy"
|
7
|
-
<% config[:provisioners].
|
8
|
-
<% if provisioner == 'shell' -%>
|
7
|
+
<% if config[:provisioners].include? 'shell' -%>
|
9
8
|
<% config[:shell_paths].each do |path| -%>
|
10
9
|
config.vm.provision 'shell', path: '<%= path %>'
|
11
10
|
<% end -%>
|
12
11
|
<% end -%>
|
12
|
+
<% if config[:provisioners].include? 'puppet' -%>
|
13
|
+
config.vm.provision 'puppet' do |puppet|
|
14
|
+
<% if config[:puppet_hiera] -%>
|
15
|
+
puppet.hiera_config_path = 'hiera.yaml'
|
16
|
+
<% end -%>
|
17
|
+
<% if config[:puppet_librarian_puppet] -%>
|
18
|
+
puppet.module_path = 'modules'
|
19
|
+
<% end -%>
|
20
|
+
end
|
13
21
|
<% end -%>
|
14
22
|
<% if config[:communicator] == 'winrm' -%>
|
15
23
|
config.vm.communicator = '<%= config[:communicator] %>'
|
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.5
|
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-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -76,6 +76,7 @@ extra_rdoc_files: []
|
|
76
76
|
files:
|
77
77
|
- .gitignore
|
78
78
|
- .rubocop.yml
|
79
|
+
- .travis.yml
|
79
80
|
- Gemfile
|
80
81
|
- LICENSE
|
81
82
|
- README.md
|
@@ -91,6 +92,10 @@ files:
|
|
91
92
|
- lib/catfish/dsl.rb
|
92
93
|
- lib/catfish/templates/Catfishfile.tt
|
93
94
|
- lib/catfish/templates/Vagrantfile.tt
|
95
|
+
- lib/catfish/templates/puppet/Puppetfile.tt
|
96
|
+
- lib/catfish/templates/puppet/hiera.yaml.tt
|
97
|
+
- lib/catfish/templates/puppet/hiera/common.yaml.tt
|
98
|
+
- lib/catfish/templates/puppet/manifests/default.pp.tt
|
94
99
|
- lib/catfish/version.rb
|
95
100
|
homepage: https://github.com/chrisbaldauf/catfish
|
96
101
|
licenses:
|