Puppet - Hiera 中的多重角色
Puppet - Multiple Roles in Hiera
我正在尝试(并努力)在 Hiera 中实现一个(多个)角色模型。
在过去的 2 年里,我一直在使用与用户完全相同的模型,现在我想自己重建相同的结构。例如,我的 node.yaml 应该只包含我想应用到主机的角色:
/etc/puppetlabs/code/environments/production/nodes/my.host.de.yaml
classes:
- ydixken_baseinstall
- additional_modules
[...]
对我来说,在角色/目录中放置一个带有角色名称的 yaml 并避免处理配置文件更直观:
/etc/puppetlabs/code/environments/production/roles/ydixken_baseinstall.yaml
classes:
- apt
- unattended_upgrades
- [...]
apt::update:
frequency: 'daily'
loglevel: 'debug'
[...]
将角色定义作为节点事实对我来说不可行。如果需要,允许在节点配置中自定义已定义的值也很好。
现在我的目录 hiera.yaml 和文件结构如下所示:
/etc/puppetlabs/puppet/hiera.yaml
version: 5
defaults:
datadir: /etc/puppetlabs/code/environments/production
data_hash: yaml_data
hierarchy:
- name: "Per-node data (yaml version)"
paths:
- "nodes/%{fqdn}.yaml"
- "roles/%{role}.yaml"
- common
/etc/puppetlabs/code/environments/production/hiera.yaml
version: 5
defaults:
hierarchy:
- name: "FQDN"
path: "nodes/%{fqdn}.yaml"
- name: "Roles"
path: "roles/%{role}.yaml"
- name: "Common Data"
path: "common.yaml"
/etc/puppetlabs/code/environments/production/manifests/site.pp
hiera_include('classes')
我怎样才能做到这一点?
我当前的错误:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Could not find class ::ydixken_baseinstall for my.host.de (file: /etc/puppetlabs/code/environments/production/manifests/site.pp, line: 1, column: 1) on node my.host.de
我完全找到了我要找的东西:r10k
我正在尝试(并努力)在 Hiera 中实现一个(多个)角色模型。
在过去的 2 年里,我一直在使用与用户完全相同的模型,现在我想自己重建相同的结构。例如,我的 node.yaml 应该只包含我想应用到主机的角色:
/etc/puppetlabs/code/environments/production/nodes/my.host.de.yaml
classes:
- ydixken_baseinstall
- additional_modules
[...]
对我来说,在角色/目录中放置一个带有角色名称的 yaml 并避免处理配置文件更直观:
/etc/puppetlabs/code/environments/production/roles/ydixken_baseinstall.yaml
classes:
- apt
- unattended_upgrades
- [...]
apt::update:
frequency: 'daily'
loglevel: 'debug'
[...]
将角色定义作为节点事实对我来说不可行。如果需要,允许在节点配置中自定义已定义的值也很好。
现在我的目录 hiera.yaml 和文件结构如下所示:
/etc/puppetlabs/puppet/hiera.yaml
version: 5
defaults:
datadir: /etc/puppetlabs/code/environments/production
data_hash: yaml_data
hierarchy:
- name: "Per-node data (yaml version)"
paths:
- "nodes/%{fqdn}.yaml"
- "roles/%{role}.yaml"
- common
/etc/puppetlabs/code/environments/production/hiera.yaml
version: 5
defaults:
hierarchy:
- name: "FQDN"
path: "nodes/%{fqdn}.yaml"
- name: "Roles"
path: "roles/%{role}.yaml"
- name: "Common Data"
path: "common.yaml"
/etc/puppetlabs/code/environments/production/manifests/site.pp
hiera_include('classes')
我怎样才能做到这一点?
我当前的错误:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Could not find class ::ydixken_baseinstall for my.host.de (file: /etc/puppetlabs/code/environments/production/manifests/site.pp, line: 1, column: 1) on node my.host.de
我完全找到了我要找的东西:r10k