Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Puppetfile in Yaml or Json format ? #380

Closed
mvisonneau opened this issue Apr 1, 2015 · 4 comments
Closed

Puppetfile in Yaml or Json format ? #380

mvisonneau opened this issue Apr 1, 2015 · 4 comments
Labels

Comments

@mvisonneau
Copy link

Hi there,

I was wondering if it could be considered in the future to define the Puppet file into an other format than the Ruby DSL ?

For instance :

---
forge: "http://forge.puppetlabs.com"
modules:
  "puppetlabs/apache":
    version: 1.4.0
  "puppetlabs/stdlib":
    version: 4.2.0
  "nrpe":
    source: "https://github.com/mvisonneau/puppet-module-nrpe.git"
    version: "facfebef7be29bc29a5b0611f4a5aae570f7ff08"

I think this will help the management of huge Puppetfiles.

@adrienthebo
Copy link
Contributor

Considered? Yes, definitely. Is it a high priority right now? Not terribly, since there's not been a lot of demand for this. Could you elaborate a bit on how a different file format would impact the management of huge Puppetfiles?

@mvisonneau
Copy link
Author

Well I am planning to develop an interface in order to manage required modules. It would be much nicer to be able to work with a yaml/json file rather than the ruby DSL :)
Moreover I find it easier to read than the ruby dsl too.

@adrienthebo
Copy link
Contributor

Given that the Puppetfile is Ruby, you can also just write a method that reads a YAML file and generates data as needed:

require 'yaml'
datapath = File.expand_path("modules.yaml", File.join(__FILE__, ".."))
data = YAML.load_file(datapath)

forge data["forge"]

data["modules"].each_pair do |name, settings|
  mod name, settings["version"]
end

While it would be nice to have this in core at some point, there's nothing stopping you from implementing something like this right now.

@mvisonneau
Copy link
Author

great idea, thanks for the tip. I will give it a shot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants