ansible-powerplay 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.semver +1 -1
- data/ansible-powerplay.gemspec +3 -3
- data/lib/ansible-powerplay/dsl.rb +4 -2
- data/lib/ansible-powerplay/powerplay.rb +34 -29
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5cfb3603dc0e590de6f8fc01c069e1e15d06c59
|
4
|
+
data.tar.gz: 46bd40dfeb1db350ed3da7a4b05a25396f7932bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c0fc843b9cf1c6a41ede49e8392914e6a6acab1af54f2d0712ff62eac983a691f68d15f27ca5648a4974eeee1a16323ad4bf7f96118d0d406c5ee852dddd39d
|
7
|
+
data.tar.gz: 38ffe69ce84327a335130c73187c11879f98eac8d258d31e71284fad61cef3a9354389cf8c54fc6d8b3fd32113318bacfe30ec6be5b12e094bf1ece2f9a36e42
|
data/.semver
CHANGED
data/ansible-powerplay.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: ansible-powerplay 0.0.
|
5
|
+
# stub: ansible-powerplay 0.0.7 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "ansible-powerplay"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.7"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Fred Mitchell"]
|
14
|
-
s.date = "2016-02-
|
14
|
+
s.date = "2016-02-19"
|
15
15
|
s.description = "Ansible Powerplay, by way of its DSL, allows you to\n specify your Ansible playbooks and their vars, and common\n vars to all, so that you can run your\n indeoendent playbooks in full parallel."
|
16
16
|
s.email = "fred.mitchell@gmx.de"
|
17
17
|
s.executables = ["powerplay"]
|
@@ -3,6 +3,7 @@ module Powerplay
|
|
3
3
|
module DSL
|
4
4
|
@@config_stack = [{}]
|
5
5
|
@@global_config = {}
|
6
|
+
SPECIAL_PARAMS = [:playbook_directory, :inventory]
|
6
7
|
|
7
8
|
def _bump
|
8
9
|
@@config_stack.push @@config_stack.last.clone
|
@@ -62,9 +63,10 @@ module Powerplay
|
|
62
63
|
end
|
63
64
|
|
64
65
|
# Ansible playbook parameters
|
65
|
-
# TODO: there is a bogus playbook_directory param here.
|
66
66
|
def aparams
|
67
|
-
config.map{ |k,v|
|
67
|
+
config.map{ |k,v|
|
68
|
+
"#{k}=#{v.first}" unless DSL::SPECIAL_PARAMS.member?(k)
|
69
|
+
}.compact.join(' ')
|
68
70
|
end
|
69
71
|
end
|
70
72
|
|
@@ -39,8 +39,8 @@ module Powerplay
|
|
39
39
|
def self.playbooks
|
40
40
|
play = Play::clopts[:play].to_sym
|
41
41
|
if play == :all
|
42
|
-
DSL::_global[:playbooks].each do |
|
43
|
-
yield
|
42
|
+
DSL::_global[:playbooks].each do |pplay, group|
|
43
|
+
yield pplay, group
|
44
44
|
end
|
45
45
|
else
|
46
46
|
yield play, DSL::_global[:playbooks][play]
|
@@ -64,33 +64,38 @@ module Powerplay
|
|
64
64
|
puts "PLAYBOOK #{pname} (group=#{Play::clopts[:group]}) -->"
|
65
65
|
groups playbook do |group|
|
66
66
|
tg = nil
|
67
|
-
thrgroups << (tg = Thread.new {
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
67
|
+
thrgroups << (tg = Thread.new {
|
68
|
+
puts " GROUP #{group.type} (book=#{buch}, cg=#{congroups}) -->"
|
69
|
+
thrbooks = []
|
70
|
+
errors = []
|
71
|
+
group.books.zip(Tmux.pane_ptys) do |book, tty|
|
72
|
+
tty ||= Tmux.pane_ptys.last
|
73
|
+
if buch == :all or book.type == buch
|
74
|
+
puts " BOOK #{book.type}"
|
75
|
+
inv = if book.config.member? :inventory
|
76
|
+
"-i #{book.config[:inventory].first}"
|
77
|
+
else
|
78
|
+
''
|
79
|
+
end
|
80
|
+
apcmd = %|#{PLAYBOOK} #{OPTS} #{inv} #{book.config[:playbook_directory].first}/#{book.yaml} --extra-vars "#{book.aparams}" >#{tty}|
|
81
|
+
thrbooks << Thread.new {
|
82
|
+
std, status = Open3.capture2e apcmd
|
83
|
+
errors << [book.yaml, apcmd, std] unless status.success?
|
84
|
+
} unless dryrun
|
85
|
+
end
|
86
|
+
end
|
87
|
+
thrbooks.each{ |t| t.join }
|
88
|
+
unless errors.empty?
|
89
|
+
errors.each do |yaml, cmd, txt|
|
90
|
+
puts '=' * 30
|
91
|
+
puts ('*' * 10) + ' ' + yaml
|
92
|
+
puts txt
|
93
|
+
puts '-' * 30
|
94
|
+
puts cmd
|
95
|
+
end
|
96
|
+
exit 10
|
97
|
+
end
|
98
|
+
})
|
94
99
|
# Always wait here unless we're concurrent
|
95
100
|
thrgroups.join unless congroups
|
96
101
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ansible-powerplay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Mitchell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|