Sha256: c518bc6fd5fe29984c45ff28799ac3f0de04a1cd3347e3c54f42f8b0dbe3712c
Contents?: true
Size: 1002 Bytes
Versions: 87
Compression:
Stored size: 1002 Bytes
Contents
require 'fileutils' require 'yaml' require 'cmds' require 'nrser/refinements' require 'nrser/extras' using NRSER ROOT = NRSER.git_root __FILE__ ANSIBLE_DIR = ROOT + 'test' + 'ansible' ROLES_DIR = ANSIBLE_DIR + 'roles' ROLE_DIR = ROLES_DIR + 'nrser.state_mate' TEMPLATE_PATH = ANSIBLE_DIR + 'template.yml' PLAYBOOK_PATH = ANSIBLE_DIR + 'temp-playbook.yml' DOMAIN = 'com.nrser.state_mate.ansible' def playbook options = {} data = YAML.load TEMPLATE_PATH.read [:name, :vars, :roles, :tasks].each do |sym| data[0][sym.to_s] = options[sym] if options.key? sym end PLAYBOOK_PATH.open('w') do |f| f.write YAML.dump(data) end result = Dir.chdir ANSIBLE_DIR do Cmds 'ansible-playbook %{path}', path: PLAYBOOK_PATH end unless result.ok? raise binding.erb <<-END error executing playbook path: <%= PLAYBOOK_PATH %> out: <%= result.out.indent %> err: <%= result.err.indent %> END end end
Version data entries
87 entries across 87 versions & 1 rubygems