Red Cricket
Red Cricket

Reputation: 10460

Error: Could not initialize global default settings: Cannot set modulepath settings in puppet.conf

I am having trouble setting my modulepath on my puppet master.

# puppet -V
4.10.5

Here is the default modulepath

# puppet config print modulepath
/etc/puppetlabs/code/environments/production/modules:/etc/puppetlabs/code/modules:/opt/puppetlabs/puppet/modules

I have to add two directories ...

... to my modulepath. So I am doing this:

# puppet config set modulepath "/etc/puppetlabs/code/environments/production/modules/tools:/etc/puppetlabs/code/environments/production/modules/core:`puppet config print modulepath`"

But I get this error:

# puppet config print modulepath
Error: Could not initialize global default settings: Cannot set modulepath settings in puppet.conf

The modulepath in my puppet.conf looks ok:

# grep modulepath /etc/puppetlabs/puppet/puppet.conf
modulepath = /etc/puppetlabs/code/environments/production/modules/tools:/etc/puppetlabs/code/environments/production/modules/core:/etc/puppetlabs/code/environments/production/modules:/etc/puppetlabs/code/modules:/opt/puppetlabs/puppet/modules

I am doing something wrong or is this a bug?

Upvotes: 1

Views: 3865

Answers (2)

Matthew Schuchard
Matthew Schuchard

Reputation: 28739

These extra module paths are specific to your production directory environment, so they can be appended in your production directory environment's environment.conf like such:

# /etc/puppetlabs/code/environments/production/environment.conf  
/etc/puppetlabs/code/environments/production/modules/tools:/etc/puppetlabs/code/environments/production/modules/core:$basemodulepath

Your $basemodulepath is specified in your puppet.conf, typically at /etc/puppetlabs/puppet/puppet.conf. It is the value for basemodulepath in the INI format. modulepath from the config file is not used in the directory environment according to the documentation.

More information about environment.conf: https://docs.puppet.com/puppet/4.10/config_file_environment.html More information about appending module paths in your directory environment: https://docs.puppet.com/puppet/4.10/config_file_environment.html#modulepath

Upvotes: 4

serup
serup

Reputation: 3822

lets say you want to list the modules you have installed in your modulepath and would like to write:

puppet module list

instead of :

puppet module list --modulepath=C:\tmp\modules

then you could set the modulepath by setting the basemodulepath like this:

puppet config set basemodulepath "C:\tmp\modules"

This creates a file puppet.conf inside puppetlabs ; under windows it could be here:

C:\Users\< username >\.puppetlabs\etc\puppet

you would then afterwards beable to list your installed modules like this:

puppet module list

if you use modulepath and not basemodulepath then puppet will try to set modulepath everytime causing your error

Upvotes: -1

Related Questions