Skip to content

Commit

Permalink
Seed Ansible Roles for Vmdb Plugins
Browse files Browse the repository at this point in the history
Allow plugins to add a requirements.yml file to specify roles from
galaxy/github/etc... and seed them locally.
  • Loading branch information
agrare committed Jul 30, 2018
1 parent 12b109c commit 24b9870
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions lib/tasks/evm_ansible.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
require 'awesome_spawn'
require "vmdb/plugins"

namespace :evm do
namespace :ansible do
desc "Seed galaxy roles for provider playbooks"
task :seed do
plugins_with_req_yml = Vmdb::Plugins.select do |p|
req_yml_path = p.root.join('content', 'ansible', 'requirements.yml')
File.file?(req_yml_path)
end

plugins_with_req_yml.each do |p|
puts "Seeding roles for #{p.name.split("::Engine").first}..."

roles_path = p.root.join('content', 'ansible', 'roles')
role_file = p.root.join('content', 'ansible', 'requirements.yml')

AwesomeSpawn.run!(
"ansible-galaxy",
:params => {
nil => "install",
:roles_path= => roles_path,
:role_file= => role_file
}
)
puts "Seeding roles for #{p.name.split("::Engine").first}...Complete"
end
end
end
end

0 comments on commit 24b9870

Please sign in to comment.