Is there any way to invoke runner functions in the profiles files ?
Description of Issue/Question
I have developed a runner module in salt that allows me to manage the reserves in infoblox and I would like to integrate it in the creation of new machines via salt-cloud.
Is there a way to invoke runner modules within the salt-cloud profile files? in the same way that they are invoked in the state files.
ip_address: {{ __salt__['infoblox.get_next_available_ip'](vlan=123) }}
Is the jinja syntax supported within the profiles files?
Thank you
Setup
salt version: 2017.7.1
The cloud profiles are not run through a renderer, so that is not possible.
You could use the salt orchestration states, and use saltutil.runner to run the infoblox runner, and then fill out the cloud module with the information you wanted.
https://github.com/saltstack/salt/issues/16850
Thanks for the reply.
Although in the documentation of the map files does not mention it seems that if the jinja syntax is supported although I am not clear if I can use in them the invocation of the runners modules.
Anyway, I do not understand the workflow you indicate. We want to facilitate the procedure of creating a virtual machine to the different departments but complying with the rules established by the virtualization group (name of datastore to use, management of ips via infoblox, etc.).
Can you give me an example of how to fill in the network information from the runner in the cloud files?
Thank you
/srv/salt/orch/build.sls
build server:
salt.runner:
- name: cloud.profile
- prof: <cloud profile
- instances:
- server1
- vm_overrides:
- ip_address: {{ salt.saltutils.runner(name='infoblox.get_next_available_ip', kwarg={'vlan': 123}) }}
That would allow you to override the ip_address with the infoblox information, and unless you use that or the client directly, that is the only way to do it.
Also, the map file is run through the renderer, so you should be able to override the ip_address for the profile there as well.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.