A simple SDK to use Ansible API.
Project description
ansible_simple
A simple SDK to use Ansible API.
usage
pip install ansible-simple
ansible module
from ansible_simple.api import AnsibleApi
a = AnsibleApi(remote_user="root", hosts=["192.168.13.109", "192.168.13.56"], remote_password={"conn_pass": "password"})
# a.run(module='shell', args='hostname')
# print(a.get_result())
ansible playbook
- name: mydbserver
hosts: mydbserver
gather_facts: no
tasks:
- name: uptime
raw: uptime
register: uptime
- debug:
msg: "{{ uptime.stdout }}"
- name: online pm2 ls
raw: ls
register: ls
- debug:
msg: "{{ ls.stdout }}"
a.playbook(dynamic_inv={"mydbserver":["192.168.13.109", "192.168.13.56"]}, playbooks=['test.yml'])
# print(a.get_result())
reference
https://packaging.python.org/en/latest/tutorials/packaging-projects/
https://docs.ansible.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ansible_simple-2.0.3.tar.gz
(7.4 kB
view details)
Built Distribution
File details
Details for the file ansible_simple-2.0.3.tar.gz
.
File metadata
- Download URL: ansible_simple-2.0.3.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47d9cccbcbe0b776c679707f8ced1d7540ff596b86aeb4912f358afc06bc0d04 |
|
MD5 | 97cc33e57f8db7e2d4a5b2f0b8b50594 |
|
BLAKE2b-256 | 0da8eb63d67e4c189cf85e4d18f0faf8536535fd96e2950d4e7fb316d149584d |
File details
Details for the file ansible_simple-2.0.3-py3-none-any.whl
.
File metadata
- Download URL: ansible_simple-2.0.3-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6a1f689d18aec5c3e544237575ab70603c0e11619d23750c371adaa91d322db |
|
MD5 | 84adea97ba5ab3cda3d9f8ca017af0fa |
|
BLAKE2b-256 | 8b695b0d79933f84d6f967c520648671623066b3d3b070c7cd2ed9f6927c6b45 |