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.33.6 share/rbbt_commands/ansible
rbbt-util-5.33.5 share/rbbt_commands/ansible
rbbt-util-5.33.4 share/rbbt_commands/ansible
rbbt-util-5.33.3 share/rbbt_commands/ansible
rbbt-util-5.33.2 share/rbbt_commands/ansible
rbbt-util-5.33.1 share/rbbt_commands/ansible
rbbt-util-5.33.0 share/rbbt_commands/ansible
rbbt-util-5.32.30 share/rbbt_commands/ansible
rbbt-util-5.32.28 share/rbbt_commands/ansible
rbbt-util-5.32.27 share/rbbt_commands/ansible
rbbt-util-5.32.26 share/rbbt_commands/ansible
rbbt-util-5.32.25 share/rbbt_commands/ansible
rbbt-util-5.32.24 share/rbbt_commands/ansible
rbbt-util-5.32.23 share/rbbt_commands/ansible
rbbt-util-5.32.22 share/rbbt_commands/ansible
rbbt-util-5.32.21 share/rbbt_commands/ansible
rbbt-util-5.32.20 share/rbbt_commands/ansible
rbbt-util-5.32.18 share/rbbt_commands/ansible
rbbt-util-5.32.17 share/rbbt_commands/ansible
rbbt-util-5.32.16 share/rbbt_commands/ansible