Sha256: abad511739e5dc5e82438d951065be02882800ccb9dc003de4c063a6eb1efb2c
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
require_relative "playbook_helpers" module AnsibleUtils class DependencyManager include PlaybookHelpers attr_reader :playbook_path, :options def initialize playbook_path, options = {} @playbook_path = playbook_path @options = options end def symlink_roles paths.each{|path| execute_in_path(:symlink, path) } end def copy_roles paths.each{|path| execute_in_path(:copy, path) } end private 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.exist?(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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ansible-utils-0.2.0 | lib/ansible_utils/dependency_manager.rb |