-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Seed Ansible Roles for Vmdb Plugins #17777
Changes from 3 commits
d2b0a70
636e0a6
8215e52
4323a4f
383a039
1e76650
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
require 'awesome_spawn' | ||
require "vmdb/plugins" | ||
|
||
namespace :evm do | ||
namespace :ansible_runner do | ||
desc "Seed galaxy roles for provider playbooks" | ||
task :seed do | ||
plugins_with_req_yml = Vmdb::Plugins.select do |plugin| | ||
req_yml_path = plugin.root.join('content_tmp', 'ansible', 'requirements.yml') | ||
File.file?(req_yml_path) | ||
end | ||
|
||
plugins_with_req_yml.each do |plugin| | ||
puts "Seeding roles for #{plugin.name}..." | ||
|
||
roles_path = plugin.root.join('content_tmp', 'ansible', 'roles') | ||
role_file = plugin.root.join('content_tmp', 'ansible', 'requirements.yml') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would prefer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
params = { | ||
nil => "install", | ||
:roles_path= => roles_path, | ||
:role_file= => role_file | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can also be params = ["install", :roles_path= => roles_path, :role_file= => role_file] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
begin | ||
AwesomeSpawn.run!("ansible-galaxy", :params => params) | ||
puts "Seeding roles for #{plugin.name}...Complete" | ||
rescue AwesomeSpawn::CommandResultError => err | ||
puts "Seeding roles for #{plugin.name}...Failed - #{err.result.error}" | ||
raise | ||
end | ||
end | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's encode this into
VMDB::Plugins
a laVMDB::Plugins::AnsibleContent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 done