user3330284
user3330284

Reputation: 383

Puppet unable to find environment

I have a simple Puppet environment, just started with one master and one agent.

I am getting following error when I do puppet module list from my agent. I run puppet agent -t it is not even going to my site.pp and test.pp.

I am not sure if I am missing anything in the Puppet configurations.

 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

Here is my 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
~

Here is the directory structure on 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

Here is the my puppet agent 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

Upvotes: 1

Views: 6804

Answers (2)

user3330284
user3330284

Reputation: 383

The issue was with my environment.conf file.

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

I removed it from environment directory and it started working, not puppet modules list but puppet agent -t

@Frank you are right puppet modules list will not work on agent nodes.

Thanks for your help.

Upvotes: 1

Felix Frank
Felix Frank

Reputation: 8223

Custom modules will not show up in puppet modules list output. It lists modules with metadata, typically installed from the Forge using puppet module install.

On the agent, it is normal to have no local environments to search for modules (or install them).

Upvotes: 0

Related Questions