2
votes

I m currently trying to configure some directory environment to manage different clients

Puppet Master version : "puppet-server-3.8.1-1" (centos 6)

Here is my tree from the puppet master /etc/puppet :

    ├── organisation
│   ├── environment.conf
│   ├── manifests
│   │   ├── accounts.pp
│   │   ├── lab_accounts.pp
│   │   ├── lab_nodes.pp
│   │   └── nodes.pp
│   └── modules
│       ├── account
│       │   ├── files
│       │   ├── lib
│       │   ├── spec
│       │   │   └── classes
│       │   └── templates
│       └── dns
│           ├── manifests
│           │   └── init.pp
│           └── templates
│               ├── resolv.conf.erb
│               └── resolv.conf.fqdn.erb
├── production
│   ├── environment.conf
│   ├── manifests
│   │   ├── accounts.pp
│   │   ├── lab_accounts.pp
│   │   └── lab_nodes.pp
│   └── modules
│       ├── account
│       │   ├── CHANGELOG
│       │   ├── files
│       │   ├── lib
│       │   ├── LICENSE
│       │   ├── manifests
│       │   │   ├── init.pp
│       │   │   └── site.pp
│       │   ├── metadata.json
│       │   ├── Modulefile
│       │   ├── Rakefile
│       │   ├── README.mkd
│       │   ├── spec
│       │   │   ├── classes
│       │   │   ├── defines
│       │   │   │   └── account_spec.rb
│       │   │   └── spec_helper.rb
│       │   └── templates
│       ├── dns
│       │   ├── manifests
│       │   │   └── init.pp
│       │   └── templates
│       │       ├── resolv.conf.erb
│       │       └── resolv.conf.fqdn.erb
│       └── sshkeys
│           └── manifests
│               └── init.pp
└── README.md

Now the configuration files : /etc/puppet.conf

[main]
    logdir = /var/log/puppet
    rundir = /var/run/puppet
    ssldir = $vardir/ssl
    dns_alt_names = centos66a.local.lab,centos66a,puppet,puppetmaster
[master]
    environmentpath = $confdir/environments
    basemodulepath = $confdir/modules:/opt/puppet/share/puppet/modules
[agent]
    classfile = $vardir/classes.txt
    localconfig = $vardir/localconfig
    server = puppet

Here is the environment I called "organisation" : /etc/puppet/environments/organisation/environment.conf

modulepath = /etc/puppet/environments/organisation/modules
environment_timeout = 5s

Now I declare my nodes in "nodes.pp" :

/etc/puppet/environments/organisation/manifests/nodes.pp

node 'centos66a.local.lab' {
  include dns
}

node 'gcacnt02.local.lab' {
  include dns
}

Here is the output when I try to sync my node to the master :

gcacnt02:~ # hostname
gcacnt02.local.lab
gcacnt02:~ # puppet agent -t
Info: Creating a new SSL key for gcacnt02.local.lab
Info: csr_attributes file loading from /etc/puppet/csr_attributes.yaml
Info: Creating a new SSL certificate request for gcacnt02.local.lab
Info: Certificate Request fingerprint (SHA256): 49:73:11:78:99:6F:50:BD:6B:2F:5D:B9:92:7C:6F:A9:63:52:92:53:DB:B8:A1:AE:86:21:AF:36:BE:B0:94:DB
Info: Caching certificate for gcacnt02.local.lab
Info: Caching certificate for gcacnt02.local.lab
Info: Retrieving pluginfacts
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find default node or by name with 'gcacnt02.local.lab, gcacnt02.local, gcacnt02' on node gcacnt02.local.lab
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

if I move /etc/puppet/environments/organisation/manifests/nodes.pp to /etc/puppet/environments/production/manifests/nodes.pp it works just fine.

When I print "manifest" from "organisation" and "production" I get a correct output asweel :

[root@centos66a environments]# puppet config print manifest --section master --environment production
/etc/puppet/environments/production/manifests
[root@centos66a environments]# puppet config print manifest --section master --environment organisation
/etc/puppet/environments/organisation/manifests

I m probably missing something here but can't put my finger on it...

Thank you

1

1 Answers

0
votes

Problem resolved.

Configuration on the master is OK.

Since Puppet scan for directory in the environment directory set by the "environmentpath" variables, I thought that the master would automaticly reply to nodes in setup in each environment. This is false.

Default environment is : Production.

If you set any other environment you have to configure each puppet agent node to query to a specific environment

In my case, my node is gcacnt02.local.lab. So to fix the issue I had to add the following variable in /etc/puppet/puppet.conf

[main]
    logdir = /var/log/puppet
    rundir = /var/run/puppet
    ssldir = $vardir/ssl

[agent]
    classfile = $vardir/classes.txt
    localconfig = $vardir/localconfig    
    environment = lan