class AnsibleUtils::DependencyManager
Attributes
options[R]
playbook_path[R]
Public Class Methods
new(playbook_path, options = {})
click to toggle source
# File lib/ansible_utils/dependency_manager.rb, line 9 def initialize playbook_path, options = {} @playbook_path = playbook_path @options = options end
Public Instance Methods
copy_roles()
click to toggle source
# File lib/ansible_utils/dependency_manager.rb, line 18 def copy_roles paths.each{|path| execute_in_path(:copy, path) } end
symlink_roles()
click to toggle source
# File lib/ansible_utils/dependency_manager.rb, line 14 def symlink_roles paths.each{|path| execute_in_path(:symlink, path) } end
Private Instance Methods
execute_in_path(action, path)
click to toggle source
# File lib/ansible_utils/dependency_manager.rb, line 24 def execute_in_path action, path populate_ansible_path = File.join(generic_roles_folder, path) if generic_roles_folder project_path = File.join(project_folder, path) file_utils_method = action == :copy ? :copy_entry : :ln_s if !File.directory?(populate_ansible_path) puts "- Ignoring role '#{path}' because it does not exist in #{populate_ansible_path}" else dirname = File.dirname(project_path) if Dir.exists?(project_path) if options.force puts "+ Overwritting role '#{path}'" delete_if_exists(project_path) else puts "- Skipping existing role '#{path}' (use --force option to overwrite it)" return end end puts "+ Adding role '#{path}'" FileUtils.mkdir_p(dirname) FileUtils.send(file_utils_method, populate_ansible_path, project_path) end end