Metadata-Version: 2.1
Name: ansible_simple
Version: 2.0.3
Summary: A simple SDK to use Ansible API.
Author-email: rayzh <kribugzzz@outlook.com>
Project-URL: Homepage, https://github.com/Lorryrui/ansbile_simple
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: ansible==8.5.0
Requires-Dist: ansible-base==2.10.17

# ansible_simple  
A simple SDK to use Ansible API.

# usage  
> pip install ansible-simple  

## ansible module  
```python
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  
```yaml
- 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 }}"
```
```python
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  
