Registry / devops / ansible-base

ansible-base

JSON →
library2.10.17pypypi✓ verified 83d ago

The foundational library for Ansible automation, containing the core execution engine, modules, and plugins. Version 2.10.17 is the final release of ansible-base before it was renamed to ansible-core. Requires Python >=2.7 and <3.5 or >=3.5.

pip install ansible-base==2.10.17
INSTALL
IMPORT
SIG · ANSIBLE-BASE
A
ansible-base
devopspythonv2.10.17
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ansible
import ansible
No import; use ansible-core or ansible package
release
from ansible import release
absolute_import
from ansible import absolute_import

Minimal example using Ansible Python API to run a ping module locally. Note: This is from ansible-core documentation; adapt for ansible-base where APIs may differ.

import ansible.constants as C import ansible.inventory.manager from ansible.parsing.dataloader import DataLoader from ansible.vars.manager import VariableManager from ansible.inventory.host import Host from ansible.playbook.play import Play from ansible.executor.task_queue_manager import TaskQueueManager from ansible.plugins.callback import CallbackBase # Example: run a simple ping module options = {'connection': 'local', 'module_path': '', 'forks': 100, 'become': None, 'become_method': None, 'become_user': None, 'check': False, 'diff': False} loader = DataLoader() inventory = ansible.inventory.manager.InventoryManager(loader=loader, sources='localhost,') variable_manager = VariableManager(loader=loader, inventory=inventory) play_source = dict( name = 'Ansible Play', hosts = 'localhost', gather_facts = 'no', tasks = [ dict(action=dict(module='ping', args='')), ] ) play = Play().load(play_source, variable_manager=variable_manager, loader=loader) class ResultCallback(CallbackBase): def __init__(self, *args, **kwargs): super(ResultCallback, self).__init__(*args, **kwargs) self.results = [] def v2_runner_on_ok(self, result, **kwargs): self.results.append({'ok': result._result}) tqm = TaskQueueManager( inventory=inventory, variable_manager=variable_manager, loader=loader, options=options, passwords=None, stdout_callback=ResultCallback(), ) tqm.run(play) tqm.cleanup()
ansible --version
Debug
Known issues
breakingansible-base was renamed to ansible-core starting from version 2.11. Any code importing from ansible-base or using pip install ansible-base will stop receiving updates.
fix
Use pip install ansible-core and update imports to ansible-core's structure (which is similar but may have moved modules).
affects: >=2.11.0
gotchaPython compatibility: ansible-base 2.10 requires Python >=2.7 and <3.5, or >=3.5. Python 3.5 is EOL and 2.7 is EOL. Upgrading is strongly recommended.
fix
Update to Python >=3.8 and use ansible-core or ansible package.
affects: 2.10.x
deprecatedThe package ansible-base is deprecated; use ansible-core or ansible.
fix
Replace dependency with ansible-core for the runtime or ansible for the full distribution.
affects: all
Upgrade
Version history
2.10.17latest on PyPI · released Jan 31, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
24 hits · last 30 days
node
20
OpenAI (training)
1
Resources
ansible-base — pip install ansible-base · libregistry