-
Notifications
You must be signed in to change notification settings - Fork 898
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow plugins to add a requirements.yml file to specify roles from galaxy/github/etc... and seed them locally.
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |