跳到内容

安装支持执行环境的 ansible-navigator

建议

安装 ansible-navigator推荐方法是使用 ansible-dev-tools 包。Ansible 开发工具旨在简化创建 Ansible 内容所需的多种工具的设置和使用。它将关键的 Ansible 开发包组合到一个统一的 Python 包中。

# This also installs ansible-core if it is not already installed
pip3 install ansible-dev-tools

Linux

要求

安装用于执行环境支持的所需容器引擎

安装 ansible-navigator

  1. 使用系统包安装程序安装 python 包管理器 (例如)

    sudo dnf install python3-pip
    
  2. 安装 ansible-navigator

    python3 -m pip install ansible-navigator --user
    
  3. 将安装路径添加到用户 shell 初始化文件 (例如)

    echo 'export PATH=$HOME/.local/bin:$PATH' >> ~/.profile
    
  4. 刷新 PATH (例如)

    source ~/.profile
    
  5. 启动 ansible-navigator

    ansible-navigator
    
  6. ansible-navigator 触发一次性下载演示执行环境镜像的操作。

macOS

要求 (macos)

安装用于执行环境支持的所需容器引擎 (macos)

安装 ansible-navigator (macos)

  1. 安装命令行开发人员工具,并在提示时继续安装。

    xcode-select --install
    
  2. 安装 ansible-navigator

    pip3 install ansible-navigator --user
    
  3. 使用已安装的 Python 版本将安装路径添加到 PATH

    echo 'export PATH=$HOME/Library/Python/3.10/bin:$PATH' >> ~/.zprofile
    
  4. 刷新 PATH

    source ~/.zprofile
    
  5. 启动 ansible-navigator

    ansible-navigator
    
  6. ansible-navigator 触发一次性下载演示执行环境镜像的操作。

带 WSL2 的 Windows

要求 (windows)

使用 Ubuntu 设置 Windows Linux 子系统 2

  1. 安装 适用于 Linux 2 的 Windows 子系统
  2. 从 Microsoft 商店安装 Ubuntu 20.04 LTS Linux 发行版。
  3. 打开 PowerShell 并设置默认的 WSL 2 发行版

    wsl --set-default ubuntu
    
  4. 从 Windows 菜单启动 Ubuntu] 虚拟机并完成初始设置。

  5. 在 Ubuntu 终端中,创建 /dev/mqueue 目录

    sudo mkdir /dev/mqueue
    

安装用于执行环境支持的所需容器引擎 (windows)

  • 在 Ubuntu 20.04 LTS 上安装 podman 的说明。

!!! 注意

  The podman package is available in the official repositories for Ubuntu 20.10 and newer.
  Since interim releases of Ubuntu are not available on the Microsoft Store for WSL the
  [Kubic project] package can be used.
  1. 更新 ubuntu 包索引

    sudo apt update
    
  2. 安装 podman 的系统依赖项

    apt-get install curl wget gnupg2
    
  3. 获取 Ubuntu 版本信息

    source /etc/os-release
    
  4. 添加 podman 存储库

    sudo sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"
    
  5. 下载 GPG 密钥

    wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_${VERSION_ID}/Release.key -O- | sudo apt-key add -
    
  6. 使用新存储库更新

    sudo apt-get update
    
  7. 安装 podman

    sudo apt-get install podman
    
  8. 按照 适用于 Windows 的 Docker Desktop 安装说明进行操作(如果未安装上述 podman)

  9. 请务必完成以非 root 用户身份管理 Docker 步骤。

安装 ansible-navigator (windows)

从 Ubuntu 终端

  1. 确保 /dev/mqueue 目录存在

    sudo mkdir /dev/mqueue
    
  2. 安装 python 包管理器

    sudo apt install python3-pip
    
  3. 安装 ansible-navigator

    python3 -m pip install ansible-navigator --user
    
  4. 将安装路径添加到用户 shell 初始化文件

    echo 'export PATH=$HOME/.local/bin:$PATH' >> ~/.profile
    
  5. 刷新 PATH

    source ~/.profile
    
  6. 启动 ansible-navigator

    ansible-navigator
    
  7. ansible-navigator 触发一次性下载演示执行环境镜像的操作。