I am currently transforming a perl / bash tool into a salt module and I am wondering how I should sync the non-python parts of this module to my minions.
I want to run salt agent-less and ideally the dependencies would by synced automatically alongside the module itself once its called via salt-ssh.
But it seems that only python scripts get synced. Any thoughts for a nice and clean solution?
Copying the necessary files from the salt fileserver during module execution seems somehow wrong to me..
Only python extensions are supported, so your best bet is to do the following:
1) Deploy your non-Python components via a file.managed
/ file.recurse
state.
2) Ensure your custom execution module has a __virtual__()
function checking for the existence of the non-Python dependencies, and returning False
if they are not present. This will keep the module from being loaded and used unless the deps are present.
3) Sync your custom modules using saltutil.sync_modules
. This function will also re-invoke the loader to update the available execution modules on the minion, so if you already had your custom module sync'ed and later deployed the non-Python depenencies, saltutil.sync_modules
would re-load the custom modules and, provided your __virtual__()
function returned either True
or the desired module name, your execution module would then be available for use.