Ansible Vault: Hướng dẫn bảo mật Secrets và quản lý mật khẩu trong Automation - Part 1
5:00 read
Giới Thiệu
Khi làm việc với Ansible, bạn thường xuyên phải lưu trữ thông tin nhạy cảm như:
- Database passwords
- API keys và tokens
- SSH private keys
- SSL certificates
- Cloud credentials (AWS, Azure, GCP)
Ansible Vault giúp bạn mã hóa các thông tin này một cách an toàn ngay trong Git repository.
Trong bài học này, bạn sẽ học:
- Cách encrypt/decrypt files và variables
- Quản lý vault passwords
- Best practices cho production
- Integration với CI/CD
Tại Sao Cần Ansible Vault?
❌ Vấn Đề: Plain Text Secrets
# vars/database.yml - NGUY HIỂM!
db_host: prod-mysql.example.com
db_user: admin
db_password: SuperSecret123! # ← Ai cũng thấy được
api_key: sk-1234567890abcdef # ← Lộ trên Git
Hậu quả:
- Ai có access Git repository đều thấy passwords
- Secrets bị lộ trong Git history
- Vi phạm security compliance
- Rủi ro bị tấn công
✅ Giải Pháp: Ansible Vault
# vars/database.yml - ĐÃ MÃ HÓA
$ANSIBLE_VAULT;1.1;AES256
66386439653231363937303466326534643938316334363761623566633038366235373334613934
6231373537346435643538386264613961633738356265380a666437343932383264633831326437
37373435326634323564346365633866643837653565393037313239333464613736343636343965
3736346338353264300a356531356634383735343031363937653565363261386665303666333632
6234
Chỉ người có vault password mới decrypt được!
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.
