--- - name: Configure Apache. lineinfile: dest: "{{ apache_server_root }}/ports.conf" regexp: "{{ item.regexp }}" line: "{{ item.line }}" state: present with_items: apache_ports_configuration_items notify: restart apache - name: Enable Apache mods. file: src: "{{ apache_server_root }}/mods-available/{{ item }}" dest: "{{ apache_server_root }}/mods-enabled/{{ item }}" state: link with_items: apache_mods_enabled notify: restart apache - name: Add apache vhosts configuration. template: src: "vhosts-{{ apache_vhosts_version }}.conf.j2" dest: "{{ apache_conf_path }}/sites-available/vhosts.conf" owner: root group: root mode: 0644 notify: restart apache when: apache_create_vhosts - name: Add vhost symlink in sites-enabled. file: src: "{{ apache_conf_path }}/sites-available/vhosts.conf" dest: "{{ apache_conf_path }}/sites-enabled/vhosts.conf" state: link when: apache_create_vhosts