Ask Your Question

How to disable usermod if the user is already created

asked 2015-05-07 00:42:32 -0600

bantubanerji gravatar image

Like "replace => no" attribute in file resource type, is it possible to disable modification of user if the user is already created ?

edit retag flag offensive close merge delete


So do you mean that once Puppet creates the user the first time, the account can be modified externally and Puppet should not change it back to the desired state?

GregLarkin gravatar imageGregLarkin ( 2015-05-07 20:21:13 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-05-08 11:51:18 -0600

interesting one.. i was thinking there should be a fact for users but it doesnt look like there is - creating a simple one that tests for exisitence of your user then in your module you could do something like:

if ( ! ::$stuuser) { do your stuff}

stuuser is a global fact - or you could add it to your module - would look like:

require 'facter'
require 'etc'
Facter.add(:stuuser) do
  setcode do
    name = "blah"

=> apologies as I've not had time to test the above - off for dinner, but hopefully you get the idea!

edit flag offensive delete link more

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-05-07 00:42:32 -0600

Seen: 165 times

Last updated: May 08 '15