ansible

CLI Tool

ansible/ansible

An agentless IT automation platform for deployment and configuration management.

Overview

Ansible provides agentless automation using SSH, enabling management of machines, application deployment, and multi-node orchestration. It uses human-readable YAML playbooks and supports infrastructure as code.

README Preview

[](https://pypi.org/project/ansible-core)\n[](https://docs.ansible.com/ansible/latest/)\n[](https://docs.ansible.com/ansible/devel/community/communication.html#real-time-chat)\n[](https://docs.ansible.com/ansible/devel/community/communication.html#forum)\n[](https://dev.azure.com/ansible/ansible/_build/latest?definitionId=20&branchName=devel)\n[](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html)\n[][copying]\n[](https://bestpractices.coreinfrastructure.org/projects/2372)\n\n# Ansible\n\nAnsible is a radically simple IT automation system. It handles\nconfiguration management, application deployment, cloud provisioning,\nad-hoc task execution, network automation, and multi-node orchestration. Ansible makes complex\nchanges like zero-downtime rolling updates with load balancers easy. More information on the Ansible [website](https://ansible.com/).\n\n## Design Principles\n\n* Have an extremely simple setup process with a minimal learning curve.\n* Manage machines quickly and in parallel.\n* Avoid custom-agents and additional open ports, be agentless by\n  leveraging the existing SSH daemon.\n* Describe infrastructure in a language that is both machine and human\n  friendly.\n* Focus on security and easy auditability/review/rewriting of content.\n* Manage new remote machines instantly, without bootstrapping any\n  software.\n* Allow module development in any dynamic language, not just Python.\n* Be usable as non-root.\n* Be the easiest IT automation system to use, ever.\n\n## Use Ansible\n\nYou can install a released version of Ansible with `pip` or a package manager. See our\n[installation guide](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html) for details on installing Ansible\non a variety of platforms.\n\nPower users and developers can run the `devel` branch, which has the latest\nfeatures and fixes, directly. Although it is reasonably stable, you are more likely to encounter\nbreaking changes when running the 

FAQ (5)

Troubleshooting
How to fix 'AttributeError: module dataclasses has no attribute _is_type' when running ansible-galaxy or ansible with Python 3.15?

This error occurs because ansible-core 2.21 relies on internal dataclasses._is_type API that was removed in Python 3.15, and ansible-core 2.21 does not support Python 3.15. Fixes: (1) Upgrade to ansible-core 2.22+, the first version with official Python 3.15 support (fixed via PR #86976): pip install --upgrade ansible-core>=2.22. (2) Or downgrade your interpreter to a supported Python version (e.g., 3.14 or lower) for ansible-core 2.21. There is no backport planned for 2.21, so upgrading ansible-core or downgrading Python are the only options.

GitHub Issue #87677
Troubleshooting
How to fix Ansible "Timeout waiting for privilege escalation prompt" when using --become on Ubuntu 26.04?

This affects ansible-core 2.21.x on Ubuntu 26.04 because Ansible selects the wrong sudo executable for privilege escalation. Work around it by explicitly setting the become executable to /usr/bin/sudo.ws:

ansible -i hosts.ini ubuntu26 -a "ls" -k -K -b -e ansible_become_exe=/usr/bin/sudo.ws

Alternatively, set it in your inventory:

[ubuntu26]
your-host ansible_become_exe=/usr/bin/sudo.ws

Verify the path with command -v sudo.ws if it is not present. The issue is fixed in the Ansible devel branch; backport/fix PRs include #86905 and #86964, so upgrade to an ansible-core release containing that fix when available.

GitHub Issue #87423
Troubleshooting
How to fix "'bool' object has no attribute 'strip'" for an Ansible no_log option with a non-string default?

This is a regression in ansible-core 2.22.0b2 and affected devel builds (#87457); ansible-core 2.21 is not affected. Upgrade to a release or devel build containing the fix for issue #87623, or temporarily downgrade to ansible-core 2.21.

As a module workaround, remove no_log=True from non-secret boolean, integer, or port options that have non-string defaults, for example:

# Before
force=dict(type='bool', no_log=True, default=True)

# After
force=dict(type='bool', default=True)

The same change applies to no_log sub-options and role argument_specs. The patched Ansible version handles non-string defaults correctly and skips masking boolean True/False values.

GitHub Issue #87623
Troubleshooting
How do I stop ansible_facts from one host leaking onto another host in the same play?

This is caused by cross-host dictionary aliasing in VariableManager.set_host_facts() in ansible-core 2.21.x, especially with multiple hosts or a run_once task. The fix copies the facts dictionary before caching it instead of storing the caller's dict reference. Upgrade to an ansible-core release containing PR #87415, or apply that patch manually.

As a reliable workaround, call ansible.builtin.setup explicitly, use register, and read facts from the registered variable instead of the implicit ansible_facts:

- name: Gather host facts
  ansible.builtin.setup:
  register: host_setup

- name: Use registered facts
  ansible.builtin.debug:
    var: host_setup.ansible_facts.ansible_default_ipv4.address

Changing forks, strategy, callbacks, or running --flush-cache does not resolve the issue because the facts are being aliased in memory.

GitHub Issue #87415
Troubleshooting
Why does `state: restarted` have no effect for a disabled service with `ansible.builtin.service` on FreeBSD?

On FreeBSD, the service module maps start, stop, and reload to their one* equivalents for disabled services, but restart is not mapped to onerestart. Therefore a disabled service is not restarted.

Workaround: invoke FreeBSD's onerestart directly:

- name: Force-restart disabled FreeBSD service
  become: true
  ansible.builtin.command:
    cmd: /usr/sbin/service apache24 onerestart
  changed_when: true

Alternatively, enable the service before restarting it:

- name: Enable and restart apache24
  become: true
  ansible.builtin.service:
    name: apache24
    enabled: true
    state: restarted

The upstream code fix is to map the restart action the same way:

if self.action == "restart":
    self.action = "onerestart"

GitHub Issue #84793