Sha256: a54d7db24a4515d0ed3cc81f7ad651b5de231686bbae81a1da3fb02a825cf876
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
module AnsibleUtils module PlaybookHelpers def config_file_path @config_file_path ||= File.join(ENV.fetch('HOME'), '.config', 'ansible-utils', 'config.yml') end def delete_if_exists path FileUtils.remove_entry(path, true) end def paths @paths ||= roles.map do |role| if role.is_a?(Hash) role['role'] else role end end end def roles playbook['roles'] end def project_folder @project_folder ||= Dir.pwd end def generic_roles_folder begin if File.file?(config_file_path) return YAML.load(File.read(config_file_path))['generic_roles_path'] else raise "Missing config file at #{config_file_path}. Run `ansible-utils config` for proper setup" end rescue Psych::SyntaxError raise "Error reading config file at #{config_file_path}" end end def playbook @playbook ||= YAML.load_file(playbook_path).first end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ansible-utils-0.2.0 | lib/ansible_utils/playbook_helpers.rb |
ansible-utils-0.1.1 | lib/ansible_utils/playbook_helpers.rb |