ansible-community / ara

ARA Records Ansible and makes it easier to understand and troubleshoot.

Home Page:https://ara.recordsansible.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow specifying username to record

phemmer opened this issue · comments

What is the idea ?

Currently ARA pulls the username from the OS user the process is running as. In my setup, ansible is run via CI jobs, and also from a container, so the user is always recorded as "root", which is not useful. The CI (GitLab) provides a variable which indicates the user who triggered the job, and I would like to be able to use this variable to populate the recorded user.

It seems like this change should be simple enough by adding a new option and using the value if set, otherwise falling back to the current behavior. I'd be willing to submit a PR if you agree, and have an idea on what the option should be named.

 

On a side note, host name also suffers from the same issue, as it gets the name of the container. However this is not important to me, but it may be important to others.

+1

This is also something we are looking for.

This is fair enough and I agree that the implementations for the controller hostname and username are similar in nature.

If we do one, we might as well do the other as well for similar reasons.

We currently have ARA_RECORD_USER and ARA_RECORD_CONTROLLER (here), I suppose if we have something like ARA_RECORD_USER_NAME and ARA_RECORD_CONTROLLER_NAME (or something to that effect) we can use those instead of trying to automatically recover them.

It makes sense to me and I can review a PR for something like that :)

Was already missing this feature as well!

For user there is currently the workaround to set LOGNAME, I'm doing that already in my CI pipelines, but for the hostname there is no such dirty fix (setting HOSTNAME doesn't work).

Thanks for taking care of it!

Just chiming in to mention I haven't forgotten about this but my focus and (limited) time has been spent elsewhere, sorry.

It will be included before the next release of ara goes out for sure.