{"id":26720,"library":"ansible-base","title":"Ansible (Base)","description":"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.","status":"deprecated","version":"2.10.17","language":"python","source_language":"en","source_url":"https://github.com/ansible/ansible","tags":["ansible","automation","deprecated","it","infrastructure"],"install":[{"cmd":"pip install ansible-base==2.10.17","lang":"bash","label":"Install specific version"}],"dependencies":[],"imports":[{"note":"ansible-base is not imported as a Python module. It is a meta-package that provides the CLI tools and internal modules. Use from ansible import ... or import ansible.constants etc.","wrong":"import ansible_base","symbol":"ansible_base","correct":"No import; use ansible-core or ansible package"},{"note":"ansible-base never had a module_utils.ansible_base module.","wrong":"from ansible.module_utils.ansible_base import AnsibleModule","symbol":"AnsibleModule","correct":"from ansible.module_utils.basic import AnsibleModule"}],"quickstart":{"code":"import ansible.constants as C\nimport ansible.inventory.manager\nfrom ansible.parsing.dataloader import DataLoader\nfrom ansible.vars.manager import VariableManager\nfrom ansible.inventory.host import Host\nfrom ansible.playbook.play import Play\nfrom ansible.executor.task_queue_manager import TaskQueueManager\nfrom ansible.plugins.callback import CallbackBase\n\n# Example: run a simple ping module\noptions = {'connection': 'local', 'module_path': '', 'forks': 100, 'become': None, 'become_method': None, 'become_user': None, 'check': False, 'diff': False}\nloader = DataLoader()\ninventory = ansible.inventory.manager.InventoryManager(loader=loader, sources='localhost,')\nvariable_manager = VariableManager(loader=loader, inventory=inventory)\nplay_source = dict(\n    name = 'Ansible Play',\n    hosts = 'localhost',\n    gather_facts = 'no',\n    tasks = [\n        dict(action=dict(module='ping', args='')),\n    ]\n)\nplay = Play().load(play_source, variable_manager=variable_manager, loader=loader)\n\nclass ResultCallback(CallbackBase):\n    def __init__(self, *args, **kwargs):\n        super(ResultCallback, self).__init__(*args, **kwargs)\n        self.results = []\n    def v2_runner_on_ok(self, result, **kwargs):\n        self.results.append({'ok': result._result})\n\ntqm = TaskQueueManager(\n    inventory=inventory,\n    variable_manager=variable_manager,\n    loader=loader,\n    options=options,\n    passwords=None,\n    stdout_callback=ResultCallback(),\n)\ntqm.run(play)\ntqm.cleanup()","lang":"python","description":"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."},"warnings":[{"fix":"Use pip install ansible-core and update imports to ansible-core's structure (which is similar but may have moved modules).","message":"ansible-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.","severity":"breaking","affected_versions":">=2.11.0"},{"fix":"Update to Python >=3.8 and use ansible-core or ansible package.","message":"Python 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.","severity":"gotcha","affected_versions":"2.10.x"},{"fix":"Replace dependency with ansible-core for the runtime or ansible for the full distribution.","message":"The package ansible-base is deprecated; use ansible-core or ansible.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Do not import ansible_base. Instead, use from ansible import ... or install ansible-core and use its modules.","cause":"Users try to import ansible_base as a Python module.","error":"ModuleNotFoundError: No module named 'ansible_base'"},{"fix":"Use 'pip install ansible-core' instead, or specify exact version like 'ansible-base==2.10.17'.","cause":"The package is no longer maintained and was removed from PyPI or only available for older Python versions.","error":"pip install ansible-base fails with 'Could not find a version that satisfies the requirement ansible-base'"},{"fix":"Ensure you are running inside an Ansible module; for API usage, use ansible-core's task executor.","cause":"Trying to use AnsibleModule outside of module context or using incompatible version.","error":"ImportError: cannot import name 'AnsibleModule' from 'ansible.module_utils.basic' (unknown location)"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}