Skip to content

Commit

Permalink
Move content dir logic to vmdb plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Aug 2, 2018
1 parent 383a039 commit 9668a36
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/tasks/evm_ansible_runner.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
11 changes: 11 additions & 0 deletions lib/vmdb/plugins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 9668a36

Please sign in to comment.