Sha256: 790696a274754320a6f68daca590b8773062b79b8ff9050063557dc56a5a4cff

Contents?: true

Size: 1.07 KB

Versions: 110

Compression:

Stored size: 1.07 KB

Contents

#!/usr/bin/env ruby

require 'rbbt-util'
require 'rbbt/util/simpleopt'

$0 = "rbbt #{$previous_commands*" "} #{ File.basename(__FILE__) }" if $previous_commands

options = SOPT.setup <<EOF

Run ansible

$ #{$0} [options] <rules.yml|->

Use - to read from STDIN

-h--help Print this help
-dr--dry_run Only print the playbook
-H--hosts* hosts to run it on
EOF
if options[:help]
  if defined? rbbt_usage
    rbbt_usage 
  else
    puts SOPT.doc
  end
  exit 0
end

require 'rbbt/workflow/integration/ansible'

playbook, task = ARGV
playbook_file = Rbbt.share.ansible["test.yaml"].find if playbook.nil?

dry_run = options.delete :dry_run

if ! Misc.filename?(playbook_file)
  playbook_file = Rbbt.share.ansible.glob(playbook + ".*").first
end

if ! Misc.filename?(playbook_file)
  recipe = Rbbt.share.recipes.glob(playbook + ".*").first
  playbook_file = Ansible.playbook recipe, task, options
end


if dry_run
  if Hash === playbook_file
    ppp playbook_file.to_yaml
  else
    ppp Log.color :magenta, playbook_file
    ppp Open.read(playbook_file) 
  end
else
  Ansible.play playbook_file
end

Version data entries

110 entries across 110 versions & 1 rubygems

Version Path
rbbt-util-5.34.27 share/rbbt_commands/ansible
rbbt-util-5.34.26 share/rbbt_commands/ansible
rbbt-util-5.34.25 share/rbbt_commands/ansible
rbbt-util-5.34.24 share/rbbt_commands/ansible
rbbt-util-5.34.23 share/rbbt_commands/ansible
rbbt-util-5.34.22 share/rbbt_commands/ansible
rbbt-util-5.34.21 share/rbbt_commands/ansible
rbbt-util-5.34.20 share/rbbt_commands/ansible
rbbt-util-5.34.18 share/rbbt_commands/ansible
rbbt-util-5.34.17 share/rbbt_commands/ansible
rbbt-util-5.34.16 share/rbbt_commands/ansible
rbbt-util-5.34.15 share/rbbt_commands/ansible
rbbt-util-5.34.14 share/rbbt_commands/ansible
rbbt-util-5.34.13 share/rbbt_commands/ansible
rbbt-util-5.34.12 share/rbbt_commands/ansible
rbbt-util-5.34.11 share/rbbt_commands/ansible
rbbt-util-5.34.10 share/rbbt_commands/ansible
rbbt-util-5.34.9 share/rbbt_commands/ansible
rbbt-util-5.34.8 share/rbbt_commands/ansible
rbbt-util-5.34.7 share/rbbt_commands/ansible