Last active
December 18, 2017 02:00
-
-
Save gregswift/84a5ba3c303c0c35f9d3 to your computer and use it in GitHub Desktop.
Sourcing puppet modules from yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
mypath = File.expand_path(File.dirname(__FILE__)) | |
# Load configuration from config.yml | |
conf = YAML::load_file("#{mypath}/Puppetfile.yml") | |
forge_conf = conf.fetch('forge', nil) | |
if forge_conf.nil? | |
forge = "" | |
else | |
forge, modules = forge_conf.first | |
modules.each { |m| | |
if m.is_a?(Hash) | |
name, version = m.first | |
if version == 'latest' | |
mod name, :latest | |
else | |
mod name, version | |
end | |
else | |
mod m | |
end | |
} | |
end | |
conf['git'].each { |org_uri, modules| | |
modules.each { |m| | |
if !(m.is_a?(Hash)) | |
m = { m => 'master' } | |
end | |
repo, ref = m.first | |
name = repo.split('-', 2)[-1].gsub(/-/, '_') | |
git = "#{org_uri}/#{repo}.git" | |
mod name, :git => git, :ref => ref | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
forge: | |
"https://forgeapi.puppetlabs.com": | |
- bfraser/grafana | |
- bmurt/puppet_agent: 0.0.4 | |
- camptocamp/augeas: latest | |
git: | |
"https://github.com": | |
- jenkinsci/puppet-jenkins: v1.5.0 | |
- ripienaar/puppet-module-data: 0.0.4 | |
- rackerlabs/puppet-repose: 1.6.0 | |
"[email protected]:ops": | |
- puppet-profile_crm: 0.1.12 | |
- puppet-profile_docker: 0.3.1 | |
- puppet-profile_java_app_server: 0.1.1 | |
- puppet-profile_jenkins: 1.4.0 | |
- puppet-repo: 0.3.1 | |
"[email protected]:config-management-modules": | |
- puppet-passwordsafe: 0.3.5 |
cetanu
commented
Dec 18, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment