ansible.cfg配置
介绍 (Introduction)
Configuration management systems are designed to streamline the process of controlling large numbers of servers, for administrators and operations teams. They allow you to control many different systems in an automated way from one central location.
配置管理系统旨在为管理员和操作团队简化控制大量服务器的过程。 它们使您可以从一个中央位置以自动化方式控制许多不同的系统。
While there are many popular configuration management tools available for Linux systems, such as Chef and Puppet, these are often more complex than many people want or need. Ansible is a great alternative to these options because it offers an architecture that doesn’t require special software to be installed on nodes, using SSH to execute the automation tasks and YAML files to define provisioning details.
尽管有许多流行的配置管理工具可用于Linux系统,例如Chef和Puppet ,但它们通常比许多人想要或需要的更为复杂。 Ansible是这些选项的绝佳替代方案,因为它提供了一种架构,该架构不需要在节点上安装特殊软件,使用SSH执行自动化任务,并使用YAML文件定义配置细节。
In this guide, we’ll discuss how to install Ansible on an Ubuntu 20.04 server and go over some basics of how to use this software. For a more high-level overview of Ansible as configuration management tool, please refer to An Introduction to Configuration Management with Ansible.
在本指南中,我们将讨论如何在Ubuntu 20.04服务器上安装Ansible,并详细介绍如何使用此软件。 有关Ansible作为配置管理工具的更高级概述,请参阅Ansible配置管理简介 。
先决条件 (Prerequisites)
To follow this tutorial, you will need:
要遵循本教程,您将需要:
One Ansible Control Node: The Ansible control node is the machine we’ll use to connect to and control the Ansible hosts over SSH. Your Ansible control node can either be your local machine or a server dedicated to running Ansible, though this guide assumes your control node is an Ubuntu 20.04 system. Make sure the control node has:
一个Ansible控制节点 :Ansible控制节点是我们将用于通过SSH连接并控制Ansible主机的机器。 您的Ansible控制节点可以是本地计算机,也可以是专用于运行Ansible的服务器,尽管本指南假定您的控制节点是Ubuntu 20.04系统。 确保控制节点具有:
A non-root user with sudo privileges. To set this up, you can follow Steps 2 and 3 of our Initial Server Setup Guide for Ubuntu 20.04. However, please note that if you’re using a remote server as your Ansible Control node, you should follow every step of this guide. Doing so will configure a firewall on the server with
ufw
and enable external access to your non-root user profile, both of which will help keep the remote server secure.具有sudo特权的非root用户。 要进行设置,您可以按照《 Ubuntu 20.04初始服务器设置指南》中的 步骤2和3进行操作。 但是,请注意,如果您使用远程服务器作为Ansible Control节点,则应遵循本指南的每个步骤 。 这样做将使用
ufw
在服务器上配置防火墙,并允许外部访问您的非root用户配置文件,这两者都将有助于确保远程服务器的安全。An SSH keypair associated with this user. To set this up, you can follow Step 1 of our guide on How to Set Up SSH Keys on Ubuntu 20.04.
与此用户关联的SSH密钥对。 要进行此设置,您可以按照我们的指南中有关