Question about Puppet CLI and --codedir

35 views
Skip to first unread message

CJ Cotton

unread,
Feb 4, 2016, 7:03:22 PM2/4/16
to Puppet Users
My understanding is that the Puppet CLI parameters will be the values taken in at run time.
I have two code directories; test and production.

They are exact replicas of each other.
If I force the puppetserver to run /etc/puppetlabs/test -- it will run without issue and as expected.

When I run the command;
puppet agent -t --codedir /etc/puppetlabs/test --noop

It will still run code out of /etc/puppetlabs/production. I tested this by putting a notify statement in  production, and not having one in test.
Every time I ran it, it ran with the notify statement indicating it was still reading /etc/puppetlabs/production.

Does anyone have any idea why it would not be using the parameter I input?

The puppetmaster does have the master.code.dir commented out.
The puppet.conf file on master only has an agent environment

I'm running this from a node (different server). I verified the puppet.conf for the server I'm running it from also does not have values, though at one point of testing I explicitly hardcoded them and it still failed.

Ideas, thoughts?


Cory Stoker

unread,
Feb 6, 2016, 10:07:45 PM2/6/16
to puppet...@googlegroups.com
So reading this right you want to have an agent run code out of the test branch on the puppetserver and not the production branch?  And it will work fine if you change the codedir on the puppetserver?

The clients usually do not dictate the code directory on the remote server.  They tell the server their environment and the server will handle the rest.  The server has a root codedir, and then uses environments to run different branches of your code.

Ideally you would have:

/etc/puppetlabs/code as your codedir on the server

Then you would have:
/etc/puppetlabs/code/environments/production
/etc/puppetlans/code/environments/test


On the agent then you would have in puppet.conf
[agent]
environment = test


Puppet has a bunch of defaults so commenting it out in the conf does not mean it isn't set still.

HTH

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/522ca301-dddb-4111-b19d-ebbd30666337%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages