diff --git a/lib/tasks/evm_ansible_runner.rake b/lib/tasks/evm_ansible_runner.rake index 6dd67c6c8555..1e64195c50d0 100644 --- a/lib/tasks/evm_ansible_runner.rake +++ b/lib/tasks/evm_ansible_runner.rake @@ -5,16 +5,11 @@ 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', 'ansible_tmp', 'requirements.yml') - File.file?(req_yml_path) - end - - plugins_with_req_yml.each do |plugin| + Vmdb::Plugins.ansible_runner_content.each do |plugin, content_dir| puts "Seeding roles for #{plugin.name}..." - roles_path = plugin.root.join('content', 'ansible_tmp', 'roles') - role_file = plugin.root.join('content', 'ansible_tmp', 'requirements.yml') + roles_path = content_dir.join('roles') + role_file = content_dir.join('requirements.yml') params = ["install", :roles_path= => roles_path, :role_file= => role_file] diff --git a/lib/vmdb/plugins.rb b/lib/vmdb/plugins.rb index d554e48986f5..e904dd9c675c 100644 --- a/lib/vmdb/plugins.rb +++ b/lib/vmdb/plugins.rb @@ -40,6 +40,17 @@ def ansible_content end end + def ansible_runner_content + @ansible_runner_content ||= begin + map do |engine| + content_dir = engine.root.join("content", "ansible_tmp") + next unless File.exists?(content_dir.join("requirements.yml")) + + [engine, content_dir] + end.compact + end + end + def automate_domains @automate_domains ||= begin require_relative 'plugins/automate_domain'