2017-10-08 12:55:01 +00:00
|
|
|
require 'English'
|
|
|
|
|
|
|
|
ansible_role = 'bind'
|
|
|
|
|
|
|
|
def exec_cmd(cmd)
|
|
|
|
puts cmd
|
|
|
|
puts %x(#{cmd})
|
|
|
|
raise unless $CHILD_STATUS.success?
|
|
|
|
end
|
|
|
|
|
|
|
|
task :default do
|
|
|
|
exec_cmd(
|
|
|
|
"docker run -v $(pwd):/#{ansible_role}:ro -it nishiki/ansible:stretch bash -c " \
|
|
|
|
"'cd /#{ansible_role} && rake verify'"
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
task verify: %w[
|
|
|
|
install
|
|
|
|
]
|
|
|
|
|
|
|
|
task :install do
|
|
|
|
exec_cmd("ansible-playbook -i tests/inventory tests/#{ansible_role}.yml")
|
|
|
|
exec_cmd("ansible-playbook -i tests/inventory tests/#{ansible_role}.yml | grep changed=0")
|
2017-10-15 06:43:31 +00:00
|
|
|
exec_cmd("cd tests/spec && rspec #{ansible_role}.rb")
|
2017-10-08 12:55:01 +00:00
|
|
|
end
|