当安装工头时,木偶清单上的等级没有值

  • 本文关键字:安装工 puppet hiera theforeman
  • 更新时间 :
  • 英文 :


如果尝试使用calling_class从模块中获取数据,则数据不会进入puppet清单,如果将变量放入common或osfamily,则可以从manifets中获得yaml文件值。我的环境:木偶大师3.7.4+工头1.7+希拉1.3.4层次结构配置:

    ---
:backends:
  - yaml
:hierarchy:
  - "%{::environment}/node/%{::fqdn}" #node settings
  - "%{::environment}/profile/%{calling_class}" # profile settings
  - "%{::environment}/%{::environment}" # environment settings
  - "%{::environment}/%{::osfamily}" # osfamily settings
  - common # common settings
:yaml:
  :datadir: '/etc/puppet/hiera'

/etc/puppet/hiera/production/profile/common.yaml

profile::common::directory_hierarchy:
  - "C:\SiteName"
  - "C:\SiteName\Config"
profile::common::system: "common"

在配置文件模块清单上/etc/puppet/environments/production/modules/profile/manifests/common.pp

class profile::common (
      $directory_hierarchy      =undef,
      $system                   =undef
  )
{
  notify { "Dir is- $directory_hierarchy my fqdn is $fqdn, system = $system": }
}

Puppet-config/etc/Puppet/Puppet.config

[main]
    logdir = /var/log/puppet
    rundir = /var/run/puppet
    ssldir = $vardir/ssl
    privatekeydir = $ssldir/private_keys { group = service }
    hostprivkey = $privatekeydir/$certname.pem { mode = 640 }
    autosign       = $confdir/autosign.conf { mode = 664 }
    show_diff     = false
    hiera_config = $confdir/hiera.yaml
[agent]
    classfile = $vardir/classes.txt
    localconfig = $vardir/localconfig
    default_schedules = false
    report            = true
    pluginsync        = true
    masterport        = 8140
    environment       = production
    certname          = puppet024.novalocal
    server            = puppet024.novalocal
    listen            = false
    splay             = false
    splaylimit        = 1800
    runinterval       = 1800
    noop              = false
    configtimeout     = 120
    usecacheonfailure = true
[master]
    autosign       = $confdir/autosign.conf { mode = 664 }
    reports        = foreman
    external_nodes = /etc/puppet/node.rb
    node_terminus  = exec
    ca             = true
    ssldir         = /var/lib/puppet/ssl
    certname       = puppet024.novalocal
    strict_variables = false
    environmentpath  = /etc/puppet/environments
    basemodulepath   = /etc/puppet/environments/common:/etc/puppet/modules:/usr/share/puppet/modules
    parser = future

更有趣的是,如果在没有工头的情况下部署相同的代码,它就会起作用。也许我错过了一些配置或插件?

您需要一个环境(示例中的production)文件夹结构,如下所示:

/etc/puppet/hiera/environments/production/node/%{::fqdn}.yaml
/etc/puppet/hiera/environments/production/profile/%{calling_class}.yaml
/etc/puppet/hiera/environments/production/production/*.yaml
/etc/puppet/hiera/environments/production/%{::osfamily}.yaml
/etc/puppet/hiera/environments/common.yaml

所以你粘贴的环境路径也是错误的。

/etc/puppet/hiera/production/profile/common.yaml

旁注

从第一个角度来看,不应该将hieradata与modulepath混合,所以如果可以的话,将模块从basemodulepath 中移出

basemodulepath   = /etc/puppet/environments/common

粘贴puppet.conf后,真实的配置文件模块路径位于三个文件夹之一:

/etc/puppet/environments/common/modules/profile
/etc/puppet/modules/profile
/usr/share/puppet/modules/profile

相关内容

  • 没有找到相关文章

最新更新