ansible-powerplay 1.3.0 → 1.4.0

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: 4190194915cad33eb4578e63fd965b9ac87431d1
4
- data.tar.gz: d3d3e3289b5e4232c68d0f33fc5dd1d9bfeca75b
3
+ metadata.gz: f2ef0bea5b46f28ddb265a2aebdbd08f3e5adf52
4
+ data.tar.gz: c8679c09170cd69fb6823f7ebbc68c4d20afc05a
5
5
  SHA512:
6
- metadata.gz: cda9fb902dfa37287191a1d097f8522ee593297b425eacfaa3deae1ac5a1cca81160568acf90c763761c345d4eb689741127cb5ee05f3a8d1535166b8ae36291
7
- data.tar.gz: 8f53c342b3c3d36bea51d8833079e424461f9b58d7d97588c49cda84773e5417783d8fde67b8bc4026639bfaa46f6f0eb1fdaa72a5d08c1e665883a4930e8525
6
+ metadata.gz: 00c5b832d1fbd0603a2d97f33b4f017d1ec7b6fcb5014a3e3ec59a878d74c66a535301b41a887bf3c83f923277d9cad606b26d0fd1ca9f4f5ecb962588f46c83
7
+ data.tar.gz: 2ca9ee97c9df189ffec98ff132cc13b16adb25f3ede6e81077a92c8eed2d5bf95ac1040062a21858a97026721903fb83b51dc95067b4788715c3e27f56584557
data/.semver CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 1
3
- :minor: 3
3
+ :minor: 4
4
4
  :patch: 0
5
5
  :special: ''
data/README.org CHANGED
@@ -139,6 +139,32 @@
139
139
  like to see the progress as it runs. You still can using
140
140
  tmux with the --tmux (-m) option.
141
141
 
142
+ *** New TMUX Pane indexing with 1.3.0
143
+ You can now explicity provide a list of pane indicies with your -m command.
144
+ for example, if you want to output to panes 2 and 3 on window 2,
145
+ you would do it thusly:
146
+
147
+ -m=2:2,3
148
+
149
+ Note that the '=' is now required for the use of -m if there is no intervening
150
+ spaces. This might break some Bash scripting, so please be aware of this.
151
+
152
+ You can easily see your pane's indices for any TMUX window by doing
153
+ the "<TMUX key> q" sequence (or whowever you have that functionality mapped).
154
+
155
+ *** New Sequencing with 1.4.x
156
+ We already had sequencing, but now we will allow you
157
+ to use a predefined sequence in the configuration section.
158
+ This will allow you to make proper lists of resources in your
159
+ Ansible playbooks of resources created by sequencing in another
160
+ playbook.
161
+
162
+ Please see [[examples/development.play][development.play]] for an example.
163
+
164
+ The "predefined list" can only currently be used in the context of sequencing.
165
+ Later on, we wish to make this more general. But Ruby underlies the DSL, so you
166
+ can accomplish quite a bit already with just a little Ruby added!
167
+
142
168
  ** DSL Terminology & Documentation
143
169
  Note that this is the DSL for version 1.x of
144
170
  PowerPlay. For 0.x, please see those tags in
@@ -560,5 +586,3 @@ Description:
560
586
  .reject{ |pty| pty == '' }
561
587
  #+end_src
562
588
 
563
-
564
-
data/RELEASE_NOTES.org CHANGED
@@ -7,33 +7,35 @@
7
7
  major number. Of course, you can read all about it here.
8
8
 
9
9
  ** Release Notes
10
- | Release | Feature / Bug | Description | Date |
11
- |---------+----------------------------------------+-----------------------------------------------------------------------------------------------+------------|
12
- | v1.2.0 | Tmux pane numbering | Allows you to specify precisely which panes on your target window that will receive the dump. | 2016-09-01 |
13
- | v1.1.0 | Group sequencing | Allows you to run a group multiple times with sequence numbers. | 2016-08-09 |
14
- | v1.0.8 | --ttys | List specific terminals you'd like the output to go to. | 2016-07-07 |
15
- | v1.0.7 | Verosity Switch --apverbose=n (-Vn) | Pass to ansible-powerplay -v, -vv, etc. | |
16
- | v1.0.6 | Ansible Verbosity | Pass to Ansi | |
17
- | v1.0.5 | Many bug fixes | Critical bugs all fixed. | |
18
- | v1.0.3 | DSL book | changed the named paramer back to the normal one. | 2016-06-08 |
19
- | v1.0.0 | version | Prints version | 2016-06-04 |
20
- | | powerplay / pp shorthand command | Play task defaults if you use the shorthand 'pp' on the commandline | 2016-06-04 |
21
- | | DSL incompatible changes | Nestable groups, naked books. older DSL not gauranteed to be compatable. | |
22
- | | Internal rewrite of the execution flow | Logic for execution flow rewritten to allow fine-grained control over what is sync and async. | |
23
- | | Internal NOOP books | We need to demarcate groups executing synchronously that they themselves have async members. | |
24
- | v0.2.3 | --verbose | Will display Ansible commands on a --verbosity=1 or higher. | 2016-03-17 |
25
- | v0.2.2 | --tags, --skip-tags | Ansible tag support | 2016-03-07 |
26
- | v0.2.1 | --extra-vars | A way of passing extra vars to the Ansible playbooks. Please see the documentation | 2016-03-01 |
27
- | v0.2.0 | powerplay play (behavior change) | If script is not given, now defaults to 'stack.play' in the current directory. | 2016-02-29 |
28
- | v0.1.3 | --tmux | Better handling at distributing the panes. | 2016-02-26 |
29
- | v0.1.2 | --tmux. --no-tmux | Default output now goes to current tty | 2016-02-23 |
30
- | v0.1.1 | --book, --group, --play | Minor bug with the array handling | 2016-02-22 |
31
- | v0.1.0 | --book, --group, --play | Now each can take multiple specifications | 2016-02-22 |
32
- | v0.0.8 | Creation of these Release Notes | About bloody time. The prior releases were all mostly bug fixes, and so... | 2016-02-20 |
33
- | | --tmux | Now you can optionally specify the window number | |
34
- | | --tmux | Now checks to ensure it does not dump to its own pane | |
35
- | | --book | You can select an individual playbook to run | |
36
- | | --group | You can select an individual group to run | |
10
+ | Release | Feature / Bug | Description | Date |
11
+ |---------+-------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+------------|
12
+ | v1.4.0 | --extra-vars passed as JSON, config referencing | We now convert the variables to JSON before passing to --extra-vars, and also now allow you to reference the config variables in the squence. | 2061-09-02 |
13
+ | | | Know that the -m parameter, since it is a bit more general, now requires you to put in an '=' if the string is adjacent to the -m, e.g. -m=0:2 | |
14
+ | v1.3.0 | Tmux pane numbering | Allows you to specify precisely which panes on your target window that will receive the dump. | 2016-09-01 |
15
+ | v1.1.0 | Group sequencing | Allows you to run a group multiple times with sequence numbers. | 2016-08-09 |
16
+ | v1.0.8 | --ttys | List specific terminals you'd like the output to go to. | 2016-07-07 |
17
+ | v1.0.7 | Verosity Switch --apverbose=n (-Vn) | Pass to ansible-powerplay -v, -vv, etc. | |
18
+ | v1.0.6 | Ansible Verbosity | Pass to Ansi | |
19
+ | v1.0.5 | Many bug fixes | Critical bugs all fixed. | |
20
+ | v1.0.3 | DSL book | changed the named paramer back to the normal one. | 2016-06-08 |
21
+ | v1.0.0 | version | Prints version | 2016-06-04 |
22
+ | | powerplay / pp shorthand command | Play task defaults if you use the shorthand 'pp' on the commandline | 2016-06-04 |
23
+ | | DSL incompatible changes | Nestable groups, naked books. older DSL not gauranteed to be compatable. | |
24
+ | | Internal rewrite of the execution flow | Logic for execution flow rewritten to allow fine-grained control over what is sync and async. | |
25
+ | | Internal NOOP books | We need to demarcate groups executing synchronously that they themselves have async members. | |
26
+ | v0.2.3 | --verbose | Will display Ansible commands on a --verbosity=1 or higher. | 2016-03-17 |
27
+ | v0.2.2 | --tags, --skip-tags | Ansible tag support | 2016-03-07 |
28
+ | v0.2.1 | --extra-vars | A way of passing extra vars to the Ansible playbooks. Please see the documentation | 2016-03-01 |
29
+ | v0.2.0 | powerplay play (behavior change) | If script is not given, now defaults to 'stack.play' in the current directory. | 2016-02-29 |
30
+ | v0.1.3 | --tmux | Better handling at distributing the panes. | 2016-02-26 |
31
+ | v0.1.2 | --tmux. --no-tmux | Default output now goes to current tty | 2016-02-23 |
32
+ | v0.1.1 | --book, --group, --play | Minor bug with the array handling | 2016-02-22 |
33
+ | v0.1.0 | --book, --group, --play | Now each can take multiple specifications | 2016-02-22 |
34
+ | v0.0.8 | Creation of these Release Notes | About bloody time. The prior releases were all mostly bug fixes, and so... | 2016-02-20 |
35
+ | | --tmux | Now you can optionally specify the window number | |
36
+ | | --tmux | Now checks to ensure it does not dump to its own pane | |
37
+ | | --book | You can select an individual playbook to run | |
38
+ | | --group | You can select an individual group to run | |
37
39
 
38
40
  ** Known Outstanding Issues
39
41
  Bugs and missing features that needs to be addressed. As they are,
@@ -56,6 +58,7 @@
56
58
 
57
59
  | Date | Wish | Description |
58
60
  |------------+---------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
61
+ | 2016-09-02 | Handle --ask-pass | A user requested this, and will be addressed shortly. |
59
62
  | 2016-02-20 | Integration with Jenkins | I have no idea what form this will take |
60
63
  | | Curses integration | Basically, the tmux integration is used because it was quick to do. But what I really want to do is full Curses support, similar with what you see with htop and other tools. |
61
64
  | 2016-02-26 | Better and Error handling | When there's a failure in the underlying Ansible playbook, we want to handle that better in Powerplay. This would be a part of the Curses upgrade to come later. |
data/Rakefile CHANGED
@@ -31,7 +31,7 @@ Juwelier::Tasks.new do |gem|
31
31
  gem.email = "fred.mitchell@gmx.de"
32
32
  gem.authors = ["Fred Mitchell"]
33
33
  gem.version = s_version
34
- gem.required_ruby_version = '>= 2.0'
34
+ gem.required_ruby_version = '>= 2.2'
35
35
 
36
36
  # Exclusions
37
37
  gem.files.exclude 'foo/**/*', 'rdoc/*', 'examples/*', '*.log',
@@ -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 1.3.0 ruby lib
5
+ # stub: ansible-powerplay 1.4.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "ansible-powerplay"
9
- s.version = "1.3.0"
9
+ s.version = "1.4.0"
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-09-01"
14
+ s.date = "2016-09-02"
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", "pp"]
@@ -41,6 +41,7 @@ Gem::Specification.new do |s|
41
41
  "examples/playbooks/rabbitmq.yml",
42
42
  "examples/playbooks/rat.yml",
43
43
  "examples/playbooks/second.yml",
44
+ "examples/playbooks/seq-example.yml",
44
45
  "lib/ansible-powerplay.rb",
45
46
  "lib/ansible-powerplay/cli.rb",
46
47
  "lib/ansible-powerplay/dsl.rb",
@@ -50,7 +51,7 @@ Gem::Specification.new do |s|
50
51
  ]
51
52
  s.homepage = "http://github.com/flajann2/ansible-powerplay"
52
53
  s.licenses = ["MIT"]
53
- s.required_ruby_version = Gem::Requirement.new(">= 2.0")
54
+ s.required_ruby_version = Gem::Requirement.new(">= 2.2")
54
55
  s.rubygems_version = "2.5.1"
55
56
  s.summary = "Powerplay enables you to run Ansible playbooks in parallel."
56
57
 
@@ -9,7 +9,7 @@
9
9
  - { 00 : nat, 01 : hello, 02 : world }
10
10
  - name: test fact and passed in variables
11
11
  debug:
12
- msg: "NAT test {{nat}} stack {{stack}} AWS instance type {{aws_type}} AWS disk size {{aws_disk_size}}"
12
+ msg: "iter {{iter | default('Not Defined')}} NAT test {{nat}} stack {{stack}} AWS instance type {{aws_type}} AWS disk size {{aws_disk_size}}"
13
13
  - name: wait 5 seconds
14
14
  pause:
15
15
  seconds: 5
@@ -0,0 +1,15 @@
1
+ ---
2
+ - hosts: local
3
+ connection: local
4
+ gather_facts: False
5
+ tasks:
6
+ - name: setting a fact
7
+ set_fact:
8
+ nat:
9
+ - { 00 : nat, 01 : hello, 02 : world }
10
+ - name: test fact and passed in variables
11
+ debug:
12
+ msg: "Seq iteration {{iter}} from a list of {{predefined_list_of_stuff}}"
13
+ - name: wait 5 seconds
14
+ pause:
15
+ seconds: 5
@@ -6,6 +6,7 @@ require 'thread'
6
6
  require 'colorize'
7
7
  require 'queue_ding'
8
8
  require 'awesome_print'
9
+ require 'json'
9
10
 
10
11
  def s_version
11
12
  SemVer.find.format "v%M.%m.%p%s"
@@ -59,6 +59,9 @@ LONGDESC
59
59
  desc: "Ansible tags to skip - mutually exclusive with --tags"
60
60
  option :apverbose, type: :numeric, banner: '[1|2|3|4]', aliases: '-V', default: 0,
61
61
  desc: "Pass to ansible-playbook -v, -vv, etc. verbosity flags"
62
+ option :nojson, type: :boolean, aliases: ['--no-json', '-J'],
63
+ desc: "Submit --extra-vars as key-value pairs (old behavior), rather than JSON. Will affect new features in 1.4.0 and beyond.",
64
+ default: false
62
65
  def play(script = 'stack.play')
63
66
  DSL::_global[:options] = massage options
64
67
  puts "script %s " % [script] if DSL::_global[:options][:verbose] >= 1
@@ -86,7 +86,7 @@ module Powerplay
86
86
  end
87
87
  end
88
88
 
89
- # we do allow for noop books
89
+ # We do allow for noop books
90
90
  class DslBook < Dsl
91
91
  attr :yaml, :plan, :group
92
92
 
@@ -100,11 +100,24 @@ module Powerplay
100
100
  @config = _dip
101
101
  end
102
102
 
103
- # Ansible playbook parameters
104
- def aparams
105
- config.map{ |k,v|
106
- "#{k}=#{v.first}" unless DSL::SPECIAL_PARAMS.member?(k)
107
- }.compact.join(' ')
103
+ # Ansible playbook parameters.
104
+ # Additional is a string of key=value pairs that is appended.
105
+ # In the case of JSON output, it is appended in the JSON structure.
106
+ def aparams(additional = '')
107
+ unless Play.clopts[:nojson]
108
+ config
109
+ .map{ |k, v| [k, v.first] }
110
+ .to_h
111
+ .reject{ |k, v| DSL::SPECIAL_PARAMS.member?(k) }
112
+ .merge(additional
113
+ .split
114
+ .map{|s| s.split('=')}.to_h)
115
+ .to_json
116
+ else
117
+ config.map{ |k,v|
118
+ "#{k}=#{v.first}" unless DSL::SPECIAL_PARAMS.member?(k)
119
+ }.compact.join(' ') + ' ' + additional
120
+ end
108
121
  end
109
122
 
110
123
  def family
@@ -126,7 +139,11 @@ module Powerplay
126
139
  _enqueue DslBook.new(:noop, nil, plan: @exec) unless @exec == :async or _sneak.type == :sync
127
140
  else
128
141
  seq.each do |var, list|
129
- list.each do |value|
142
+ unless list.is_a? Array
143
+ config[:vars][list].first
144
+ else
145
+ list
146
+ end.each do |value|
130
147
  _bump
131
148
  _config[var] = [value]
132
149
  DslGroup.new(name, desc, plan, self, &block)
@@ -120,13 +120,13 @@ module Powerplay
120
120
  (grouppe.first == :all or not (grouppe & book.family).empty?)
121
121
  puts " BOOK #{book.type}"
122
122
  inv = if book.config.member? :inventory
123
- "-i #{book.config[:inventory].first}"
123
+ "-i #{book.config[:inventory].first}"
124
124
  else
125
125
  ''
126
126
  end
127
- xxv = [extra[book.type], extra[:all]].compact.join(' ')
127
+ xxv = [extra[book.type], extra[:all]].compact.join(' ') # a=b c=d ...
128
128
  redirect = (tmuxout.nil?) ? '' : " > #{tty}"
129
- apcmd = %|#{PLAYBOOK} #{OPTS} #{inv} #{book.config[:playbook_directory].first}/#{book.yaml} #{tagstr} --extra-vars "#{book.aparams} #{xxv}" #{verb} #{redirect}|
129
+ apcmd = %|#{PLAYBOOK} #{OPTS} #{inv} #{book.config[:playbook_directory].first}/#{book.yaml} #{tagstr} --extra-vars '#{book.aparams(xxv)}' #{verb} #{redirect}|
130
130
  unless DSL::_verbosity < 1
131
131
  puts "==============================".green
132
132
  puts "Running #{book.plan} book ".light_yellow +
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: 1.3.0
4
+ version: 1.4.0
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-09-01 00:00:00.000000000 Z
11
+ date: 2016-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -339,6 +339,7 @@ files:
339
339
  - examples/playbooks/rabbitmq.yml
340
340
  - examples/playbooks/rat.yml
341
341
  - examples/playbooks/second.yml
342
+ - examples/playbooks/seq-example.yml
342
343
  - lib/ansible-powerplay.rb
343
344
  - lib/ansible-powerplay/cli.rb
344
345
  - lib/ansible-powerplay/dsl.rb
@@ -357,7 +358,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
357
358
  requirements:
358
359
  - - ">="
359
360
  - !ruby/object:Gem::Version
360
- version: '2.0'
361
+ version: '2.2'
361
362
  required_rubygems_version: !ruby/object:Gem::Requirement
362
363
  requirements:
363
364
  - - ">="