Closed vladvetu closed 5 months ago
The scenario: I want to use foreman as a single place of truth for my ansible setup and to integrate it with AWX to have an "as accurate" as possible inventory source. I saw that the host_groups can store parameters and I saw it as a great opportunity to keep generic ansible variables inside them and use the nesting feature to add/override parameters as needed.
Following the guide for integrating foreman with AWX/Tower I created a non-admin user
For non-admin users, you must assign the AWX Inventory Reader role to your Foreman server user.
The problem is that AWX Inventory Reader
role does NOT have the right to see the custom parameters added in host_groups or directly on a host (I believe that it can only see the global scoped parameters).
To be able to see the parameters the lowest role that I could found was Viewer
.
There is a View Host
role but it doesn't seem to have the right permission to see the host parameters
Perhaps there could be a hint in the documentation because seeing the parameters it's a nice way to customize the ansible inventory and use foreman as a single source of truth.
https://docs.theforeman.org/nightly/Configuring_Ansible/index-foreman-el.html#
Hope this saves somebody a little bit of time.
So you're saying the inventory code works fine, but the default role doesn't have sufficient permissions? That sounds like a bug in that role we should address.
Yes. If you can point me to the right repo, where should I open the issue, I will gladly do so.
The role comes from the foreman_ansible
plugin (see https://github.com/theforeman/foreman_ansible/blob/master/lib/foreman_ansible/register.rb) which tracks its issues at https://projects.theforeman.org/projects/ansible/issues
If you don't have an account there, shout, and I'll forward it myself.
I don't have one... So, if you can open one there will be much appreciated.
SUMMARY
Manually added host parameters don't get populated in foreman inventory plugin:
ISSUE TYPE
ANSIBLE VERSION
COLLECTION VERSION
KATELLO/FOREMAN VERSION
STEPS TO REPRODUCE
Output format: JSON
,Hosts: <your_host_with_new_params>
,Host Parameters: yes
-> Generateansible-inventory -i foreman.yml --host <host_with_the_new_param>
EXPECTED RESULTS
The new parameter to show in the hostvars.
ACTUAL RESULTS
The newly added host parameter does not get populated in the inventory
I feel like I'm missing something because the values are correctly shown in
Host View -> Ansible -> Inventory