傀儡无法找到环境

时间:2015-08-12 19:17:11

标签: puppet puppet-enterprise

我有一个简单的Puppet环境,只需要一个主服务器和一个代理程序。

当我从代理处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 master 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

2 个答案:

答案 0 :(得分: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将无法在代理节点上运行。

感谢您的帮助。

答案 1 :(得分:0)

自定义模块不会显示在{{1}}输出中。它列出了包含元数据的模块,通常使用{{1}}从Forge安装。

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