Compile a node's catalog to JSON without a master?

人盡茶涼 提交于 2019-12-13 02:14:14

问题


I'm looking to improve my org's Puppet work lifecycle by comparing differences for actual node catalogs. We came across this project which compiles catalogs for nodes and creates a diff for them, but it seems to require an online master.

I need to be able to do what this tool does, albeit without a master - I'd just like to compile a deterministic JSON or YAML blob which describes all of the resources that would be managed by Puppet for a given node and given a set of facts.

Is there a way for me to do this without an online master?


回答1:


If you have Rspec-puppet set up, there is an easy way to do this. Just add a File.write statement inside one of your it blocks:

require 'spec_helper'

describe 'myclass' do
  it {
    File.write(
      'myclass.json',
      PSON.pretty_generate(catalogue)
    )
    #is_expected.to compile.with_all_deps
  }
end

I have more information in a blog post on this here.

If you can't use Rspec-puppet to do it (recommended), have a look at another blog post I wrote, Compiling a puppet catalog – on a laptop.



来源:https://stackoverflow.com/questions/37578666/compile-a-nodes-catalog-to-json-without-a-master

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!