Wednesday, September 25, 2024
Ansible Apache Playbook

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
  • Test ansible
ansible-playbook apache.yml
  • Cek Server Client

Penutup

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

(Visited 260 times, 1 visits today)
Baca Juga :  Install Apache dan PHP pada Alpine Linux

Similar Posts