Site icon Learning & Doing

Belajar Playbook ansible – Config Apache

apache

“Belajar Playbook ansible – Config Apache”

Pengantar

Ansible Playbooks adalah tempat di mana kode Ansible ditulis, sejenis automation tasks yang dapat menjalankan perintah dengan sedikit atau hampir tidak perlu melibatkan campur tangan manusia.

Playbook ansible – Config Apache

nano apache.yml

---
- name: Config Apache Web server
  hosts: vmx

  tasks:
  - name: Install apache web server
    yum:
      name: httpd
      state: latest

  - name: Start apache web server
    service:
      name: httpd
      state: started
      enabled: yes

Atau jika ada Firewall

nano apache.yml

---
- name: This sets up an httpd webserver
  hosts: vmx
  tasks:
  - name: Install apache packages 
    yum:
      name: httpd
      state: present
  - name: ensure httpd is running
    service:
      name: httpd 
      state: started
  - name: Open port 80 for http access
    firewalld:
      service: http
      permanent: true
      state: enabled
  - name: Restart the firewalld service to load in the firewall changes
    service: 
      name: firewalld 
      state: restarted
ansible-playbook apache.yml

Penutup

Sahabat Blog Learning & Doing demikianlah penjelasan mengenai Belajar Playbook ansible – Config Apache . Semoga Bermanfaat . Sampai ketemu lagi di postingan berikut nya.

Exit mobile version