Running your first Ansible playbook
Ansible is an orchestration tool organized as playbooks. Each playbook can have multiple roles. We’ll start with installing Ansible, to run our first playbook for installing NGINX.
Ansible orchestrates tasks through playbooks composed of multiple roles. Our initial step is installing Ansible to execute our first role: installing Nginx.
Let’s begin with the installation of Ansible. Ansible can be set up on either a remote server or your local Linux system, as long as there is connectivity to your NGINX server:
- We’ll be using the root account every step of the way:
root@ansible:~# apt install ansible
- Ensure Ansible is installed by checking its version:
root@ansible:~# ansible –-version ansible 2.10.8
- Now it’s time to create your first Ansible role to install NGINX. Ansible roles have a standard directory structure. Use the
ansible-galaxy
command to create it:root@ansible:~# ansible-galaxy init nginx_install...