--- # tasks file for myapache - name: install apache yum: name: httpd state: latest - name: conf httpd notify: reload httpd template: src: vhost.conf.jj dest: /etc/httpd/conf.d/vhost.conf mode: 0640 owner: root group: apache - name: activate apache service: name: httpd enabled: yes - name: open firewall port firewalld: service: http permanent: yes immediate: yes state: enabled ignore_errors: yes notify: reload firewalld - name: create documentroot file: name: "{{ item.documentroot }}" state: directory with_items: - "{{ apache_vhosts }}" - name: create index file copy: src: index.html dest: "{{ item.documentroot }}/index.html" mode: 0644 with_items: - "{{ apache_vhosts }}"