MCollective puppet runonce and puppet agent daemon conflict?

533 views
Skip to first unread message

Stella

unread,
Sep 5, 2014, 2:46:14 PM9/5/14
to puppet...@googlegroups.com
Hi,

I am using open source Puppet 3.6.2 with Dashboard and Mcollective.

If I have puppet agent running and then from puppet master I run "mco puppet runonce --server puppetmaster_name", I will get this error:
Cannot specify any custom puppet options when the daemon is running

I understand that I do not need to have puppet agent running for the agent to work.
I can stop it entirely and then trigger runs through mcollective -- in that setup it will happily pass custom arguments like --noop or --no-noop etc.

However, that's not exactly what I want. Here is what I want:

1. I want my puppet agent to be running so that it can retrieve the catalog from puppet master based on the runinterval set in /etc/puppet/puppet.conf on agent machine. For example,

#The interval between each puppet agent run, in seconds
     runinterval = 6000   

In one post, someone mentioned that if you did want periodic noop runs then just cron
   puppet agent --daemonize --onetime --noop

So if I setup cron for puppet agent, that will run "puppet agent --test" based on the cron schedule?

2. Occasionally, I want to push configuration change and don't want to wait until the next runinterval time. I want to push the change to my puppet agent machines using MCollective command line "mco puppet runonce".

mco puppet runonce --server host_name

In this case, I always get "daemon is running" error, if puppet agent is running, if I use --server option.
If I use -I option (mco puppet runonce -I puppet-agent.example.com), it works even if puppet agent daemon is running.
What is the difference between option --server and -I? If I want to push configurations to multiple hosts, which option should I use?

Hope I make myself understood :)

Thanks a lot,
Stella

José Luis Ledesma

unread,
Sep 5, 2014, 2:52:09 PM9/5/14
to puppet...@googlegroups.com

You can use mcollective to run periodic revisions with noop:
mco puppet --noop runall 10

This will run puppet on every machine with concurrency of 10 ( so no more than 10 puppet agent will be retrieving/applying the catalog at the same time).

You can also stop puppet from mcollective, push configuration, and start it again:
mco service puppet stop -I hostname
mco puppet runonce --no-noop -I hostname
Wait until finished and then
mco service puppet start -I hostname

I prefer first option :)

Regards,

--
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/15daf8e8-b45e-49d4-9358-c9a03969e85f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

José Luis Ledesma

unread,
Sep 5, 2014, 2:53:06 PM9/5/14
to puppet...@googlegroups.com

Forgot about last question,you can specify more than one -I in each command

El 05/09/2014 20:46, "Stella" <stellat...@gmail.com> escribió:
--

Stella

unread,
Sep 5, 2014, 3:36:08 PM9/5/14
to puppet...@googlegroups.com
Jose, thank you for the reply.

Yes, I understand all those commands. Oh, so you are saying I can use mco to temporarily stop my puppet agent when I need to do mco runonce and then start it back. Good idea!

 But what is the answer to my question:

Can I have both puppet agent running (so that it can retrieve/apply the catalog as runinterval scheduled) and at same time run "mco puppet runonce" to push configuration change to multiple machines? Now I can't, I always get daemon running error.
What is the correct mco command to run to achieve my purpose?

If that's not possible, should I stop puppet agent entirely so that I can run mco puppet runone successfully, and setup a cron job to start puppet agent as the runinterval scheduled?
What will not happen if puppet agent is stopped entirely? It won't retrieve and apply catalog, right? No sending report to puppet master?

thanks,
Stella

Christopher Wood

unread,
Sep 5, 2014, 3:41:16 PM9/5/14
to puppet...@googlegroups.com
On Fri, Sep 05, 2014 at 11:46:14AM -0700, Stella wrote:
> Hi,
>
> I am using open source Puppet 3.6.2 with Dashboard and Mcollective.
>
> If I have puppet agent running and then from puppet master I run "mco
> puppet runonce --server puppetmaster_name", I will get this error:
> Cannot specify any custom puppet options when the daemon is running

Have you tried with filtering instead of --server? It sounds like --server is being used on the puppet invocation command line, to point the agent at a particular server.

mco puppet runonce -F hostname=puppetmaster_name
mco puppet runonce -F fqdn=puppetmaster_name.domain.com

From 'mco help puppet' it seems that any options to runonce are taken as options for the agent, not options for mcollective.

> I understand that I do not need to have puppet agent running for the agent
> to work.
> I can stop it entirely and then trigger runs through mcollective -- in
> that setup it will happily pass custom arguments like --noop or --no-noop
> etc.
>
> However, that's not exactly what I want. Here is what I want:
>
> 1. I want my puppet agent to be running so that it can retrieve the
> catalog from puppet master based on the runinterval set in
> /etc/puppet/puppet.conf on agent machine. For example,
>
> #The interval between each puppet agent run, in seconds
>      runinterval = 6000   
>
> In one post, someone mentioned that if you did want periodic noop runs
> then just cron
>    puppet agent --daemonize --onetime --noop
>
> So if I setup cron for puppet agent, that will run "puppet agent --test"
> based on the cron schedule?
>
> 2. Occasionally, I want to push configuration change and don't want to
> wait until the next runinterval time. I want to push the change to my
> puppet agent machines using MCollective command line "mco puppet runonce".
>
> mco puppet runonce --server host_name
>
> In this case, I always get "daemon is running" error, if puppet agent is
> running, if I use --server option.
> If I use -I option (mco puppet runonce -I [1]puppet-agent.example.com), it
> works even if puppet agent daemon is running.
> What is the difference between option --server and -I? If I want to push
> configurations to multiple hosts, which option should I use?
>
> Hope I make myself understood :)
>
> Thanks a lot,
> Stella
>
> --
> 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 [2]puppet-users...@googlegroups.com.
> To view this discussion on the web visit
> [3]https://groups.google.com/d/msgid/puppet-users/15daf8e8-b45e-49d4-9358-c9a03969e85f%40googlegroups.com.
> For more options, visit [4]https://groups.google.com/d/optout.
>
> References
>
> Visible links
> 1. http://puppet-agent.example.com/
> 2. mailto:puppet-users...@googlegroups.com
> 3. https://groups.google.com/d/msgid/puppet-users/15daf8e8-b45e-49d4-9358-c9a03969e85f%40googlegroups.com?utm_medium=email&utm_source=footer
> 4. https://groups.google.com/d/optout

Stella

unread,
Sep 5, 2014, 4:09:27 PM9/5/14
to puppet...@googlegroups.com, christop...@pobox.com
No, I didn't try with filtering.

I tried Jose's suggestion:
mco puppet runall 10

and yours:

mco puppet runonce -F hostname=puppetmaster_name

Both work fine. So I will forget --server option :)

thanks a lot
Stella
Reply all
Reply to author
Forward
0 new messages