How to get MaaS Regional controller IP/FQDN in preseed files via {{var}}?

Hello
Is it possible to get REGION controller IP/FQDN via variables in preseed files?
I am able to get RACK controller used for booting during deployment {{node.boot_cluster_ip}} but unable to find the way how to get region one directly from preseed file (maas cli can’t be used).
Is it possible? Thank you!

Hi @temp0

I wonder if server_host can be helpful?

Hello Anton @troyanov
Thank you for your response.
Before I created this question I checked exactly same file you provided and tried all vars which included “region” word nearby so I tried “region_ip”, “http_proxy” and other ones from this file but all of them returned empty string or that it is not defined at all:

Failed to render preseed: name 'region_ip' is not defined at line 13 column 3 in file /etc/maas/preseeds/curtin_userdata_rhel_amd64_generic

I am impressed that “server_host” and “server_url” returns non-empty string but “region_ip” fail the preseed, totally weird. I am almost sure I also tested “server_host” or definitely “default_region_ip” as it is part of it but it returned error that it is not defined.
Don’t understand region_ip can’t be used but server_host works (from the context of preseed.py file) but great there is something usable, thanks!
I need to test it in environment with non-region controllers as well to check it really returns region and not rack/boot controller as I just tested it only in env with only one region controller.
Thank you very much for tip and if someone else knows why server_host works but not others in preseed.py, it will be great (to understand what vars can be used without testing each of them randomly but get failures in most cases :upside_down_face:)

You can access values by keys that are exposed in get_preseed_context and get_node_preseed_context functions. There is also get_node_deprecated_preseed_context but as the name says it is already deprecated and can be removed in the future releases.

Don’t understand how is it possible I totally oversight this “return” part during search/grep/whatever :face_with_peeking_eye:
Thank you :+1:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.