Skip to content

Instantly share code, notes, and snippets.

@aphor
Created February 23, 2021 02:58
Show Gist options
  • Save aphor/977facc24057622cbec7dbd481a7cec7 to your computer and use it in GitHub Desktop.
Save aphor/977facc24057622cbec7dbd481a7cec7 to your computer and use it in GitHub Desktop.
salt_cloud_map_run.py
#!/usr/bin/python3
import salt
import sys
if __name__ == '__main__':
MINION_NAME = 'salt-cloud'
HOSTNAME = sys.env['hostname']
FOLDER = sys.env['folder']
IP = sys.env['ip']
CLOUDMAP = {"PROFILE":[{HOSTNAME:{"folder":FOLDER,"devices":{"network":{"Network adapter 1":{"ip":IP}}}}}]}
client = salt.client.LocalClient()
jid = client.cmd_async(MINION_NAME, 'cloud.map_run', map_data=CLOUDMAP)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment