Ansible is an open source configuration management and automation tool. It enables system administrators to control and manage an entire IT infrastructure from a single platform. It is used to automate software deployments, configuration management, and cloud provisioning. Ansible can be installed on Debian 11.6 (Bullseye) server to automate IT infrastructure tasks.
Here at Ibmi Media, you will learn how to install Ansible on Debian 11.6 (Bullseye) server.
Before you begin, you need to have the following:
1. Before installing Ansible, you need to update the local package index. You can do this by running the following command:
$ sudo apt-get update
2. Now, you can install Ansible with the following command:
$ sudo apt-get install ansible -y
3. Once the installation is complete, you can verify the version of Ansible by running the following command:
$ ansible --version
Ansible uses an inventory file to manage the list of hosts and their corresponding IP addresses. This file is located at /etc/ansible/hosts.
1. Create a new file with the following command:
$ sudo nano /etc/ansible/hosts
2. Add the list of hosts to the file, as shown below. Replace ip-address with the IP address of the server.
[servers]
ip-address
3. Save and close the file.
Now, you can test the connection to the server by running the following command:
$ ansible all -m ping
The command should produce the following output:
ip-address | SUCCESS => {
"changed": false,
"ping": "pong"
}
You can run ad-hoc commands on remote hosts with the Ansible command. For example, to list the files in the current directory, you can run the following command:
$ ansible all -m command -a "ls"
If you need to uninstall Ansible from your system, you can do so with the following command:
$ sudo apt remove --purge ansible
This article covers how to install Ansible on a Debian 11.6 (Bullseye) server and how to run ad-hoc commands. Ansible is a powerful automation tool that can be used to manage IT infrastructure tasks. I hope you have found this tutorial useful.