Estou usando o Foreman, o Puppet e o Hiera para fornecer dados de parâmetro para meus nós. Cada nó tem seu próprio arquivo node.yaml no Puppet Master em / etc / puppet / hieradata. Há também um arquivo global.yaml que define alguns outros parâmetros não encontrados nos arquivos node.yaml. Parece que quando eu faço um fantoche, o parâmetro pi_firewall :: global :: loghash não está sendo puxado do global.yaml.
Abaixo está a mensagem de erro real, alguns testes de CLI que eu executei no nó e no PM, bem como o arquivo de configuração hiera.yaml e global.yaml.
== Mensagem de erro ==
root@door0036:~# puppet agent -t
Warning: Local environment: "production" doesn't match server specified node environment "development", switching agent to "development".
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: create_resources(): second argument must be a hash at /etc/puppet/environments/development/modules/pi_firewall/manifests/init.pp:52 on node door0036.domain.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
== Executado no Node (Puppet) ==
root@door0036:~# puppet apply -e '$loghash = hiera(pi_firewall::global::loghash) notify { $loghash: }'
Error: Could not find data item pi_firewall::global::loghash in any Hiera data file and no default supplied at line 1 on node door0036.neardesk.com
Error: Could not find data item pi_firewall::global::loghash in any Hiera data file and no default supplied at line 1 on node door0036.neardesk.com
== Ran Hiera na PM (CLI) ==
ubuntu@foreman:/etc/puppet/hieradata$ hiera pi_firewall::global::loghash ::fqdn=door0036.neardesk.com{"000 accept all icmp"=>
{"proto"=>"icmp", "action"=>"accept", "chain"=>"INPUT"},
"000 allow any related or established"=>
{"proto"=>"all",
"state"=>["RELATED", "ESTABLISHED"],
"action"=>"accept",
"chain"=>"INPUT"},
"002 accept dst_type MULTICAST"=>
{"dst_type"=>"MULTICAST", "chain"=>"INPUT", "action"=>"accept"},
"002 accept dst_type BROADCAST"=>
{"dst_type"=>"BROADCAST", "chain"=>"INPUT", "action"=>"accept"},
"501 allow ssh access to unit"=>
{"port"=>22, "proto"=>"tcp", "action"=>"accept", "chain"=>"INPUT"},
"100 allow http access to this device"=>
{"port"=>80, "proto"=>"tcp", "action"=>"accept", "chain"=>"INPUT"},
"101 allow monit http access to this device"=>
{"port"=>2812, "proto"=>"tcp", "action"=>"accept", "chain"=>"INPUT"},
"999 drop all"=>{"proto"=>"all", "action"=>"drop"}}
== hiera.yaml em PM ==
---
:backends:
- yaml
:yaml:
:datadir: /etc/puppet/hieradata
:hierarchy:
- "%{::clientcert}"
- global
== global.yaml (/ etc / puppet / hieradata /) ==
pi_firewall::global::loghash:
'000 accept all icmp':
proto: icmp
action: accept
chain: INPUT
'000 allow any related or established':
proto: all
state: ['RELATED', 'ESTABLISHED']
action: accept
chain: 'INPUT'
'002 accept dst_type MULTICAST':
dst_type: MULTICAST
chain: INPUT
action: accept
'002 accept dst_type BROADCAST':
dst_type: BROADCAST
chain: INPUT
action: accept
'501 allow ssh access to unit':
port: 22
proto: tcp
action: accept
chain: INPUT
'100 allow http access to this device':
port: 80
proto: tcp
action: accept
chain: INPUT
'101 allow monit http access to this device':
port: 2812
proto: tcp
action: accept
chain: INPUT
'999 drop all':
proto: all
action: drop
pi_ssh::sshd_enabled: 'no'
pi_cardreader::nd_byip: 'value'
pi_cardreader::nd_id: 'value2'
pi_cardreader::nd_password: 'value3'
pi_cardreader::nd_mode: 'value4'
pi_wallboard::url: 'http://tv.neardesk.com/?mac='