Automate your infrastructure and deployments with Ansible playbooks.
Ansible is an open-source automation tool that allows you to configure servers, deploy applications, and manage IT environments using simple, human-readable YAML files called playbooks. Itβs agentless and connects via SSH, making it ideal for managing Linux and cloud infrastructure.
Agentless and SSH-based
Uses YAML for configuration (playbooks)
Automates provisioning, configuration, deployment, and orchestration
Supports Linux, macOS, Windows, cloud (AWS, Azure, GCP), Docker, Kubernetes
Install and configure Nginx, Docker, databases
Deploy apps (Node.js, Django, PHP, etc.)
Manage users, firewalls, cron jobs
Provision servers on AWS/GCP/Azure
Python 3
Ansible control node
SSH access to remote hosts
Sudo privileges on remote hosts
βββ inventory.ini # Inventory of remote hosts
βββ nginx.yml # Example playbook to install Nginx
βββ README.md # This file
Step 1: Generate SSH Key on Ansible node
ssh-keygen -t rsa -b 4096
Press Enter to accept defaults (save in ~/.ssh/id_rsa)
Step 2: Copy Public Key to Remote Host
ssh-copy-id MBaranekTech@192.168.1.10
ssh-copy-id MBaranekTech@192.168.1.11
Step 3: Set Correct Permissions
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Step 4: Test Passwordless SSH
ssh MBaranekTech@192.168.1.10
ssh MBaranekTech@192.168.1.11
ansible all -i inventory.ini -m ping
- name: Install and start Nginx
hosts: client
become: true
tasks:
- name: Install Nginx
apt:
name: nginx
state: present
- name: Start and enable Nginx
service:
name: nginx
state: started
enabled: true[client]
192.168.1.10 ansible_user=MBaranekTech ansible_ssh_private_key_file=~/.ssh/id_rsa
192.168.1.11 ansible_user=MBaranekTech ansible_ssh_private_key_file=~/.ssh/id_rsa
ansible-playbook -i inventory.ini nginx-playbook.yml --ask-become-pass
