Ansible 是一个开源的 IT 自动化和配置管理工具,可以帮助系统管理员自动执行任务、部署应用程序和管理基础设施。它设计为易于使用,可以帮助降低系统管理任务的复杂性和花费的时间。
在 Fedora 37 上安装 Ansible
第 1 步。在继续之前,请更新您的 Fedora 操作系统以确保所有现有软件包都是最新的。使用此命令更新服务器软件包:
<span class="pln">sudo dnf upgrade sudo dnf update sudo dnf install epel</span><span class="pun">-</span><span class="pln">release</span>
第 2 步。安装蟒蛇。
默认情况下,Python 在 Fedora 37 的默认存储库中可用,因此您可以使用包管理器安装它。要安装 Python,请运行以下命令:dnf
<span class="pln">sudo dnf install python3</span>
此命令将安装 Fedora 3 存储库中提供的最新版本的 Python 37。如果需要特定版本,可以通过键入以下命令来指定它:
<span class="pln">sudo dnf install python3</span><span class="pun">.</span><span class="pln">x</span>
您可以通过运行以下命令来验证是否已安装 Python:
<span class="pln">python3 </span><span class="pun">--</span><span class="pln">version</span>
有关安装 Python 的其他资源,请阅读下面的帖子:
- 如何在 Fedora Linux √ 上安装 Python
第 3 步。在 Fedora 37 上安装 Ansible。
默认情况下,Ansible 在 Fedora 37 基础存储库中可用。现在我们使用以下命令安装最新版本的 Ansible:dnf
<span class="pln">sudo dnf install ansible</span>
在安装过程中,系统可能会提示您确认依赖项的安装。键入“Y”并按回车键继续安装。
现在,通过运行以下命令验证 Ansible 是否已安装并正常工作:
<span class="pln">ansible </span><span class="pun">--</span><span class="pln">version</span>
输出:
<span class="pln">ansible </span><span class="lit">2.11</span><span class="pun">.</span><span class="lit">6</span><span class="pln"> config file </span><span class="pun">=</span> <span class="str">/etc/</span><span class="pln">ansible</span><span class="pun">/</span><span class="pln">ansible</span><span class="pun">.</span><span class="pln">cfg configured </span><span class="kwd">module</span><span class="pln"> search path </span><span class="pun">=</span> <span class="pun">[</span><span class="str">'/home/user/.ansible/plugins/modules'</span><span class="pun">,</span> <span class="str">'/usr/share/ansible/plugins/modules'</span><span class="pun">]</span><span class="pln"> ansible python </span><span class="kwd">module</span><span class="pln"> location </span><span class="pun">=</span> <span class="str">/usr/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">python3</span><span class="pun">.</span><span class="lit">10</span><span class="pun">/</span><span class="pln">site</span><span class="pun">-</span><span class="pln">packages</span><span class="pun">/</span><span class="pln">ansible executable location </span><span class="pun">=</span> <span class="str">/usr/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">ansible python version </span><span class="pun">=</span> <span class="lit">3.10</span><span class="pun">.</span><span class="lit">0</span> <span class="pun">(</span><span class="kwd">default</span><span class="pun">,</span> <span class="typ">Dec</span> <span class="lit">10</span> <span class="lit">2022</span><span class="pun">,</span> <span class="lit">11</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">46</span><span class="pun">)</span> <span class="pun">[</span><span class="pln">GCC </span><span class="lit">11.2</span><span class="pun">.</span><span class="lit">1</span> <span class="lit">20210728</span> <span class="pun">(</span><span class="typ">Red</span> <span class="typ">Hat</span> <span class="lit">11.2</span><span class="pun">.</span><span class="lit">1</span><span class="pun">-</span><span class="lit">1</span><span class="pun">)]</span>
感谢您使用本教程在 Fedora 37 系统上安装 Ansible 自动化 IT 基础架构任务。如需其他帮助或有用信息,我们建议您查看 Ansible 官方网站。