Berkenalan dengan
Ansible Automation
Josuanstya Lovdianchel, 11 September 2020
Josuanstya Lovdianchel
SYSADMIN INTERN
BUDI DAN PERMASALAHAN
HIDUPNYA
It’s not magic, it’s Ansible!
-Budi
REAL CASE
Kasus yang dialami Budi
tidaklah nyata! :(
Tetapi kasus Budi membantu kita
memahami Ansible!
Kasus di dunia nyata tidak jauh
berbeda dengan kasus Budi.
ANSIBLE
Pengertian Ansible
Ansible is an open-source software provisioning,
configuration management, and application-deployment tool
enabling infrastructure as code. -Wikipedia
Pengertian Ansible
Ansible adalah tool automasi untuk:
- configuration management
- application deployment
- provisioning tool
Kelebihan Ansible
- Ansible is Simple
- Ansible is Powerful
- Ansible is Agentless
- Ansible is Cross Platform
Arsitektur Ansible
Penyusun Ansible
1. Ansible Inventory
2. Ansible Playbook
3. Ansible Roles
4. Ansible Galaxy
5. Ansible Vault
ANSIBLE ANATOMY
Ansible Inventory
inventory
Group’s name
Host
Ansible Playbook (Task)
Documentation
Module
Argument
Ansible Playbook (Play)
site.yml
Play’s name
Tasks
Host / Group
Ansible Playbook (Play)
site.yml
Play’s name
Tasks
Host / Group
Handlers
ANSIBLE CONCEPTS
YAML
Digunakan untuk mendefinisikan tasks, handlers, variables,
dan sebagainya.
Modules
- apt/yum
- copy
- file
- git
- ping
- template
- service
- shell
- command
and many more ...
Atomic operation (unit terkecil)
Tasks / Handlers
Tasks: memiliki nama (dokumentasi), menjalankan module,
ditandai dengan success / failure / skipped
Handlers: “sleeping” taks, yang dijalankan jika ada trigger dari
sebuah task yang selesai (contoh: ketika file konfigurasi
berubah, restart service)
Playbook
- Sequential list of operation.
- Kumpulan dari tasks dan handlers.
Inventory
Tempat untuk menyimpan host
Playbook VS Ad-Hoc
Using Playbook
Using Ad-Hoc Command
Ad-Hoc Example
Ansible Roles
Roles adalah sekumpulan tasks / handlers yang memiliki tujuan
tertentu (contoh: install Nginx, install MySQL)
Ansible Roles
Ansible Roles
Ansible Galaxy
https://galaxy.ansible.com
SETUP ANSIBLE
Instalasi Ansible
Ubuntu:
CentOS:
Python:
Windows: Download & Install CYGWIN
Setup SSH (1) - Controller
Setup SSH (2) - Controller
Setup SSH (3) - Host
Testing - Controller
DEMO
https://github.com/lovdianchel/ansible-demo
KESIMPULAN
Manfaat Ansible
• Menghemat waktu
• Version Control System
• Dokumentasi infrastruktur lebih jelas
Sebelum Belajar Ansible
• Memahami perintah dan konfigurasi dasar pada sistem
operasi server (kebanyakan Linux).
• Paham alur deployment aplikasi (jika ingin menggunakan
Ansible sebagai deployment tool)
Tidak Perlu Belajar Ansible Jika...
Hanya akan mendeploy 1 atau 2 server saja seumur hidup.
Karena waktu yang dibutuhkan mempelajari Ansible tidaklah
sebentar
Tips Untuk Developer
Pahami sedikit bagian saja mengenai Ansible dan gunakan
Ansible Galaxy
Sumber Lain
http://tiny.cc/ansible (artikel medium)
https://www.ansible.com/use-cases
https://docs.ansible.com/ansible/latest/modules/list_of_all_m
odules.html
https://www.whizlabs.com/blog/ansible-modules/
https://www.ansible.com/blog/ansible-best-practices-essentia
ls
TERIMA KASIH
Berkenalan dengan Ansible Automation

Berkenalan dengan Ansible Automation