lib/tape/ansible_runner.rb in taperole-1.3.2 vs lib/tape/ansible_runner.rb in taperole-1.3.3
- old
+ new
@@ -43,10 +43,11 @@
action :everything,
proc { ansible if valid_preconfigs },
"This does it all."
def initialize(*args)
+ register_notifiers
super
end
protected
attr_reader :opts
@@ -86,10 +87,15 @@
enforce_roles_path!
cmd = "ANSIBLE_CONFIG=#{local_dir}/.tape/ansible.cfg ansible-playbook -i #{inventory_file} #{playbook} #{args} #{hosts_flag} -e tape_dir=#{tape_dir}"
cmd += ' -vvvv' if opts.verbose
cmd += " -t #{opts.tags}" if opts.tags
STDERR.puts "Executing: #{cmd}" if opts.verbose
- Kernel.exec(cmd)
+ notify_observers(:start)
+ if Kernel.system(cmd)
+ notify_observers(:success)
+ else
+ notify_observers(:fail)
+ end
end
def enforce_roles_path!
Dir.mkdir('.tape') unless Dir.exists?('.tape')