Saturday, April 4, 2026

Ansible_2

 


Push Based
Ansible is push based by default

Making a change looks like this:
1. You: make a change to a playbook.
2. You: run the new playbook.
3. Ansible: connects to servers and executes modules that change the state of the servers.

The push-based approach has a significant advantage: you control when the changes happen to the servers.

Ansible Runner
"Ansible Runner “is a lightweight tool and python library that helps when interfacing with Ansible directly or as part of another system whether that be through a container image interface, as a standalone tool, or as a Python module that can be imported.”


Ansible Runner is a lightweight tool and Python library used to run Ansible playbooks and modules programmatically—especially useful in automation platforms like Ansible Automation Platform.


Using the ansible-runner library, you can run an Ansible playbook from within a Python script:
#!/usr/bin/env python3
import ansible_runner
r = ansible_runner.run(private_data_dir='./playbooks',
playbook='playbook.yml')

print("{}: {}".format(r.status, r.rc))
print("Final status:")
print(r.stats)


Organizations with hundreds of software teams typically use AWX or a combination of Ansible Tower and Automation Hub for auditability, and for security with role-based access controls.

Ansible uses SSH multiplexing to optimize performance

No comments:

Post a Comment