Hello,
several months ago together with my brother we have started to work on Ansiblator > Python wrapper modul which makes Ansible more easy to use in Python itself. It is just base class which should make other corresponing efforts to be quicker and easier. Other part is DictToInventory converter.
import ansiblator.api as an
ans = an.Ansiblator()
ans.run("uname -a", now=True)
ans.run("uptime")
ans.run_all()
ans.user(name="hugo", sudo=True)
ans.copy(src="/tmp/aabc.csv", dest="/tmp/",pattern="pc",now=True)
Before I had talked with project leader by email (mainly about license). Main thing why I am writing here is because, now it feels, that it could be improved more, for example maybe somehow implemented inside of Ansible modules. Another thing is to improve it itself. Ansiblator always always uses new runner for each run, it can get really slow beacause it is not using playbooks-runner (it continues to stay in connection). So the question if somehow we could improve this, to be Ansible more usefull inside Python it self. For example I think that Fabric api is more clean and more nicer to use in Python itself.
another main use are custom classes:
`
class Automatization(Ansiblator):
def update_server(self, su=True,sudo=False):
self.run("apt-get update", su=su, sudo=sudo)
self.run("apt-get upgrade -y", su=su, sudo=sudo)
#use custom class and more patterns together:
ans = Automatization(pattern=['servers', 'production', 'test', 'pc'], sudo=True)
ans.update_server()
`
There is probably another similar project on https://pypi.python.org/pypi/suitable/
Anyway, we will continue on work for ansiblator, as we are already using it for our service, where we need direct control from Python.
Regards,
zd