---
- name: Install and configure web server
  hosts: webservers
  become: yes
  tasks:
    - name: Install Apache
      apt:
        name: apache2
        state: present
        update_cache: yes

    - name: Start Apache service
      service:
        name: apache2
        state: started
        enabled: yes

    - name: Deploy website
      copy:
        src: /local/path/index.html
        dest: /var/www/html/index.html
        mode: '0644'

    - name: Configure firewall
      ufw:
        rule: allow
        port: '80'
        proto: tcp
