0

我有一个简单的 Puppet 环境,刚开始有一个 master 和一个 agent。

当我puppet module list从我的代理那里做时,我收到了以下错误。我运行puppet agent -t 它甚至不会访问我的 site.pp 和 test.pp。

我不确定我是否遗漏了 Puppet 配置中的任何内容。

 puppet module list
/usr/lib/ruby/site_ruby/1.8/puppet/environments.rb:38:in `get!': Could not find a directory environment named 'test' anywhere in the path: /etc/puppet/environments. Does the directory exist? (Puppet::Environments::EnvironmentNotFound)
        from /usr/lib/ruby/site_ruby/1.8/puppet/application.rb:365:in `run'
        from /usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:146:in `run'
        from /usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:92:in `execute'
        from /usr/bin/puppet:8

这是我的木偶大师 puppet.conf

    [main]
    # The Puppet log directory.
    # The default value is '$vardir/log'.
    logdir = /var/log/puppet

    # Where Puppet PID files are kept.
    # The default value is '$vardir/run'.
    rundir = /var/run/puppet

    # Where SSL certificates are kept.
    # The default value is '$confdir/ssl'.
    ssldir = $vardir/ssl
    dns_alt_names = cssdb-poc-01.cisco.com cssdb-poc-01

[master]
    server = cssdb-poc-01.cisco.com
    certname = cssdb-poc-01.cisco.com
    dns_alt_names = cssdb-poc-01.cisco.com cssdb-poc-01
    environmentpath = /etc/puppet/environments
    environment = test

[agent]
    # The file in which puppetd stores a list of the classes
    # associated with the retrieved configuratiion.  Can be loaded in
    # the separate ``puppet`` executable using the ``--loadclasses``
    # option.
    # The default value is '$confdir/classes.txt'.
    classfile = $vardir/classes.txt

    # Where puppetd caches the local configuration.  An
    # extension indicating the cache format is added automatically.
    # The default value is '$confdir/localconfig'.
    localconfig = $vardir/localconfig
~

这是 puppet master 的目录结构。

    [root@cssdb-poc-01 test]# tree /etc/puppet/environments/
/etc/puppet/environments/
├── example_env
│   ├── manifests
│   ├── modules
│   └── README.environment
├── production
└── test
    ├── environment.conf
    ├── manifests
    │   └── site.pp
    └── modules
        └── cassandra
            ├── manifests
            └── test.pp

这是我的木偶代理 puppet.conf

cat /etc/puppet/puppet.conf
[main]
    # The Puppet log directory.
    # The default value is '$vardir/log'.
    logdir = /var/log/puppet

    # Where Puppet PID files are kept.
    # The default value is '$vardir/run'.
    rundir = /var/run/puppet

    # Where SSL certificates are kept.
    # The default value is '$confdir/ssl'.
    ssldir = $vardir/ssl

[main]
    server=cssdb-poc-01.cisco.com
    environmentpath = /etc/puppet/environments
    environment = test

[agent]
    # The file in which puppetd stores a list of the classes
    # associated with the retrieved configuratiion.  Can be loaded in
    # the separate ``puppet`` executable using the ``--loadclasses``
    # option.
    # The default value is '$confdir/classes.txt'.
    classfile = $vardir/classes.txt

    # Where puppetd caches the local configuration.  An
    # extension indicating the cache format is added automatically.
    # The default value is '$confdir/localconfig'.
    localconfig = $vardir/localconfig
4

2 回答 2

1

问题出在我的 environment.conf 文件上。

[root@cssdb-poc-01 templates]# cat /tmp/environment.conf
modulepath = /etc/puppet/environments/test/modules:$basemodulepath
manifest = manifests

我从环境目录中删除了它,它开始工作,puppet modules list但不是puppet agent -t

@Frank 你是对的puppet modules list,不会在代理节点上工作。

谢谢你的帮助。

于 2015-08-17T00:53:31.663 回答
0

自定义模块不会显示在puppet modules list输出中。它列出了带有元数据的模块,通常使用puppet module install.

在代理上,没有本地环境来搜索模块(或安装它们)是正常的。

于 2015-08-13T10:12:17.533 回答