Ask Your Question

Foreman/Puppet: Add User to sudoers with a module

asked 2016-01-18 16:05:08 -0600

SPQRInc gravatar image

I would like to improve my skills in Foreman and Puppet. To do so I would like to get some easy tasks done.

In my configuration all servers belonging to host group "Basic" should get a basic setup - including adding a new user and adding this to the sudsers-file.

To do so I'm using example42/sudo

Now I would like to add a user by adding a file to the directory /etc/sudoers.d/.

The documentation tells me to use sudo::directive.

This is an example:

sudo::directive { 'jenkins':
  content => "jenkins ALL=NOPASSWD: /usr/sbin/puppi \n", # Double quotes and newline (\n) are needed here

Now my question is: I know how to add a class to a host group. I also know how to override params.

My current configuration for the host group "Basis" looks like this:

Foreman config

But how can I use sudo::directive in Foreman?

edit retag flag offensive close merge delete


You asked the same on serverfault (, which has been answered. Perhaps you can comment on it, or explain what more information you require.

domcleal gravatar imagedomcleal ( 2016-01-20 03:07:35 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-01-22 11:31:18 -0600

Sarsa-JP gravatar image

This sudo::directive is a declared resource of sudo module right? In Foreman you will not have access to resource declaration directly. You put it in a class inside a module, and then use this class in Foreman.

For example, I was deploying a software for Windows that required a given version of .NET. I already have the module that installs the software and I found a module that declares a resource type dotnet and manages .NET. What I did: I created a class inside my software module, and declared the resource dotnet there.

Then in Foreman I can classify my nodes with this individual class software::dotnet.

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: 2016-01-18 16:05:08 -0600

Seen: 839 times

Last updated: Jan 22 '16