在没有主节点的情况下将节点的目录编译为 JSON? [英] Compile a node's catalog to JSON without a master?

查看:34
本文介绍了在没有主节点的情况下将节点的目录编译为 JSON?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望通过比较实际节点目录的差异来改进我组织的 Puppet 工作生命周期.我们遇到了这个项目,它为节点编译目录并为它们创建一个差异,但它似乎需要一个在线大师.

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.

我需要能够做这个工具所做的事情,尽管没有大师 - 我只想编译一个确定性的 JSON 或 YAML blob,它描述了由 Puppet 为给定节点管理的所有资源和给定一组事实.

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?

推荐答案

如果您设置了 Rspec-puppet,有一个简单的方法可以做到这一点.只需在其中一个 it 块中添加一个 File.write 语句:

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.

如果你不能用Rspec-puppet来做(推荐),看看我写的另一篇博文,在笔记本电脑上编译木偶目录.

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.

这篇关于在没有主节点的情况下将节点的目录编译为 JSON?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆