Skip to main content
Ansiblator
==========

This wrapper allows more easier way how to use Ansible in Python.
Chain commands without without playbooks. More like Fabric.

With this Ansible can be more powerfull and it will allow to chain commands with
python commands. Ansible documentation is on http://docs.ansible.com/.
API is now trying to feel like Fabric, but it's still not complete, there
will be some changes.

Get started
===========

For instalation you can download package and then just unpack and use

python setup.py install

or

pip install ansiblator


Quickstart
==========

For most quickest example you can just create your ansible host file named
ansible_hosts inside your home directory or give full path to file.

Ansiblator is mainly using file such as in ~/ansible_hosts.

code::

from ansiblator.api import Ansiblator
ans = Ansiblator()
ret = ans.local("uname -a", now=True, use_shell=True)
ans.run("uname -a", now=True)
ans.runner("uptime")
ans.run_all()
ans.copy(src="/tmp/aabc.csv", dest="/tmp/",pattern="pc",now=True)

specify ansible hosts file and select pattern::

ans = Ansiblator(inventory="/tmp/ansible_file", pattern="pc")

use dictionary to create ::

inv = {'pc':[{'ssh_host':'192.168.0.10', 'ssh_user':'test_user', 'su_user':'root'},
{'ssh_host':'192.168.0.12', 'ssh_user':'test_user2', 'su_pass':'paasswd','su_user':'root'}]}
ans = Ansiblator(inventory=inv)
ans.run("uname -a", now=True)

prepare commands and run after::

ans = Ansiblator(run_at_once=False)
ans.get(src="/tmp/file", dest="/tmp/")
ans.get(src="/tmp/file2", dest="/tmp/")
ans.run_all()

With this, you can create full commands or functions and just pass to them
pattern and run at the end.


More information
================

Ansiblator automatically saves returned json values for actuall runs, so
you can use them for testing and conditions. For example

testing::

return_code = ans.local("uname -a", now=True, use_shell=True)
return_code['contacted']

or

return_code = ans.local(["uname", "-a"], now=True, use_shell=False)
return_code['contacted']

Info
====
For more information you can consult functions or actual Ansible documentation.
More information can be also used on http://www.pripravto.cz. You can also
contact us there.

Release files for ansiblator 0.5-8-29-09-2014

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ansiblator 0.5-8-29-09-2014
File Size Uploaded
ansiblator-0.5-8-29-09-2014.tar.gz 7.2 kB Details

Release files / ansiblator-0.5-8-29-09-2014.tar.gz

Download URL ansiblator-0.5-8-29-09-2014.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6856fb285b7570d82962d247dd2b6e14abad9a82757300228fa01268aa6c68e2
BLAKE2b-256 checksum
How to use checksums
76c043f14edb78cfbf57ac78de537d55d7d06c805ea3768914571e621fb49621
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page