Snippet for creating users when provisioning vm

Problem:

Hello.
I’m a bit new to foreman and I don’t understand how to create a specific user when provisionning a linux os .

I want to create a user “ansible” with a specifi dsa key and uid/gid
But how to create a snippet /user isn’t very clear for me

Expected outcome:

Foreman and Proxy versions:
1.22.1-1.el7
Foreman and Proxy plugin versions:
1.22.1-1.el7
Other relevant data:
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]
(for logs, surround with three back-ticks to get proper formatting, e.g.)

logs

There are already two snippets you can utilize or use as inspiration.

create_users creates user based on the owner of the host.

remote_execution_ssh_keys creates a user based on the settings for the Remote Execution / Ansible Plugin including sudo rules.

In the most cases the last one is enough and you only have to adjust the settings in Foreman, but for the specific uid/gid you will have to adjust it.

Best way to do this would be upstream , but to change it only locally copy the snippet and the template which should include it and in the template change the name of the snippet accordingly.

1 Like

I’m not really a ruby dev, so it’s a bit difficult for me