小编wsa*_*ani的帖子

Ansible,如何在一个文件中加入多个数组?

使用它作为我的样板:https://github.com/modcloth/ansible-role-modcloth-sumologic-collector - 它工作得很好,但我正在寻找一些关于如何根据我的预期需求扩展它的建议.我需要能够基于多个数组创建一个JSON文件.

以下是SumoLogic JSON源中我需要的默认数组.

角色/ sumologic /默认/ main.yml:

sumologic_collector_default_log_path:

- { name: "Auth Log", path: "/var/log/auth.log", use_multiline: false, category: "OS/Linux/Auth" }
Run Code Online (Sandbox Code Playgroud)

假设我想从group_vars/app_server.yml向SumoLogic JSON文件添加一个额外的文件:

- { name: "Package Log", path: "/var/log/nginx/access.log", use_multiline: fasle, category: "OS/Linux/Nginx" }
Run Code Online (Sandbox Code Playgroud)

如何使用模板将上述示例组合到同一目标文件中?

很高兴提供更多细节.不完全确定我的思路是否有意义,尽管我认为set_fact是这样做的一种方式,但我无法理解这一点,以找出方法.

ansible

7
推荐指数
1
解决办法
1万
查看次数

Chef check for hostname?

It turns out I can't check for a node(host) name in Chef, so I'm trying to figure out the best way to make the following happen:

If hostname is X
 ldap_access_filter = memberOf=<%= node['sssd_ldap']['ldap_access_node_filter'] %>
else
 ldap_access_filter = memberOf=<%= node['sssd_ldap']['ldap_access_filter'] %>
end
Run Code Online (Sandbox Code Playgroud)

The idea is that when the node name (or some matching variable) is true, then it uses the ldap_access_node_filter, which is a unique value, else, it uses the default value. I'm basically configuring sssd config, and one of …

ruby chef-infra chef-solo

2
推荐指数
1
解决办法
7695
查看次数

标签 统计

ansible ×1

chef-infra ×1

chef-solo ×1

ruby ×1