After completing this section, you should be able to install Ansible on a control node and describe the distinction between community Ansible and Red Hat Ansible Automation Platform.
Red Hat provides a fully supported version of Ansible through Red Hat Ansible Automation Platform. Ansible Automation Platform provides the core Ansible toolset plus additional certified and supported content, tools, and cloud services. Customers with a valid subscription can use the available repository, install the additional tools, and consume certified content from the cloud services.
This course is currently based on Red Hat Ansible Automation Platform 1.2, which includes Ansible 2.9.
Earlier versions of Red Hat Ansible Automation Platform refer to the included version of Ansible as "Red Hat Ansible Engine", and you will see this terminology used in some documentation.
The upstream development community also provides an unsupported version of Ansible. This used to be provided as RPM packages, but is transitioning to be provided only from the Python Package Index (PyPI).
Ansible is simple to install. The Ansible software only needs to be installed on the control node (or nodes) from which Ansible will be run. Hosts that are managed by Ansible do not need to have Ansible installed.
Installing the core Ansible toolset involves relatively few steps and has minimal requirements. On the other hand, installing the additional components that Red Hat Ansible Automation Platform provides, such as the automation controller (formerly called Red Hat Ansible Tower), requires a Red Hat Enterprise Linux 8.2 or later system, with a minimum of two CPUs, 4 GiB of RAM, and 20 GiB of available disk space.
Python 3 (version 3.5 or later) or Python 2 (version 2.7 or later) needs to be installed on the control node.
If you are running Red Hat Enterprise Linux 8, Ansible can automatically use the platform-python package that supports system utilities that use Python. You do not need to install the python36 or python27 package from AppStream.
[root@controlnode ~]#yum list installed platform-pythonInstalled Packages platform-python.x86_64 3.6.8-37.el @anaconda
You need a valid Red Hat Ansible Automation Platform subscription to install the core toolset on your control node. The installation process is as follows:
If you have activated Simple Content Access for your organization in the Red Hat Customer Portal, then you do not need to attach the subscription to your system. The installation process is as follows:
You do not need to run these steps in your classroom environment.
Register your system to Red Hat Subscription Manager.
[root@host ~]#subscription-manager register
Enable the Red Hat Ansible Engine repository.
[root@host ~]#subscription-manager repos \>--enable ansible-2-for-rhel-8-x86_64-rpms
Install Red Hat Ansible Engine.
[root@host ~]#yum install ansible
One of the benefits of Ansible is that managed hosts do not need to have a special agent installed. The Ansible control node connects to managed hosts using a standard network protocol to ensure that the systems are in the specified state.
Managed hosts might have some requirements depending on how the control node connects to them and what modules it will run on them.
Linux and UNIX managed hosts need to have Python 2 (version 2.6 or later) or Python 3 (version 3.5 or later) installed for most modules to work.
For Red Hat Enterprise Linux 8, you may be able to depend on the platform-python package. You can also enable and install the python36 application stream (or the python27 application stream).
[root@host ~]#yum module install python36
If SELinux is enabled on the managed hosts, ensure that the python3-libselinux package is installed before using modules that are related to any copy, file, or template functions. (Note that if the other Python components are installed, you can use Ansible modules such as yum or package to ensure that this package is also installed.)
Some package names may be different in Red Hat Enterprise Linux 7 and earlier because of the ongoing migration to Python 3.
For Red Hat Enterprise Linux 7 and earlier, install the python package, which provides Python 2. Instead of python3-libselinux, install libselinux-python instead.
Some modules might have their own additional requirements. For example, the dnf module, which can be used to install packages on current Fedora systems, requires the python3-dnf package (python-dnf in RHEL 7).
Some modules do not need Python. For example, arguments passed to the Ansible raw module are run directly through the configured remote shell instead of going through the module subsystem. This can be useful for managing devices that do not have Python available or cannot have Python installed, or for bootstrapping Python onto a system that does not have it.
However, the raw module is difficult to use in a safely idempotent way. If you can use a normal module instead, it is generally better to avoid using raw and similar command modules. This is discussed further later in the course.
Ansible includes a number of modules that are specifically designed for Microsoft Windows systems. These are listed in the Windows modules section of the Ansible module index.
Most of the modules specifically designed for Microsoft Windows managed hosts require PowerShell 3.0 or later on the managed host rather than Python. In addition, the managed hosts need to have Windows PowerShell remoting configured. Ansible also requires at least .NET Framework 4.0 or later to be installed on Windows managed hosts.
This course uses Linux-based managed hosts in its examples, and does not go into great depth on the specific differences and adjustments needed when managing Microsoft Windows-based managed hosts. More information is available on the Ansible web site at https://docs.ansible.com/ansible/2.9/user_guide/windows.html.
You can also use Ansible automation to configure managed network devices such as routers and switches. Ansible includes a large number of modules specifically designed for this purpose. This includes support for Cisco IOS, IOS XR, and NX-OS; Juniper Junos; Arista EOS; and VyOS-based networking devices, among others.
You can write Ansible Playbooks for network devices using the same basic techniques that you use when writing playbooks for servers. Because most network devices cannot run Python, Ansible runs network modules on the control node, not on the managed hosts. Special connection methods are also used to communicate with network devices, typically using either CLI over SSH, XML over SSH, or API over HTTP(S).
This course does not cover automation of network device management in any depth. For more information on this topic, see Ansible for Network Automation on the Ansible community website, or attend our alternative course Ansible for Network Automation (DO457).
Both the upstream Ansible community and Red Hat Ansible Automation Platform are going through a transition in how Ansible is packaged and distributed to users.
Ansible 2.9, Ansible in Red Hat Ansible Automation Platform 1.2, and earlier versions of both were provided as an RPM package (ansible). This package also included all Ansible modules and plug-ins.
In future versions of Red Hat Ansible Automation Platform, the code that runs automation will be moved to a new package, ansible-core, and supported modules and plug-ins will be provided using a new feature, content collections. Content collections will be discussed in more detail later in this course. In addition, Ansible Automation Platform 2 will also include enhanced tools and features to run your playbooks, new cloud services features, and enhanced versions of the automation controller (formerly known as Red Hat Ansible Tower) and automation hub.
Future versions of community-built Ansible will provide the executables and a selected set of content through the Python Package Index (PyPI), from which the pip install ansible command can install them.
However, this selected set of content might be different from what Red Hat supports and certifies in Red Hat Ansible Automation Platform.
The automation code, tools, and techniques you will learn in this course apply directly to future versions of Ansible with little or no modification.