ansible-powerplay 0.0.4 → 0.0.5
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 +2 -2
- data/lib/ansible-powerplay/cli.rb +1 -0
- data/lib/ansible-powerplay/powerplay.rb +31 -24
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88303d0e049d649b8d969e872a412cffc9d96162
|
4
|
+
data.tar.gz: ffc30cbff29524a0a3abdf69d8362b02e1d05981
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31e69ea4973bb82ef4e4e6318ca7eb55aea56b1905bda91ee4b88bcd2df385b2ebf46c67e92428f9461bac505528516bc567d34bf4d3550ee80f98701538893b
|
7
|
+
data.tar.gz: 454af5e1e9112a5cdfddd017aa68598fbdef398091a726120f40bb7dca0cd225fe03e8b51449757c603e03fe3e828dbcaebf530dbb7f7acf3ee29f255e944baf
|
data/.semver
CHANGED
data/ansible-powerplay.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
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.5 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.5"
|
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"]
|
@@ -16,6 +16,7 @@ module Powerplay
|
|
16
16
|
option :tmux, type: :boolean, aliases: '-m', banner: "send output to all tmux panes in the current window"
|
17
17
|
option :play, type: :string, banner: "[NAME|all] Which playbook shelf", required: true
|
18
18
|
option :group, type: :string, banner: "[NAME|all] Which group to execute", default: "all"
|
19
|
+
option :congroups, type: :boolean, aliases: '-c', banner: "Run the groups themselves concurrently"
|
19
20
|
option :book, type: :string, banner: "[NAME|all] Which book to execute", default: "all"
|
20
21
|
option :dryrun, type: :boolean, banner: "Dry run, do not actually execute."
|
21
22
|
def play(script)
|
@@ -50,36 +50,43 @@ module Powerplay
|
|
50
50
|
def self.power_run
|
51
51
|
buch = Play::clopts[:book].to_sym
|
52
52
|
dryrun = Play::clopts[:dryrun]
|
53
|
-
|
53
|
+
congroups = Play::clopts[:congroups]
|
54
54
|
playbooks do |pname, playbook|
|
55
|
+
thrgroups = []
|
55
56
|
puts "PLAYBOOK #{pname} (group=#{Play::clopts[:group]}) -->"
|
56
57
|
groups playbook do |group|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
58
|
+
tg = nil
|
59
|
+
thrgroups << (tg = Thread.new {
|
60
|
+
puts " GROUP #{group.type} (book=#{buch}, cg=#{congroups}) -->"
|
61
|
+
thrbooks = []
|
62
|
+
errors = []
|
63
|
+
group.books.zip(Tmux.pane_ptys) do |book, tty|
|
64
|
+
tty ||= Tmux.pane_ptys.last
|
65
|
+
if buch == :all or book.type == buch
|
66
|
+
puts " BOOK #{book.type}"
|
67
|
+
apcmd = %|#{PLAYBOOK} #{OPTS} #{book.config[:playbook_directory].first}/#{book.yaml} --extra-vars "#{book.aparams}" >#{tty}|
|
68
|
+
thrbooks << Thread.new {
|
69
|
+
std, status = Open3.capture2e apcmd
|
70
|
+
errors << [book.yaml, apcmd, std] unless status.success?
|
71
|
+
} unless dryrun
|
72
|
+
end
|
69
73
|
end
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
74
|
+
thrbooks.each{ |t| t.join }
|
75
|
+
unless errors.empty?
|
76
|
+
errors.each do |yaml, cmd, txt|
|
77
|
+
puts '=' * 30
|
78
|
+
puts ('*' * 10) + ' ' + yaml
|
79
|
+
puts txt
|
80
|
+
puts '-' * 30
|
81
|
+
puts cmd
|
82
|
+
end
|
83
|
+
exit 10
|
79
84
|
end
|
80
|
-
|
81
|
-
|
85
|
+
})
|
86
|
+
# Always wait here unless we're concurrent
|
87
|
+
thrgroups.join unless congroups
|
82
88
|
end
|
89
|
+
thrgroups.each{ |t| t.join }
|
83
90
|
end
|
84
91
|
end
|
85
92
|
end
|