0

I am learning puppet but I stuck with one problem. I have a Puppet installation with one Puppet master and one Puppet agent, and I am using open source Puppet. I to set up a environment named Test. The directory is as follows /etc/puppet/environments/Test its having modules and manifests directories. And environment.conf file.

My environment.conf contains the following line:

modulepath = $confdir/environments/production/modules

I created a module named sample inside the modules directory of the environment. Described one class called sample inside the init.pp of the sample module's manifests directory. The class is used to install a small software. In the the manifests directory of the environment Test I created a file site.pp which will implement the class sample defined inside the module.

My puppet.conf contains this following lines:

[main] logdir=/var/log/puppet vardir=/var/lib/puppet ssldir=/var/lib/puppet/ssl rundir=/var/run/puppet factpath=$vardir/lib/facter prerun_command=/etc/puppet/etckeeper-commit-pre postrun_command=/etc/puppet/etckeeper-commit-post server=puppet.master

[master] ssl_client_header = SSL_CLIENT_S_DN ssl_client_verify_header = SSL_CLIENT_VERIFY

But whenever I tried to implement the manifests in the Puppet agent, It is using the default site.pp and not using the environments site.pp

Can anyone tell me where I am doing the mistake.

Bidyut
  • 933
  • 1
  • 14
  • 30
  • In Puppet `3.x`, you need to specify the `environmentpath` option to make environment directories work. Also, using an absolute path as `modulepath` in an `environment.conf` is self-defeating, consider changing that to `= modules`, or just skipping it as that's the default. – Felix Frank Nov 11 '15 at 13:30

1 Answers1

1

In puppet agent configuration (usually /etc/puppet/puppet.conf) set the environment var to Test as follows:

[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
prerun_command=/etc/puppet/etckeeper-commit-pre
postrun_command=/etc/puppet/etckeeper-commit-post
server=puppet.master

[agent]
pluginsync      = true
report          = true
ignoreschedules = true
daemon          = false
ca_server       = server fqdn
certname        = client fqdn (signed in the server)
server          = server fqdn
show_diff       = true
listen          = true
environment     = Test
Ferrandinand
  • 444
  • 3
  • 11