Ansible or RedHat Ansible Automation?
Red Hat provides Ansible software in special channels as a convenience to Red Hat Enterprise Linux subscribers, and you can use these software packages normally. However, if you want formal support for Ansible and its modules, Red Hat offers a special subscription for this, Red Hat Ansible Automation. This subscription includes support for Ansible itself, as Red Hat Ansible Engine. This adds formal technical support with SLAs and a published scope of coverage for Ansible and its core modules. More information on the scope of this support is available at Red Hat Ansible Engine Life Cycle.
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. This installation involves relatively few steps and has minimal requirements.
The control node should be a Linux or UNIX system. Microsoft Windows is not supported as a control node, although Windows systems can be managed hosts. Python 3 (version 3.5 or later) or Python 2 (version 2.7 or later) needs to be installed on the control node.
Note: If you are running CentOS/RHEL 8, Ansible 2.8 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-python Loaded plugins: langpacks, search-disabled-repos Installed Packages platform-python.x86_64 3.6.8-2.el8_0. @anaconda
Red Hat provides the ansible-2.8-for-rhel-8-x86_64-rpms channel for Red Hat Enterprise Linux 8. You can also get the latest update of the Red Hat Ansible Engine 2 major release for RHEL 8 in the ansible-2-for-rhel-8-x86_64-rpms channel. You can use these channels to install Ansible with limited support with standard Red Hat Enterprise Linux subscriptions. If you need more comprehensive Ansible support, you can purchase full Red Hat Ansible Engine subscriptions and associate them with your systems before enabling the channels, as discussed in the Knowledgebase article.
If you have a Red Hat Ansible Engine subscription, the installation procedure for Red Hat Ansible Engine 2 is as follows:
1. Register your system to Red Hat Subscription Manager.
[root@host ~]# subscription-manager register
2. Set a role for your system.
[root@host ~]# subscription-manager role --set="Red Hat Enterprise Linux Server"
3. Attach your Red Hat Ansible Engine subscription. This command helps you find your Red Hat Ansible Engine subscription:
[root@host ~]# subscription-manager list --available
4. Use the pool ID of the subscription to attach the pool to the system.
[root@host ~]# subscription-manager attach --pool=[engine-subscription-pool]
5. Enable the Red Hat Ansible Engine repository.
[root@host ~]# subscription-manager repos --enable ansible-2-for-rhel-8-x86_64-rpms
6. Install Red Hat Ansible Engine.
[root@host ~]# yum install ansible
If you are using the version with limited support provided with your Red Hat Enterprise Linux subscription, use the following procedure:
1. Enable the Red Hat Ansible Engine repository.
[root@host ~]# subscription-manager refresh [root@host ~]# subscription-manager repos --enable ansible-2-for-rhel-8-x86_64-rpms
2. 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, you also need to make sure 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 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).
Note: 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.
Microsoft Windows-based Managed Hosts
Ansible includes a number of modules that are specifically designed for Microsoft Windows systems. These are listed in the Windows Modules [https://docs.ansible.com/ansible/latest/ modules/list_of_windows_modules.html] 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 PowerShell remoting configured. Ansible also requires at least .NET Framework 4.0 or later to be installed on Windows managed hosts.
This post series 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/latest/user_guide/windows.html.
Managed Network Devices
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).