Ask Your Question

Any way to remove flag files on puppet nodes?

asked 2015-12-02 11:37:30 -0500

jsemerica gravatar image

updated 2015-12-02 11:58:41 -0500

This may be unique to my environment but we have all our application installs/upgrades managed through puppet. This is done mostly through Execs and is controlled with empty flag files in a certain directory. In the event of an upgrade for example, we'd change any application version numbers in hiera if necessary, remove the flag file and kick off the puppet agent. The code looks a bit like the following..

[Start upgrade] unless => '/usr/bin/test -f /puppet_flags/update.flag',


[After upgrade] command => '/bin/touch /puppet_flags/update.flag',

Is there any way using puppet/mcollective to remove these empty flag files to kick off the upgrade on several hosts at once?

So far I've tried using mcollective with the puppetRAL, shown below, but since our systems are set with 'noop = true' in puppet.conf it does not seem to apply the change even with '--no-noop'.

In /etc/puppetlabs/mcollective/server.cfg:

plugin.puppet.resourcetypewhitelist = exec

peadmin@puppetmaster:~$ mco puppet resource exec '/bin/touch /tmp/test-mco-flag' --no-noop Discovering hosts using the mc method for 2 second(s) .... 2

  • [ ============================================================> ] 2 / 2

host1 : OK {:result=>"current_value notrun, should be 0 (noop)", :changed=>false}

host2 : OK {:result=>"current_value notrun, should be 0 (noop)", :changed=>false}

Any other ideas I should try or is there a better way of doing this? Any help is appreciated!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-12-15 14:27:21 -0500

jsemerica gravatar image

For anyone that's curious, we ended up using the filemgr plugin for mcollective which should be perfect for our use.

edit flag offensive delete link more

answered 2015-12-02 20:03:02 -0500

lavaman gravatar image

updated 2015-12-02 20:03:40 -0500

You could have puppet place the version number from hiera in your flag file and have subscribe/notify to other resources when it changes.

edit flag offensive delete link more


Thanks, this will definitely work for a few of our upgrades, some of them don't use a version number though so I'll have to see if there's a workaround.

jsemerica gravatar imagejsemerica ( 2015-12-03 10:21:41 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-12-02 11:37:30 -0500

Seen: 139 times

Last updated: Dec 15 '15