- become: yes
  tags:
    - apache
  block:
    - name: packages
      vars:
        items:
          - apache2
      apt:
        name: "{{ items }}"
        install_recommends: no

- become: yes
  tags:
    - apache
    - apache-config
  block:
    - name: "fill /etc/apache2"
      with_items: "{{ apache__copy }}"
      when: item is defined and item
      notify: systemctl reload apache
      copy:
        dest: "/etc/apache2/{{ item }}"
        src: "{{ item }}"

    - name: "fill /etc/apache2"
      with_items: "{{ apache__template }}"
      when: item is defined and item
      notify: systemctl reload apache
      template:
        dest: "/etc/apache2/{{ item|replace(apache__template_prefix, '') }}"
        src: "{{ item }}"