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:
But how can I use sudo::directive
in Foreman?
Best Answer
External Node Classifiers such as Foreman are not meant to allow you to declare individual resources directly. You can do a couple of things:
Since the module you are using does not offer a class parameter that takes a hash value to describe some initial resources, you cannot do this with the ENC directly.
You could build a custom module that takes a hash value and declares
sudo::directive
resources for you usingcreate_resources
.