Probably a silly question, but is it possible to refer to another Python file with the script module?
For example, if I have abc.py and 123.py, if I import 123.py into the abc.py python script (if I need some functions or whatever), both of these files are not copied when I call the script module for abc.py in the playbook.
Obviously, I didn’t think ansible would check to make sure all the imports are valid inside a Python script, but how can I get it to work otherwise? Documentation (http://docs.ansible.com/ansible/script_module.html) doesn’t have any examples of this and I tried looking up: ‘ansible python import ansible’ and other keywords with no real relevant results.
The only way I can think of doing this is copying both files over, then running the script, then deleting the copied files after run?
Is there a way to copy 123.py to a default location, wherever the script module uses to copy abc.py so when ansible-playbook tries to run abc.py, 123.py will already be there and import correctly. Afterwards, I can have the playbook delete 123.py to clean itself up.
The other way to do it is to just copy the functions/stuff you need from 123.py to abc.py but I was looking for a modular way to do this if possible. Any thoughts are appreciated, thank you!