Ansible 是一款强大的自动化工具,支持多种操作系统。以下是常见安装方式:

1. 使用 pip 安装 🐍

pip install ansible

通过 Python 包管理器安装,适合 Linux/macOS 系统

ansible_logo

2. 使用包管理器安装 📦

Linux (Debian/Ubuntu)

sudo apt-get install ansible

Linux (CentOS/RHEL)

sudo yum install ansible

macOS (Homebrew)

brew install ansible

安装完成后可通过 ansible --version 验证版本

linux_system

3. 从源码编译安装 🧱

git clone https://github.com/ansible/ansible.git
cd ansible
python3 setup.py install

需要 Python 3.8+ 环境支持,建议先查看官方文档
🔗 Ansible 官方文档

常见问题

  • 安装失败:检查系统依赖是否满足
  • 版本冲突:尝试使用 pip uninstall ansible 卸载后重装
  • 权限问题:使用 sudo 提权或修改安装目录权限

🛠️ 点击此处查看 Ansible 快速入门指南 了解后续配置步骤。