qb 0.3.12 → 0.3.13

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.
Files changed (367) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +3 -1
  3. data/README.md +42 -26
  4. data/ansible.cfg +7 -0
  5. data/doc/common_issues/qb_run/slow_gather_facts.md +51 -0
  6. data/doc/getting_started.md +84 -0
  7. data/doc/intro.md +67 -0
  8. data/doc/notes/2018.01.06.ansible_devel_submodule.md +29 -0
  9. data/doc/qb_roles.md +155 -0
  10. data/doc/qb_roles/metadata/default_dir.md +116 -0
  11. data/exe/qb +16 -14
  12. data/lib/qb.rb +5 -20
  13. data/lib/qb/ansible/cmds/playbook.rb +3 -4
  14. data/lib/qb/ansible/env.rb +22 -2
  15. data/lib/qb/ansible/env/devel.rb +49 -0
  16. data/lib/qb/cli.rb +3 -1
  17. data/lib/qb/cli/help.rb +1 -1
  18. data/lib/qb/cli/list.rb +47 -0
  19. data/lib/qb/cli/run.rb +41 -15
  20. data/lib/qb/cli/setup.rb +35 -2
  21. data/lib/qb/options.rb +57 -30
  22. data/lib/qb/role.rb +32 -170
  23. data/lib/qb/role/default_dir.rb +231 -0
  24. data/lib/qb/role/errors.rb +18 -10
  25. data/lib/qb/role/name.rb +139 -0
  26. data/lib/qb/util/logging.rb +0 -7
  27. data/lib/qb/version.rb +1 -1
  28. data/library/stream +5 -0
  29. data/plugins/filter_plugins/string_plugins.py +2 -3
  30. data/plugins/filter_plugins/version_plugins.py +11 -0
  31. data/qb.gemspec +158 -62
  32. data/roles/nrser.blockinfile/library/blockinfile.py +14 -0
  33. data/roles/qb.git_repo/tasks/main.yml +3 -3
  34. data/roles/qb.npm_package/meta/main.yml +2 -2
  35. data/roles/qb.npm_package/meta/qb.yml +3 -3
  36. data/roles/qb.vars/meta/qb.yml +8 -7
  37. data/roles/qb.vars/tasks/main.yml +10 -1
  38. data/roles/qb/call/defaults/main.yml +2 -0
  39. data/roles/qb/call/meta/main.yml +8 -0
  40. data/roles/qb/call/meta/qb.yml +68 -0
  41. data/roles/qb/call/tasks/main.yml +92 -0
  42. data/roles/qb/gem/new/meta/qb.yml +1 -1
  43. data/roles/qb/gem/new/tasks/main.yml +3 -3
  44. data/roles/qb/gem/release/tasks/main.yml +3 -5
  45. data/roles/{qb.gitignore → qb/git/ignore}/defaults/main.yml +1 -1
  46. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  47. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Actionscript.gitignore +2 -3
  48. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Ada.gitignore +0 -0
  49. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Agda.gitignore +0 -0
  50. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Android.gitignore +3 -2
  51. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/AppEngine.gitignore +0 -0
  52. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/AppceleratorTitanium.gitignore +0 -0
  53. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/ArchLinuxPackages.gitignore +0 -0
  54. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Autotools.gitignore +9 -0
  55. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/C++.gitignore +0 -0
  56. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/C.gitignore +0 -0
  57. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/CFWheels.gitignore +0 -0
  58. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/CMake.gitignore +0 -0
  59. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/CONTRIBUTING.md +0 -0
  60. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/CUDA.gitignore +0 -0
  61. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/CakePHP.gitignore +0 -0
  62. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/ChefCookbook.gitignore +0 -0
  63. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Clojure.gitignore +0 -0
  64. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/CodeIgniter.gitignore +0 -0
  65. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/CommonLisp.gitignore +0 -0
  66. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Composer.gitignore +1 -1
  67. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Concrete5.gitignore +0 -0
  68. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Coq.gitignore +0 -0
  69. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/CraftCMS.gitignore +0 -0
  70. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/D.gitignore +0 -0
  71. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/DM.gitignore +0 -0
  72. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Dart.gitignore +0 -0
  73. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Delphi.gitignore +0 -0
  74. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Drupal.gitignore +3 -0
  75. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/EPiServer.gitignore +0 -0
  76. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Eagle.gitignore +0 -0
  77. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Elisp.gitignore +0 -0
  78. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Elixir.gitignore +2 -0
  79. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Elm.gitignore +0 -0
  80. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Erlang.gitignore +0 -0
  81. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/ExpressionEngine.gitignore +0 -0
  82. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/ExtJs.gitignore +2 -0
  83. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Fancy.gitignore +0 -0
  84. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Finale.gitignore +0 -0
  85. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/ForceDotCom.gitignore +0 -0
  86. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Fortran.gitignore +0 -0
  87. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/FuelPHP.gitignore +0 -0
  88. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/GWT.gitignore +0 -0
  89. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Gcov.gitignore +0 -0
  90. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Gem.gitignore +0 -0
  91. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/GitBook.gitignore +0 -0
  92. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Anjuta.gitignore +0 -0
  93. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Ansible.gitignore +0 -0
  94. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Archives.gitignore +2 -2
  95. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Bazaar.gitignore +0 -0
  96. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/BricxCC.gitignore +0 -0
  97. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/CVS.gitignore +0 -0
  98. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Calabash.gitignore +0 -0
  99. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Cloud9.gitignore +0 -0
  100. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/CodeKit.gitignore +0 -0
  101. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/DartEditor.gitignore +0 -0
  102. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Dreamweaver.gitignore +0 -0
  103. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Dropbox.gitignore +0 -0
  104. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Eclipse.gitignore +0 -0
  105. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/EiffelStudio.gitignore +0 -0
  106. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Emacs.gitignore +0 -0
  107. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Ensime.gitignore +0 -0
  108. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Espresso.gitignore +0 -0
  109. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/FlexBuilder.gitignore +0 -0
  110. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/GPG.gitignore +0 -0
  111. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/JDeveloper.gitignore +0 -0
  112. data/roles/qb/git/ignore/files/gitignore/Global/JEnv.gitignore +5 -0
  113. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/JetBrains.gitignore +2 -1
  114. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/KDevelop4.gitignore +0 -0
  115. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Kate.gitignore +0 -0
  116. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Lazarus.gitignore +0 -0
  117. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/LibreOffice.gitignore +0 -0
  118. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Linux.gitignore +0 -0
  119. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/LyX.gitignore +0 -0
  120. data/roles/qb/git/ignore/files/gitignore/Global/Matlab.gitignore +25 -0
  121. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Mercurial.gitignore +0 -0
  122. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/MicrosoftOffice.gitignore +0 -0
  123. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/ModelSim.gitignore +0 -0
  124. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Momentics.gitignore +0 -0
  125. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/MonoDevelop.gitignore +0 -0
  126. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/NetBeans.gitignore +0 -0
  127. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Ninja.gitignore +0 -0
  128. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/NotepadPP.gitignore +0 -0
  129. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Otto.gitignore +0 -0
  130. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/README.md +0 -0
  131. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Redcar.gitignore +0 -0
  132. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Redis.gitignore +0 -0
  133. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/SBT.gitignore +0 -0
  134. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/SVN.gitignore +0 -0
  135. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/SlickEdit.gitignore +0 -0
  136. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Stata.gitignore +0 -0
  137. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/SublimeText.gitignore +5 -5
  138. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/SynopsysVCS.gitignore +0 -0
  139. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Tags.gitignore +0 -0
  140. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/TextMate.gitignore +0 -0
  141. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/TortoiseGit.gitignore +0 -0
  142. data/roles/qb/git/ignore/files/gitignore/Global/Vagrant.gitignore +5 -0
  143. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Vim.gitignore +6 -4
  144. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/VirtualEnv.gitignore +0 -0
  145. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/VisualStudioCode.gitignore +0 -0
  146. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/WebMethods.gitignore +0 -0
  147. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Windows.gitignore +4 -1
  148. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/Xcode.gitignore +9 -9
  149. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/XilinxISE.gitignore +0 -0
  150. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Global/macOS.gitignore +2 -1
  151. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Go.gitignore +0 -3
  152. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Gradle.gitignore +0 -0
  153. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Grails.gitignore +0 -0
  154. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Haskell.gitignore +2 -0
  155. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/IGORPro.gitignore +0 -0
  156. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Idris.gitignore +0 -0
  157. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Java.gitignore +0 -0
  158. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Jboss.gitignore +0 -0
  159. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Jekyll.gitignore +1 -0
  160. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Joomla.gitignore +1 -1
  161. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Julia.gitignore +0 -0
  162. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/KiCad.gitignore +0 -0
  163. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Kohana.gitignore +0 -0
  164. data/roles/qb/git/ignore/files/gitignore/Kotlin.gitignore +1 -0
  165. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/LICENSE +0 -0
  166. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/LabVIEW.gitignore +0 -0
  167. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Laravel.gitignore +0 -0
  168. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Leiningen.gitignore +0 -0
  169. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/LemonStand.gitignore +0 -0
  170. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Lilypond.gitignore +0 -0
  171. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Lithium.gitignore +0 -0
  172. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Lua.gitignore +0 -0
  173. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Magento.gitignore +0 -0
  174. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Maven.gitignore +0 -0
  175. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Mercury.gitignore +0 -0
  176. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/MetaProgrammingSystem.gitignore +0 -0
  177. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Nanoc.gitignore +1 -1
  178. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Nim.gitignore +0 -0
  179. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Node.gitignore +1 -1
  180. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/OCaml.gitignore +3 -0
  181. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Objective-C.gitignore +0 -0
  182. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Opa.gitignore +0 -0
  183. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/OpenCart.gitignore +0 -0
  184. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/OracleForms.gitignore +0 -0
  185. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Packer.gitignore +0 -0
  186. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Perl.gitignore +1 -1
  187. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Phalcon.gitignore +0 -0
  188. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/PlayFramework.gitignore +0 -0
  189. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Plone.gitignore +0 -0
  190. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Prestashop.gitignore +3 -1
  191. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Processing.gitignore +0 -0
  192. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/PureScript.gitignore +0 -0
  193. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Python.gitignore +11 -5
  194. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/QB.gitignore +0 -0
  195. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Qooxdoo.gitignore +0 -0
  196. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Qt.gitignore +8 -0
  197. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/R.gitignore +0 -0
  198. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/README.md +2 -2
  199. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/ROS.gitignore +2 -0
  200. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Rails.gitignore +4 -0
  201. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/RhodesRhomobile.gitignore +0 -0
  202. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Ruby.gitignore +0 -16
  203. data/roles/qb/git/ignore/files/gitignore/RubyMotion.gitignore +30 -0
  204. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Rust.gitignore +0 -0
  205. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/SCons.gitignore +0 -0
  206. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Sass.gitignore +0 -0
  207. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Scala.gitignore +0 -0
  208. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Scheme.gitignore +0 -0
  209. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Scrivener.gitignore +0 -0
  210. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Sdcc.gitignore +0 -0
  211. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/SeamGen.gitignore +0 -0
  212. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/SketchUp.gitignore +0 -0
  213. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Smalltalk.gitignore +4 -0
  214. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Stella.gitignore +0 -0
  215. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/SugarCRM.gitignore +2 -2
  216. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Swift.gitignore +1 -0
  217. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Symfony.gitignore +7 -0
  218. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/SymphonyCMS.gitignore +0 -0
  219. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/TeX.gitignore +6 -1
  220. data/roles/qb/git/ignore/files/gitignore/Terraform.gitignore +9 -0
  221. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Textpattern.gitignore +0 -0
  222. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/TurboGears2.gitignore +0 -0
  223. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Typo3.gitignore +0 -0
  224. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Umbraco.gitignore +7 -0
  225. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Unity.gitignore +7 -6
  226. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/UnrealEngine.gitignore +2 -0
  227. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/VVVV.gitignore +0 -0
  228. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/VisualStudio.gitignore +37 -6
  229. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Waf.gitignore +0 -0
  230. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/WordPress.gitignore +1 -0
  231. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Xojo.gitignore +0 -0
  232. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Yeoman.gitignore +0 -0
  233. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Yii.gitignore +0 -0
  234. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/ZendFramework.gitignore +0 -1
  235. data/roles/{qb.gitignore → qb/git/ignore}/files/gitignore/Zephir.gitignore +0 -0
  236. data/roles/{qb.gitignore → qb/git/ignore}/meta/main.yml +1 -1
  237. data/roles/{qb.gitignore → qb/git/ignore}/meta/qb +5 -0
  238. data/roles/{qb.gitignore → qb/git/ignore}/tasks/main.yml +9 -1
  239. data/roles/qb/github/pages/setup/defaults/main.yml +2 -0
  240. data/roles/qb/github/pages/setup/meta/main.yml +8 -0
  241. data/roles/qb/github/pages/setup/meta/qb.yml +68 -0
  242. data/roles/qb/github/pages/setup/tasks/main.yml +10 -0
  243. data/roles/{qb.project → qb/project}/.qb-options.yml +1 -1
  244. data/roles/{qb.project → qb/project}/defaults/main.yml +1 -1
  245. data/roles/{qb.project → qb/project}/files/ansible.cfg +0 -0
  246. data/roles/{qb.project → qb/project}/files/hosts +0 -0
  247. data/roles/qb/project/meta/main.yml +6 -0
  248. data/roles/{qb.project → qb/project}/meta/qb.yml +4 -2
  249. data/roles/{qb.project → qb/project}/qb/get_dir +0 -0
  250. data/roles/qb/project/tasks/dev.yml +53 -0
  251. data/roles/{qb.project → qb/project}/tasks/main.yml +3 -2
  252. data/roles/{qb.project → qb/project}/templates/.gitkeep +0 -0
  253. data/roles/qb/project/templates/README.md.j2 +4 -0
  254. data/roles/qb/project/templates/setup.qb.yml.j2 +52 -0
  255. data/roles/{qb.project → qb/project}/templates/setup.yml.j2 +0 -0
  256. data/roles/{qb.role → qb/role}/.qb-options.yml +0 -0
  257. data/roles/{qb.role → qb/role}/defaults/main.yml +4 -1
  258. data/roles/{qb.role → qb/role}/meta/main.yml +1 -1
  259. data/roles/{qb.role → qb/role}/meta/qb.yml +2 -2
  260. data/roles/qb/role/qb/meta/main.yml +1 -1
  261. data/roles/qb/role/qb/meta/qb.yml +1 -1
  262. data/roles/qb/role/qb/tasks/main.yml +4 -2
  263. data/roles/qb/role/qb/templates/qb.yml.j2 +1 -1
  264. data/roles/{qb.role → qb/role}/tasks/main.yml +3 -2
  265. data/roles/{qb.role → qb/role}/tasks/module.yml +0 -0
  266. data/roles/{qb.role → qb/role}/tasks/plugins/_filter_plugin.yml +0 -0
  267. data/roles/{qb.role → qb/role}/tasks/plugins/filter_plugins.yml +5 -5
  268. data/roles/{qb.role → qb/role}/templates/.gitkeep +0 -0
  269. data/roles/{qb.role → qb/role}/templates/README.md.j2 +0 -0
  270. data/roles/{qb.role → qb/role}/templates/defaults/main.yml.j2 +0 -0
  271. data/roles/{qb.role → qb/role}/templates/filter_plugins/filters.py.j2 +0 -0
  272. data/roles/{qb.role → qb/role}/templates/handlers/main.yml.j2 +0 -0
  273. data/roles/{qb.role → qb/role}/templates/library/module.rb.j2 +0 -0
  274. data/roles/{qb.role → qb/role}/templates/meta/main.yml.j2 +0 -0
  275. data/roles/{qb.role → qb/role}/templates/tasks/main.yml.j2 +0 -0
  276. data/roles/{qb.role → qb/role}/templates/vars/main.yml.j2 +0 -0
  277. data/roles/{qb.role → qb/role}/vars/main.yml +1 -1
  278. data/roles/qb/ruby/bundler/.qb-options.yml +4 -0
  279. data/roles/qb/ruby/bundler/defaults/main.yml +7 -0
  280. data/roles/qb/ruby/bundler/filter_plugins/bundler_filters.py +157 -0
  281. data/roles/qb/ruby/bundler/meta/main.yml +8 -0
  282. data/roles/qb/ruby/bundler/meta/qb.yml +69 -0
  283. data/roles/qb/ruby/bundler/tasks/gems.yml +12 -0
  284. data/roles/qb/ruby/bundler/tasks/main.yml +12 -0
  285. data/roles/qb/ruby/bundler/tasks/setup.yml +13 -0
  286. data/roles/qb/ruby/yard/defaults/args.yml +2 -0
  287. data/roles/qb/ruby/yard/defaults/main.yml +9 -0
  288. data/roles/qb/ruby/yard/meta/main.yml +8 -0
  289. data/roles/qb/ruby/yard/meta/qb.yml +71 -0
  290. data/roles/qb/ruby/yard/tasks/main.yml +28 -0
  291. metadata +290 -297
  292. data/roles/nrser.blockinfile/tests/.gitignore +0 -1
  293. data/roles/nrser.blockinfile/tests/expected/test-basic/create.txt +0 -5
  294. data/roles/nrser.blockinfile/tests/expected/test-basic/insert.txt +0 -6
  295. data/roles/nrser.blockinfile/tests/expected/test-basic/marker.txt +0 -5
  296. data/roles/nrser.blockinfile/tests/expected/test-basic/remove.txt +0 -2
  297. data/roles/nrser.blockinfile/tests/expected/test-basic/update.txt +0 -6
  298. data/roles/nrser.blockinfile/tests/expected/test-block/block.txt +0 -4
  299. data/roles/nrser.blockinfile/tests/expected/test-block/content.txt +0 -4
  300. data/roles/nrser.blockinfile/tests/expected/test-follow/link0.txt +0 -6
  301. data/roles/nrser.blockinfile/tests/expected/test-follow/link1.txt +0 -6
  302. data/roles/nrser.blockinfile/tests/expected/test-follow/link2.txt +0 -1
  303. data/roles/nrser.blockinfile/tests/expected/test-follow/real0.txt +0 -2
  304. data/roles/nrser.blockinfile/tests/expected/test-follow/real1.txt +0 -2
  305. data/roles/nrser.blockinfile/tests/expected/test-follow/real2.txt +0 -6
  306. data/roles/nrser.blockinfile/tests/expected/test-insertab/insertafter.txt +0 -8
  307. data/roles/nrser.blockinfile/tests/expected/test-insertab/insertbefore.txt +0 -8
  308. data/roles/nrser.blockinfile/tests/expected/test-insertab/insertbof.txt +0 -8
  309. data/roles/nrser.blockinfile/tests/expected/test-insertab/inserteof.txt +0 -8
  310. data/roles/nrser.blockinfile/tests/expected/test-insertab/insertunmatched.txt +0 -8
  311. data/roles/nrser.blockinfile/tests/expected/test-insertab/updateafter.txt +0 -8
  312. data/roles/nrser.blockinfile/tests/expected/test-insertab/updatebefore.txt +0 -8
  313. data/roles/nrser.blockinfile/tests/expected/test-multiline/insert.txt +0 -11
  314. data/roles/nrser.blockinfile/tests/expected/test-multiline/remove.txt +0 -2
  315. data/roles/nrser.blockinfile/tests/expected/test-multiline/update.txt +0 -12
  316. data/roles/nrser.blockinfile/tests/expected/test-replace/index.html +0 -6
  317. data/roles/nrser.blockinfile/tests/expected/test-state/insert-present.txt +0 -5
  318. data/roles/nrser.blockinfile/tests/expected/test-state/insert.txt +0 -5
  319. data/roles/nrser.blockinfile/tests/expected/test-state/remove-absent.txt +0 -2
  320. data/roles/nrser.blockinfile/tests/expected/test-state/remove-present.txt +0 -2
  321. data/roles/nrser.blockinfile/tests/expected/test-state/remove.txt +0 -2
  322. data/roles/nrser.blockinfile/tests/fixtures/test-basic/insert.txt +0 -2
  323. data/roles/nrser.blockinfile/tests/fixtures/test-basic/marker.txt +0 -1
  324. data/roles/nrser.blockinfile/tests/fixtures/test-basic/remove.txt +0 -6
  325. data/roles/nrser.blockinfile/tests/fixtures/test-basic/update.txt +0 -6
  326. data/roles/nrser.blockinfile/tests/fixtures/test-block/block.txt +0 -1
  327. data/roles/nrser.blockinfile/tests/fixtures/test-block/content.txt +0 -1
  328. data/roles/nrser.blockinfile/tests/fixtures/test-follow/link0.txt +0 -1
  329. data/roles/nrser.blockinfile/tests/fixtures/test-follow/link1.txt +0 -1
  330. data/roles/nrser.blockinfile/tests/fixtures/test-follow/link2.txt +0 -1
  331. data/roles/nrser.blockinfile/tests/fixtures/test-follow/real0.txt +0 -2
  332. data/roles/nrser.blockinfile/tests/fixtures/test-follow/real1.txt +0 -2
  333. data/roles/nrser.blockinfile/tests/fixtures/test-follow/real2.txt +0 -2
  334. data/roles/nrser.blockinfile/tests/fixtures/test-insertab/insertafter.txt +0 -4
  335. data/roles/nrser.blockinfile/tests/fixtures/test-insertab/insertbefore.txt +0 -4
  336. data/roles/nrser.blockinfile/tests/fixtures/test-insertab/insertbof.txt +0 -4
  337. data/roles/nrser.blockinfile/tests/fixtures/test-insertab/inserteof.txt +0 -4
  338. data/roles/nrser.blockinfile/tests/fixtures/test-insertab/insertunmatched.txt +0 -4
  339. data/roles/nrser.blockinfile/tests/fixtures/test-insertab/updateafter.txt +0 -8
  340. data/roles/nrser.blockinfile/tests/fixtures/test-insertab/updatebefore.txt +0 -8
  341. data/roles/nrser.blockinfile/tests/fixtures/test-multiline/insert.txt +0 -2
  342. data/roles/nrser.blockinfile/tests/fixtures/test-multiline/remove.txt +0 -11
  343. data/roles/nrser.blockinfile/tests/fixtures/test-multiline/update.txt +0 -12
  344. data/roles/nrser.blockinfile/tests/fixtures/test-replace/index.html +0 -1
  345. data/roles/nrser.blockinfile/tests/fixtures/test-state/insert-present.txt +0 -2
  346. data/roles/nrser.blockinfile/tests/fixtures/test-state/insert.txt +0 -2
  347. data/roles/nrser.blockinfile/tests/fixtures/test-state/remove-absent.txt +0 -6
  348. data/roles/nrser.blockinfile/tests/fixtures/test-state/remove-present.txt +0 -6
  349. data/roles/nrser.blockinfile/tests/fixtures/test-state/remove.txt +0 -6
  350. data/roles/nrser.blockinfile/tests/hosts +0 -1
  351. data/roles/nrser.blockinfile/tests/roles/yaegashi.blockinfile +0 -1
  352. data/roles/nrser.blockinfile/tests/run.sh +0 -64
  353. data/roles/nrser.blockinfile/tests/test-basic.yml +0 -31
  354. data/roles/nrser.blockinfile/tests/test-block.yml +0 -16
  355. data/roles/nrser.blockinfile/tests/test-follow.yml +0 -21
  356. data/roles/nrser.blockinfile/tests/test-insertab.yml +0 -34
  357. data/roles/nrser.blockinfile/tests/test-multiline.yml +0 -51
  358. data/roles/nrser.blockinfile/tests/test-replace.yml +0 -21
  359. data/roles/nrser.blockinfile/tests/test-state.yml +0 -32
  360. data/roles/qb.gitignore/files/gitignore/Global/Matlab.gitignore +0 -22
  361. data/roles/qb.gitignore/files/gitignore/Global/Vagrant.gitignore +0 -1
  362. data/roles/qb.gitignore/files/gitignore/Terraform.gitignore +0 -6
  363. data/roles/qb.project/meta/main.yml +0 -6
  364. data/roles/qb.project/tasks/dev.yml +0 -36
  365. data/roles/qb.project/tasks/setup.yml +0 -42
  366. data/roles/qb.project/templates/README.md.j2 +0 -2
  367. data/roles/qb.project/templates/bootstrap.yml.j2 +0 -20
@@ -0,0 +1,116 @@
1
+ QB Role `default_dir` Strategies
2
+ ==============================================================================
3
+
4
+ Details on the acceptable values for the `default_dir` metadata key for QB roles, which I'm calling *strategies*.
5
+
6
+ - `null` (or missing entirely) - **No strategy, DIRECTORY arg required on CLI**
7
+
8
+ No strategy for figuring out a default directory.
9
+
10
+ A {QB::UserInputError} will be raised by {QB::Role.default_dir}
11
+
12
+ - `false` - **DIRECTORY arg not used**
13
+
14
+ Role does not use a directory argument.
15
+
16
+ Providing one via the command line *should* result in an error (though this is untested), and `qb_dir` will not be set in Ansible.
17
+
18
+ - **Strategies with no parameters**
19
+
20
+ Encoded as simple string values.
21
+
22
+ - `'cwd'` - **Current working directory**
23
+
24
+ Use the working directory the `run` command was executed in.
25
+
26
+ This is expected to pretty much always succeed.
27
+
28
+ > **Example**
29
+ >
30
+ > default_dir: cwd
31
+ >
32
+
33
+ - `'git_root'` - **Git repo root**
34
+
35
+ Use the root of the Git repo for the working directory the run command was executed in.
36
+
37
+ Raises an error if that directory is not part of a Git repo.
38
+
39
+ > **Example**
40
+ >
41
+ > default_dir: git_root
42
+ >
43
+
44
+ - **Strategies with parameters**
45
+
46
+ Encoded as directories with a single string key denoting the strategy pointing to a value holding the parameters.
47
+
48
+ - `{exe: <path:string>}` - **Run an executable**
49
+
50
+ Run the executable at `path` and use the output, which should be a single string directory path (we do chomp what we get back).
51
+
52
+ The exe is fed a `JSON` dump of the role options at the time via `STDIN`, so it can dynamically determine the directory based on those if it wants.
53
+
54
+ If `path` is relative, it's assumed to be relative to the *role directory*, **NOT** the working directory.
55
+
56
+ Raises errors when things go wrong.
57
+
58
+ > **Example** Role-relative executable
59
+ >
60
+ > This will attempt to resolve the default directory by executing the `<role_path>/bin/get_default_dir` file
61
+ >
62
+ > default_dir:
63
+ > exe: bin/get_default_dir
64
+ >
65
+
66
+ - `{find_up: <rel_path:string>}` - **Find a path walking up**
67
+
68
+ Walk up the directory hierarchy from the CLI working directory looking for the first place that `rel_path` exists.
69
+
70
+ This is used to do things like find the `Gemfile`, nearest
71
+ `.gitignore`, etc:
72
+
73
+ > **Example** Find the nearest `Gemfile` walking up directories
74
+ >
75
+ > default_dir:
76
+ > find_up: Gemfile
77
+ >
78
+
79
+ > **Example** Find the nearest `.gitignore` walking up directories
80
+ >
81
+ > default_dir:
82
+ > find_up: .gitignore
83
+ >
84
+
85
+ `rel_path` can be deep too:
86
+
87
+ > **Example** Find the nearest directory walking up for which `<dir>/dev/ref` exists
88
+ >
89
+ > default_dir:
90
+ > find_up: dev/ref
91
+ >
92
+
93
+ - `{from_role: <role:string}` - **Use value from another role**
94
+
95
+ Use the value from another QB role, which this one presumably includes.
96
+
97
+ `role` can be anything you would normally use to locate a role using `qb run`, etc. (partial or full name or path).
98
+
99
+ > **Example** Use the value for the `qb/ruby/bundler` role
100
+ >
101
+ > default_dir:
102
+ > from_role: qb/ruby/bundler
103
+ >
104
+
105
+ - `Array` - **Multiple strategies (fallbacks)**
106
+
107
+ A list of strategies to try; first to succeed wins.
108
+
109
+ > **Example** Closest `Gemfile` or Git root
110
+ >
111
+ > Walk up directories looking for `Gemfile`, and if one can't be found then use the Git repo root.
112
+ >
113
+ > default_dir:
114
+ > - find_up: Gemfile
115
+ > - git_root
116
+ >
data/exe/qb CHANGED
@@ -35,30 +35,32 @@ def main args
35
35
 
36
36
  QB.check_ansible_version
37
37
 
38
- logger.debug "Switch arg" => args[0]
38
+ logger.debug "Main switch arg" => args[0]
39
39
 
40
- status = case args[0]
40
+ method_name, method_args = case args[0]
41
41
  when nil, '-h', '--help', 'help'
42
- QB::CLI.help
42
+ [:help, []]
43
43
  when 'play'
44
- QB::CLI.play args.rest
44
+ [:play, args.rest]
45
45
  when 'run'
46
- QB::CLI.run args.rest
46
+ [:run, args.rest]
47
47
  when 'setup'
48
- state_args = args.rest
49
-
50
- case state_args[0]
51
- when nil
52
- QB::CLI.setup
53
- end
48
+ [:setup, args.rest]
54
49
  else
55
50
  # default to `run` on the full args
56
- QB::CLI.run args
51
+ [:run, args]
57
52
  end
58
53
 
59
- logger.debug "Exit status", status
54
+ logger.debug "Calling QB::CLI.#{ method_name }",
55
+ method_args: method_args
60
56
 
61
- # exit status
57
+ status = begin
58
+ QB::CLI.public_send method_name, method_args
59
+ rescue Exception => error
60
+ raise error
61
+ end
62
+
63
+ logger.debug "QB::CLI.#{ method_name } returned, exiting.", status: status
62
64
  exit status
63
65
  end
64
66
 
data/lib/qb.rb CHANGED
@@ -45,32 +45,17 @@ module QB
45
45
  include SemanticLogger::Loggable
46
46
 
47
47
 
48
+ # Support for the old custom debug logging, now sent to {SemanticLogger}.
49
+ #
48
50
  def self.debug *args
49
51
  if args[0].is_a? String
50
52
  logger.debug *args
51
53
  else
54
+ # De-array if there's only one arg
55
+ args = args[0] if args.length == 1
56
+ # And send the args to SM as the payload
52
57
  logger.debug payload: args
53
58
  end
54
-
55
- # return unless ENV['QB_DEBUG'] && args.length > 0
56
- #
57
- # header = 'DEBUG'
58
- #
59
- # if args[0].is_a? String
60
- # header += " " + args.shift
61
- # end
62
- #
63
- # dumpObj = case args.length
64
- # when 0
65
- # header
66
- # when 1
67
- # {header => args[0]}
68
- # else
69
- # {header => args}
70
- # end
71
- #
72
- # # $stderr.puts("DEBUG " + format(msg, values))
73
- # $stderr.puts dumpObj.pretty_inspect
74
59
  end
75
60
 
76
61
  end
@@ -26,8 +26,8 @@ class QB::Ansible::Cmds::Playbook < ::Cmds
26
26
  # shell path resolution do it's thing.
27
27
  DEFAULT_EXE = 'ansible-playbook'
28
28
 
29
- TEMPLATE = <<-END
30
- <%= exe %>
29
+ TEMPLATE = <<-END
30
+ <%== exe %>
31
31
 
32
32
  <%= cmd_options %>
33
33
 
@@ -134,7 +134,7 @@ class QB::Ansible::Cmds::Playbook < ::Cmds
134
134
 
135
135
 
136
136
  # Instance Methods
137
- # ======================================================================
137
+ # ======================================================================
138
138
 
139
139
  # @return [Hash<String => Object>]
140
140
  # Hash of CLI options for `ansible-playbook` based off {#role_options}
@@ -241,4 +241,3 @@ class QB::Ansible::Cmds::Playbook < ::Cmds
241
241
  # end protected
242
242
 
243
243
  end # class QB::Ansible::Playbook
244
-
@@ -53,6 +53,16 @@ class QB::Ansible::Env
53
53
  attr_reader :lookup_plugins
54
54
 
55
55
 
56
+ # `ANSIBLE_CONFIG_<name>=<value>` ENV var values.
57
+ #
58
+ # @see http://docs.ansible.com/ansible/latest/intro_configuration.html
59
+ #
60
+ # @return [Hash<(String | Symbol), String]
61
+ #
62
+ attr_reader :config
63
+
64
+
65
+
56
66
  # Constructor
57
67
  # ======================================================================
58
68
 
@@ -76,6 +86,8 @@ class QB::Ansible::Env
76
86
  @lookup_plugins = [
77
87
  QB::ROOT.join('plugins', 'lookup_plugins'),
78
88
  ]
89
+
90
+ @config = {}
79
91
  end # #initialize
80
92
 
81
93
 
@@ -91,19 +103,27 @@ class QB::Ansible::Env
91
103
  # @todo Document return value.
92
104
  #
93
105
  def to_h
94
- [
106
+ hash = [
95
107
  :roles_path,
96
108
  :library,
97
109
  :filter_plugins,
98
110
  :lookup_plugins
99
111
  ].map { |name|
100
- value = self.send(name)
112
+ value = self.send name
101
113
 
102
114
  value = value.join(':') if value.is_a?(Array)
103
115
 
104
116
  [self.class.to_var_name(name), value]
105
117
  }.to_h
118
+
119
+ config.each { |name, value|
120
+ hash[ self.class.to_var_name( "CONFIG_#{ name }" ) ] = value.to_s
121
+ }
122
+
123
+ hash
106
124
  end # #to_h
107
125
 
108
126
 
109
127
  end # class QB::Ansible::Env
128
+
129
+ require 'qb/ansible/env/devel'
@@ -0,0 +1,49 @@
1
+ module QB; end
2
+ module QB::Ansible; end
3
+
4
+
5
+ # @todo document QB::Ansible::Env class.
6
+ class QB::Ansible::Env::Devel < QB::Ansible::Env
7
+ ANSIBLE_HOME = QB::ROOT / 'packages' / 'python' / 'ansible'
8
+
9
+ # Instance Methods
10
+ # ======================================================================
11
+
12
+ # @todo Document to_h method.
13
+ #
14
+ # @param [type] arg_name
15
+ # @todo Add name param description.
16
+ #
17
+ # @return [return_type]
18
+ # @todo Document return value.
19
+ #
20
+ def to_h
21
+ hash = super
22
+
23
+ hash['ANSIBLE_HOME'] = ANSIBLE_HOME.to_s
24
+
25
+ hash['PYTHONPATH'] = [
26
+ # (QB::ROOT / 'lib' / 'python'),
27
+ (ANSIBLE_HOME / 'lib'),
28
+ ENV['PYTHONPATH'],
29
+ ].
30
+ compact.
31
+ map( &:to_s ).
32
+ join( ':' )
33
+
34
+ path = ENV['PATH'].split ':'
35
+
36
+ path.insert \
37
+ path.find_index { |p| ! p.start_with?( './' ) },
38
+ (ANSIBLE_HOME / 'bin').to_s
39
+
40
+ hash['PATH'] = path.join ':'
41
+
42
+ # hash['ANSIBLE_CONNECTION'] = 'local'
43
+ # hash['ANSIBLE_PYTHON_INTERPRETER'] = '/usr/local/bin/python2'
44
+
45
+ hash
46
+ end # #to_h
47
+
48
+
49
+ end # class QB::Ansible::Env
@@ -30,6 +30,8 @@ module QB; end
30
30
 
31
31
  module QB::CLI
32
32
 
33
+ include SemanticLogger::Loggable
34
+
33
35
  # Eigenclass (Singleton Class)
34
36
  # ========================================================================
35
37
  #
@@ -114,7 +116,7 @@ module QB::CLI
114
116
  ask name: option.name,
115
117
  description: option.description,
116
118
  default: default
117
- # type:
119
+ # type:
118
120
  end
119
121
 
120
122
 
@@ -24,7 +24,7 @@ module QB::CLI
24
24
  # Error exit status - we don't want `qb ... && ...` to move on to the
25
25
  # second command when we end up falling back to `help`.
26
26
  #
27
- def self.help
27
+ def self.help args = []
28
28
  metadata = if QB.gemspec.metadata && !QB.gemspec.metadata.empty?
29
29
  "metadata:\n" + QB.gemspec.metadata.map {|key, value|
30
30
  " #{ key }: #{ value }"
@@ -0,0 +1,47 @@
1
+ # Requirements
2
+ # =====================================================================
3
+
4
+ # package
5
+
6
+
7
+ # Declarations
8
+ # =======================================================================
9
+
10
+ module QB; end
11
+
12
+
13
+ # Definitions
14
+ # =======================================================================
15
+
16
+ module QB::CLI
17
+
18
+ # List available roles.
19
+ #
20
+ # @example
21
+ #
22
+ # qb list --user
23
+ # qb list -u
24
+ # qb list --local
25
+ # qb list -l
26
+ # qb list --system
27
+ # qb list -s
28
+ # qb list --path=:system
29
+ # qb list --path=./roles
30
+ # qb list -p ./roles
31
+ # qb list gem
32
+ #
33
+ # @todo
34
+ # We should have more types of help.
35
+ #
36
+ # @return [1]
37
+ # Error exit status - we don't want `qb ... && ...` to move on to the
38
+ # second command when we end up falling back to `help`.
39
+ #
40
+ def self.list args = []
41
+ puts QB::Role.available
42
+ puts
43
+
44
+ return 1
45
+ end # .help
46
+
47
+ end # module QB::CLI
@@ -14,7 +14,7 @@ module QB; end
14
14
  # Definitions
15
15
  # =======================================================================
16
16
 
17
- module QB::CLI
17
+ module QB::CLI
18
18
 
19
19
  # Run a QB role.
20
20
  #
@@ -22,13 +22,13 @@ module QB::CLI
22
22
  # CLI args to work with.
23
23
  #
24
24
  # @return [Fixnum]
25
- # Exit status code from `ansible-playbook` command, unless we invoked
25
+ # Exit status code from `ansible-playbook` command, unless we invoked
26
26
  # help or error'd out in another way before the run (in which case `1`
27
27
  # is returned).
28
28
  #
29
29
  def self.run args
30
30
  role_arg = args.shift
31
- QB.debug "role arg", role_arg
31
+ QB.debug "role arg" => role_arg
32
32
 
33
33
  begin
34
34
  role = QB::Role.require role_arg
@@ -45,17 +45,17 @@ module QB::CLI
45
45
 
46
46
  options = QB::Options.new role, args
47
47
 
48
- QB.debug "role options set on cli", options.role_options.select {|k, o|
49
- !o.value.nil?
50
- }
48
+ QB.debug "Role options set on cli",
49
+ role: options.role_options.reject { |k, o| o.value.nil? }
51
50
 
52
- QB.debug "qb options", options.qb
51
+ QB.debug "QB options", options.qb.dup
52
+ QB.debug "Ansible options", options.ansible.dup
53
53
 
54
54
  cwd = Dir.getwd
55
55
 
56
56
  dir = nil
57
57
 
58
- if role.uses_default_dir?
58
+ if role.has_dir_arg?
59
59
  # get the target dir
60
60
  dir = case args.length
61
61
  when 0
@@ -198,10 +198,39 @@ module QB::CLI
198
198
  ],
199
199
  'roles' => [
200
200
  'nrser.blockinfile',
201
- playbook_role
202
201
  ],
203
202
  }
204
203
 
204
+ if role.meta['call_role']
205
+ logger.debug "Calling role through qb/call..."
206
+
207
+ play['tasks'] = [
208
+ {
209
+ 'include_role' => {
210
+ 'name' => 'qb/call',
211
+ },
212
+ 'vars' => {
213
+ 'role' => role.name,
214
+ 'args' => set_options.map { |option|
215
+ [option.var_name, option.value]
216
+ }.to_h,
217
+ }
218
+ }
219
+ ]
220
+
221
+ env = QB::Ansible::Env::Devel.new
222
+ exe = [
223
+ "python2",
224
+ (QB::Ansible::Env::Devel::ANSIBLE_HOME / 'bin' / 'ansible-playbook')
225
+ ].join " "
226
+
227
+ else
228
+ play['roles'] << playbook_role
229
+ env = QB::Ansible::Env.new
230
+ exe = "ansible-playbook"
231
+
232
+ end
233
+
205
234
  if options.qb['user']
206
235
  play['become'] = true
207
236
  play['become_user'] = options.qb['user']
@@ -209,9 +238,7 @@ module QB::CLI
209
238
 
210
239
  playbook = [play]
211
240
 
212
- QB.debug "playbook", playbook
213
-
214
- env = QB::Ansible::Env.new
241
+ logger.debug "playbook", playbook
215
242
 
216
243
  # stick the role path in front to make sure we get **that** role
217
244
  env.roles_path.unshift role.path.expand_path.dirname
@@ -220,7 +247,8 @@ module QB::CLI
220
247
  env: env,
221
248
  playbook: playbook,
222
249
  role_options: options,
223
- chdir: (File.exists?('./ansible/ansible.cfg') ? './ansible' : nil)
250
+ chdir: (File.exists?('./ansible/ansible.cfg') ? './ansible' : nil),
251
+ exe: exe
224
252
 
225
253
  # print
226
254
  # =====
@@ -287,5 +315,3 @@ module QB::CLI
287
315
  end # .run
288
316
 
289
317
  end # module QB::CLI
290
-
291
-