Search code examples
configurationpuppetagent

Puppet agent not using modulepath setting


I have installed Puppet Agent 3.7 on an AWS Ubuntu machine.

After receiving a 'could not find class' error, I added a modulepath entry to the /etc/puppetlabs/puppet/puppet.conf file.

modulepath=/home/ubuntu/repos/puppet-tests/modules

However, if I run the following command, I am told that the module path(s) haven't changed.

puppet apply --configprint modulepath

i.e.

/home/ubuntu/.puppet/modules:/usr/share/puppet/modules

I have tried placing the modulepath setting in both the [main] and [agent] sections.

Does anyone know what I am doing wrong?

Many thanks.


Solution

  • The puppet confdir depends on user that executes puppet command. That's why puppet cofiguration will differ for different users. Please read the documentation about confdir location, and check the following example:

    vagrant@mytest:~$ puppet apply --configprint modulepath
    /home/vagrant/.puppet/modules:/usr/share/puppet/modules
    
    vagrant@mytest:~$ sudo su 
    root@mytest:/home/vagrant# puppet apply --configprint modulepath
    /etc/puppet/modules/lib:/etc/puppet/modules:/opt/puppet/share/puppet/modules
    

    Summarizing, execute puppet as a root, or modify puppet config for non root user in ~/.puppet directory.