DEV Community

Winnie Fred
Winnie Fred

Posted on

How to Install Ansible on Ubuntu

Ansible is an open-source platform used for automation and various operations such as configuration management, application deployment, task automation and IT orchestration.

How does Ansible work?

Ansible uses the concepts of control and managed nodes. It connects from the control node any machine with Ansible installed to the managed nodes sending commands and instructions to them.

Key concepts

  • Modules are units of code that Ansible executes on the managed nodes.Each module is invoked by a task.
  • Task is a call to an Ansible module.
  • Plays are a series of Ansible tasks or roles mapped to group of hosts in the inventory.
  • Playbooks are series of plays that explain what to run and are written in YAML.
  • Inventory is a collection of all the hosts and groups that Ansible manages.it can be in a static file(.ini files) in simple cases or pull inventory from remote sources such as cloud providers.
  • Role is a standard directory structure for specifying tasks and variables.Playbooks can be broken up into roles for modularity and reuse.
  • Host is a remote machine managed by Ansible
  • Group several hosts grouped together that share common attribute.
  • Handlers used to perform actions on a service such as restarting or stopping a service that is actively running on the managed node's system.Handlers are triggered by tasks and their execution happens at the end of a play after all tasks are finished.

How to install Ansible
1: Setting up python 3:

sudo apt update
sudo apt -y upgrade
python -V
Enter fullscreen mode Exit fullscreen mode

2: Setting up pip3:

sudo apt install -y python3-pip
Enter fullscreen mode Exit fullscreen mode

3: There are a few more packages and development tools to install to ensure that you have a robust setup for your programming environment:

sudo apt install -y build-essential libssl-dev libffi-dev python3-dev
Enter fullscreen mode Exit fullscreen mode

4: Setting up Ansible

sudo apt -y install software-properties-common
sudo apt-add-repository ppa:ansible/ansible
sudo apt update
sudo apt install ansible
Enter fullscreen mode Exit fullscreen mode

Top comments (0)