Site logo

Cài đặt và Thiết lập Ansible: Hướng dẫn chi tiết từ Linux, macOS đến Windows

5:00 read

Ansible là công cụ tự động hóa hạ tầng mạnh mẽ, giúp bạn cấu hình hệ thống, triển khai ứng dụng, và quản lý server ở quy mô lớn chỉ bằng Playbooks.

Bài viết này hướng dẫn bạn: ✔ Cài Ansible trên Linux / macOS / Windows (WSL) ✔ Cấu trúc thư mục dự án ✔ Kiểm tra kết nối với server qua SSH ✔ Chạy lệnh đầu tiên với Ansible

1️⃣ Yêu cầu trước khi cài đặt

Bạn cần có:

Thành phần Yêu cầu
Python >= 3.8 (thường có sẵn trên Linux/macOS)
Máy điều khiển (Control Node) Linux/macOS/Windows WSL
Máy được quản lý (Managed Nodes) Linux/Unix, kết nối SSH

📌 Lưu ý: Ansible không cần cài agent trên từng server. Chỉ cần SSH và Python là đủ.


Cài đặt Ansible

Ubuntu / Debian

sudo apt update
sudo apt install ansible -y

CentOS / RHEL / Amazon Linux

sudo dnf install epel-release -y
sudo dnf install ansible -y

macOS (Homebrew)

brew install ansible

Windows (khuyên dùng WSL Ubuntu)

Bật WSL, sau đó cài như Ubuntu:

wsl --install
sudo apt update
sudo apt install ansible -y

Yêu cầu đăng nhập

Vui lòng đăng nhập để truy cập nội dung này

Additional Resources

Course Guide

Comprehensive PDF guide with examples

GitHub Repository

Example code for all lessons

Discussion

Have a question about this lesson? Post it here and get answers from instructors and peers.