This guideline is a simple note to studying Ansible with some study case include. And maybe once time can have update for new case in future from author.
Ansible is a tools automation that can help you easy to setup installation. Example when you after installing a server you must be installing service like web server, database, etc. Can you imagine if you must install manualy, maybe can take many time.
With ansible you can make one configuration that can used repeatly for any server so you can only running that script.
Ansible have 2 main component that can you often found, like :
Inventory is file that have information server/host can use to target installasion, the information in file like ip address, username, port, password, etc. Example :
all:
hosts: # Mendefinisikan bahwa ini host
server1: # Nama dari host
ansible_connection: ssh # protocol yang digunakan
ansible_host: "192.168.56.11" # Alamat Host
ansible_user: vagrant # Username Host
Playbook is file that have information for automation script then can we run, in playbook we can mention which host will run this script and what task can be execute. Example
- name: Playbook 1 # Mendefinisikan Task playbook
hosts: server1 # Host yang akan dieksekusi sesuai inventory
tasks: # Memulai Task
- name: membuat file test # Nama task yang akan dijalankan
command: touch /tmp/test.txt # Eksekusi task (kasus ini adalah command)
For running Ansible we can use that command in main directory where we save the file inventory and playbook created.
ansible-playbook -i inventory.yml playbook.yml
In this guideline i'm implement some case with VM using vagrant, i'm included Vagrant file too in directory vagrant setup. It just optional, if you using on pemises or cloud server may you can't need this vagrant.
If you interest, you can learn how vagrant work in this link Belajar Vagrant
This is roadmap that can you follow to learn about ansible :
- Menjalankan Ansible di Local
- Ansible Conditional
- Ansible Loop
- Ansible Variable
- Notify & Handler
- Install Nginx di VM
- Deploy Docker di VM
- Vault
- Deploy with ssh password
- Server Full Seup
- Install kubernetes
- Fetch File
Thanks all of you to be my reference write this simple guideline :