# SETUP PREREQUIREMENTS

selanjutnya kita akan setup prerequirement menggunakan ansible beberapa yang akan di setup diantaranya:

* apt update & apt dist upgrade&#x20;
* set timezone to Asia/Jakarta&#x20;
* set /etc/hosts file&#x20;
* set hostname to mail.vaniiw\.my.id

1. buat file ansible.cfg untuk konfigurasi environment ansible di direktori

```bash
nano ansible.cfg

[defaults]
inventory=./inventory
```

2. buat file untuk konfigurasi inventory

yang dibawah ini merupakan hostname sebelum diubah

```bash
nano inventory

[zimbra]
zomar


[elastic]
sub1
```

3. buat file playbook untuk setup prerequirements&#x20;

```bash
nano setup.yaml

- name: Setup environment with ansible
  hosts: zimbra
  become: true

  tasks:
    - name: update package
      apt:
        update_cache: yes

    - name: set timezone
      timezone:
        name: Asia/Jakarta

    - name: set /etc/hosts file
      template: src=hosts.j2 dest=/etc/hosts

    - name: set hostname
      hostname:
        name: mail.vaniiw.my.id

    - name: download zimbra
      get_url:
        url: https://files.zimbra.com/downloads/10.1.0_GA/zcs-NETWORK-10.1.0_GA_4633.UBUNTU20_64.20240610085557.tgz
        dest: /home/robi

- name: set hostname
  hosts: elastic
  become: true

  tasks:
    - name: set hostname
      hostname:
        name: elastic.vaniiw.my.id
```
