-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to import hosts with hostname/shortname only #1070
Comments
Hi @benjdudas, |
Hi nesanton, Let me try to clarify this point because a big customer is requesting us that. The customer has many network segments and they are connecting only with short name. When they need to identify another network segment the domain related to that segment is added "on the fly" during the automation process. Each segment has a corresponding domain name. Because of that, when Ansible Tower tries to contact a host, the same FQDN of this synced host from the Satellite inventory can point to many ip addresses according to network segment of this host. Another point is that all hosts are registered into Satellite with only one domain, then a need to rack the foreman.py[1] script to remove the domain part (There is an option into Satellite Settings to remove the domain), but it is done when registering only. This option is not possible to use because there are more then 20k hosts already registered into Satellite. Having a variable into foreman.yml to "enable/disable" the domain part would avoid the customer to controlling by hands the modification into foreman.py script in the Foreman collection. [1] - Foreman collection plugin edited:
Thank you! |
so we're trying (but failing a bit, sorry) to understand your issue: |
Hi evgeni, It's the first one! Without modifying the line 246 as my previous post, the managed nodes are imported into Tower with FQDN, as the customer needs all managed nodes imported only with short name (without the domain), he is "maintaining" a custom version of the foreman.py script because there isn't a way to remove the domain officially with the script. The customer didn't think it is an "issue" from foreman.py, but a "desired" feature to avoid customization of the original script (RFE) that he hopes we can have in these collection/plugin. Let me know if it helps you! |
Mhh. For the later, you could've used compose, but that only allows to modify variables of a host, not the name itself. I think this is an RFE against Ansible, to allow a common way to mangle the hostname in the same way compose does for variables. An inventory plugin should not be in the business of implementing this. |
Ok evgeni, I understand you, but I guess a RFE against Ansible would demand another configs when importing the inventory, probably with performance impact when we have many managed nodes imported (I could see it from previous versions of foreman script and Satellite 6.6). Could we have one variable in foreman.yml to redirect the code if this var is "true"?:
to:
What do you think? Thank you! |
No, I still think this should not be done inside our inventory, but if at all then in Ansible. But ideally you fix the data in Foreman/Satellite. |
Ok evgeni, I know that Foreman/Satellite has a feature in Configuration/Settings which removes the domain when registering a host, but this can't be made for all already registered hosts, only new registered hosts. Unfortunately there are more than 20k hosts already registered in a customer environment and those hosts will not be passive to change. The Tower docs has mentioned that the support is for inventory plugin templates, in this case the Foreman/Satellite plugin template don't have a feature to remove the domain part when importing the Foreman/Satellite hosts to Tower (please let me know if I'm wrong). What I can understand based on your observation is that Ansible/Tower team should improve the inventory plugin template to best manipulate the hosts being imported (example: would be implement something like compose to remove domain part from FQDN) Could you clarify if I'm summarizing correctly? A RFE with Ansible/Tower team would be the appropriate path? I'm asking because I have already created one, but the recommendation was to have a RFE in Foreman. |
Ansible and Tower are two completely different things ;-) You opened an RFE against AWX/Tower, but it should be Ansible. But, I did some research, and maybe what I invision is actually implementable with current Ansible. I'll give it a shot and come back. Just for the record, I think the requirement "I need shortnames in my inventory" is rather nonsense, as tomorrow another use will come and say "but I need to replace the domain of all my hosts". If we can make this templateable by the user (instead of a boolean switch), they can go and do whatever they want, and keep the pieces if they break it ;)) |
Have a look #1080 :) |
Hey evgeni++ I completely agree with you, if we could have this kind of changes templateable will be very useful! My insistence was because we didn't have any way to do it and the customer was maintaining a separated code for that and accounting us! I guess it can be useful for anyone who wants to use Foreman inventory short names like this customer ... ;-) Now, they will have a way to do it and will be much more "easy" to plan and grow the environment without "racks in the code". For sure I will reinforce that templates with plugins will be the most suitable solution to go forward! Thank you so much for helping us to achieve this feature here!!! |
SUMMARY
A option which we could use in the plugin to remove the domain part from "host.domain" when importing a Foreman inventory would be very useful to have a inventory only with hostname/shortname of hosts imported from Foreman.
ISSUE TYPE
The text was updated successfully, but these errors were encountered: