Foreman-ansible register host: doesnt set remote user home ownership

I’m trying to take advantage of the “register host” functionality with foreman ansible.
i have a non-root remote user set for remote execution.
I select
Remote Execution: Yes
for the register host generator.

I run it on the target host. it created the homedir and copied over the ssh key. great.
but… It doesnt chown the home directory to the username??
So ssh as the user with key doesnt work until I go and manually ssh into the host (or use a playbook) to chown the homedir.

The user exists in LDAP. All Im doing is chowning.

Why isnt the automated setup for “Register Host” doing this though?

Found whats going on myself.
The “Linux registration” template calls the remote_execution_ssh_keys snippet.

The snippet just blindly does a
mkdir -p <%= ssh_path %>

There does not seem to even be any option for enabling chown to the user
(which in my opinion, should be the DEFAULT, not an option)

but in any rate… since provided templates/snippets are non editable… I had to make my own versions of both the snippet, and the template, to do the job right.


1 Like