OpenSource-Hub

ansible

CLI 도구

ansible/ansible

배포 및 구성 관리를 위한 에이전트리스 IT 자동화 플랫폼.

개요

Ansible은 SSH를 통해 에이전트리스 자동화를 제공하며, 머신 관리, 애플리케이션 배포 및 멀티 노드 오케스트레이션을 지원합니다. 읽기 쉬운 YAML 플레이북을 사용하여 코드형 인프라를 지원합니다.

README 미리보기

[](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)

문제 해결
Python 3.15에서 ansible-galaxy 또는 ansible을 실행할 때 발생하는 'AttributeError: module dataclasses has no attribute _is_type' 오류를 해결하는 방법

이 오류는 ansible-core 2.21이 Python 3.15에서 제거된 내부 dataclasses._is_type API에 의존하기 때문에 발생하며, ansible-core 2.21은 Python 3.15를 지원하지 않습니다. 해결 방법: (1) Python 3.15를 공식적으로 지원하는 첫 번째 버전인 ansible-core 2.22+로 업그레이드하세요 (PR #86976에서 수정됨): pip install --upgrade ansible-core>=2.22. (2) 또는 ansible-core 2.21에서 지원되는 Python 버전(예: 3.14 이하)으로 인터프리터를 다운그레이드하세요. 2.21에 대한 백포트 계획은 없으므로 ansible-core 업그레이드 또는 Python 다운그레이드가 유일한 방법입니다.

원본 Issue #87677
문제 해결
Ubuntu 26.04에서 --become 사용 시 발생하는 Ansible "Timeout waiting for privilege escalation prompt" 오류 해결 방법

이 문제는 Ansible이 권한 상승을 위해 잘못된 sudo 실행 파일을 선택하기 때문에 Ubuntu 26.04의 ansible-core 2.21.x에 영향을 미칩니다. become 실행 파일을 /usr/bin/sudo.ws로 명시적으로 설정하여 이 문제를 우회하세요:

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

또는 인벤토리에서 설정할 수 있습니다:

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

해당 경로가 없는 경우 command -v sudo.ws로 경로를 확인하세요. 이 문제는 Ansible devel 브랜치에서 수정되었으며, 백포트/수정 PR에는 #86905 및 #86964가 포함되어 있으므로 해당 수정 사항이 포함된 ansible-core 릴리스가 제공되면 업그레이드하세요.

원본 Issue #87423
문제 해결
문자열이 아닌 기본값을 가진 Ansible no_log 옵션에서 발생하는 "'bool' object has no attribute 'strip'" 오류를 해결하는 방법은?

이는 ansible-core 2.22.0b2 및 영향을 받는 devel 빌드에서 발생한 회귀입니다(#87457). ansible-core 2.21은 영향을 받지 않습니다. issue #87623에 대한 수정 사항이 포함된 릴리스 또는 devel 빌드로 업그레이드하거나, 임시로 ansible-core 2.21로 다운그레이드하십시오.

모듈 차원의 해결 방법으로, 문자열이 아닌 기본값을 갖는 비밀 값이 아닌 boolean, integer 또는 port 옵션에서 no_log=True를 제거하십시오. 예를 들면 다음과 같습니다:

# 변경 전
force=dict(type='bool', no_log=True, default=True)

# 변경 후
force=dict(type='bool', default=True)

동일한 변경 사항이 no_log 하위 옵션과 role argument_specs에도 적용됩니다. 패치된 Ansible 버전은 문자열이 아닌 기본값을 올바르게 처리하고 boolean True/False 값의 마스킹을 건너뜁니다.

원본 Issue #87623
문제 해결
같은 플레이에서 한 호스트의 ansible_facts가 다른 호스트로 유출되는 것을 어떻게 막을 수 있나요?

이 문제는 ansible-core 2.21.x의 VariableManager.set_host_facts()에서 발생하는 호스트 간 딕셔너리 앨리어싱 때문에 발생하며, 특히 여러 호스트가 있거나 run_once 태스크가 있는 경우에 나타납니다. 이 수정 사항은 호출자의 dict 참조를 저장하는 대신 캐시하기 전에 facts 딕셔너리를 복사합니다. PR #87415가 포함된 ansible-core 릴리스로 업그레이드하거나 해당 패치를 수동으로 적용하십시오.

신뢰할 수 있는 우회 방법으로는 ansible.builtin.setup을 명시적으로 호출하고 register를 사용한 뒤, 암시적 ansible_facts 대신 등록된 변수에서 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

facts가 메모리에서 앨리어싱되고 있기 때문에 forks, strategy, callbacks를 변경하거나 --flush-cache를 실행해도 문제가 해결되지 않습니다.

원본 Issue #87415
문제 해결
FreeBSD에서 `ansible.builtin.service`를 사용할 때 비활성화된 서비스에 대해 `state: restarted`가 아무런 효과도 없는 이유는 무엇인가요?

FreeBSD에서 service 모듈은 비활성화된 서비스에 대해 start, stop, reload를 해당하는 one* 명령으로 매핑하지만, restart는 onerestart로 매핑되지 않습니다. 따라서 비활성화된 서비스는 재시작되지 않습니다.

해결 방법: FreeBSD의 onerestart를 직접 호출합니다:

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

또는, 재시작하기 전에 서비스를 활성화할 수 있습니다:

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

업스트림 코드 수정은 restart 동작을 동일한 방식으로 매핑하는 것입니다:

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

원본 Issue #84793