--- # tasks file for myapache # - name: include distribution specific variables include_vars: "{{ ansible_os_family|lower }}.yml" - name: install apache almost anywhere tags: httpd package: name: "{{ apache_package_name}}" state: latest - name: conf httpd tags: httpd notify: reload httpd template: src: vhost.conf.jj dest: "{{ apache_conf_dir}}/vhost.conf" mode: 0640 owner: root group: "{{ apache_group_name }}" - name: activate apache tags: httpd service: name: "{{ apache_service_name }}" enabled: yes - name: open firewall port tags: httpd firewalld: service: http permanent: yes immediate: yes state: enabled ignore_errors: yes notify: reload firewalld when: ansible_os_family=="RedHat" - name: create documentroot tags: httpd file: name: "{{ item.documentroot }}" state: directory loop: "{{ apache_vhosts }}" - name: create documentroot/Private tags: httpd file: name: "{{ item.documentroot }}/Private" state: directory loop: "{{ apache_vhosts }}" - name: create index file tags: httpd copy: src: index.html dest: "{{ item.documentroot }}/index.html" mode: 0644 loop: "{{ apache_vhosts }}"