In this tutorial, we will show you how to install Ansible on Fedora 38. For those of you who didn’t know, Ansible is a powerful automation platform that allows you to automate tasks across multiple systems with ease. It uses a simple and human-readable language called YAML (Yet Another Markup Language) to describe the desired state of a system. Ansible follows a declarative approach, where you define the desired outcome, and Ansible takes care of executing the necessary steps to achieve that state.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Ansible to automate various tasks on a Fedora 38.
Features of Ansible
- Agentless Architecture: Ansible does not require any agents to be installed on target systems, making it lightweight and easy to manage.
- YAML Syntax: Ansible uses YAML syntax for defining playbooks, making them easy to read, write, and understand.
- Idempotent Operations: Ansible performs idempotent operations, meaning the same tasks can be safely executed multiple times without unintended side effects.
- Wide Range of Modules: Ansible offers a vast collection of modules that enable you to manage various aspects of systems, including configuration, package installation, file management, and more.
- Scalability: Ansible can manage a large number of systems simultaneously, making it suitable for both small-scale and enterprise-level automation.
- A server running one of the following operating systems: Fedora 38.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Ansible.
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install Ansible on Fedora 38
Step 1. Before we can install Ansible on Fedora 38, it’s important to ensure that our system is up-to-date with the latest packages. This will ensure that we have access to the latest features and bug fixes and that we can install Ansible without any issues:
sudo dnf upgrade --refresh
Step 2. Installing Required Dependencies.
Ansible requires a few dependencies to be installed on your system. Execute the following command in the terminal to install them:
sudo dnf install python3 python3-pip
For additional resources on installing Python, read the post below:
Step 3. Installing Ansible on Fedora 38.
By default, Ansible is available on Fedora 38 base repository. Installing Ansible on Fedora 38 is straightforward using the DNF package manager. Execute the following command in the terminal:
sudo dnf install ansible
To verify that Ansible is installed correctly, run the following command:
Step 4. Configuring Ansible.
- Creating an Inventory File.
Ansible uses an inventory file to specify the target systems it will manage. Create an inventory file using a text editor of your choice:
In the inventory file, you can specify the IP addresses or hostnames of the systems you want to manage.
- Setting up SSH Authentication.
Ansible uses SSH to communicate with target systems. Ensure that SSH authentication is properly set up between the Ansible control node and the target systems. You can either use password-based authentication or set up SSH key-based authentication for seamless communication.
- Creating a Basic Ansible Playbook.
An Ansible playbook is a YAML file that defines a set of tasks to be executed on target systems. Create a basic playbook using a text editor:
In the playbook file, you can define tasks, specify hosts from the inventory file, and configure desired system states.
Step 5. Running Ansible Commands and Playbooks.
- Executing Ad-Hoc Commands.
Ansible allows you to run ad-hoc commands directly from the command line. For example, to execute a simple command on all hosts in the inventory file, use the following command:
ansible all -m command -a "echo 'Hello, World!'"
- Running Playbooks.
To run a playbook, use the following command:
Congratulations! You have successfully installed Ansible. Thanks for using this tutorial for installing Ansible to automate various tasks on your Fedora 38 system. For additional help or useful information, we recommend you check the official Ansible website.