---
- name: Install httpd and required modules
  yum: name={{ item }} state=present
  with_items:
     - httpd
     - mod_ssl

- name: Copy default config files
  copy: src={{ item }} dest=/etc/httpd/conf.d/{{ item }}
  tags: httpd
  with_items:
    - 01_default.conf
  notify: reload httpd

- name: Copy the config file
  template: src=httpd.conf_httpd24.j2 dest=/etc/httpd/conf/httpd.conf
  notify: reload httpd

- name: Create empty welcome.conf and userdir.conf
  copy: content="" dest=/etc//httpd/conf.d/{{ item }}
  with_items:
    - welcome.conf
    - userdir.conf
  notify: reload httpd

- name: Stop listening on port 443
  lineinfile: dest=/etc/httpd/conf.d/ssl.conf state=absent regexp="Listen 443*"

- name: Disable unused modules
  copy: src={{ item }} dest=/etc/httpd/conf.modules.d/{{ item }}
  with_items:
    - 00-base.conf
    - 00-dav.conf
    - 00-lua.conf
    - 00-proxy.conf
  notify: reload httpd

- name: Remove default /var/www folders
  file: path=/var/www/{{ item }} state=absent
  with_items:
    - cgi-bin
    - error
    - html
    - icons

- name: enable httpd
  service: name={{ item }} enabled=yes
  with_items:
       - httpd

---
- name: Install httpd and required modules
  yum: name={{ item }} state=present
  with_items:
     - httpd
     - mod_ssl

- name: Copy default config files
  copy: src={{ item }} dest=/etc/httpd/conf.d/{{ item }}
  tags: httpd
  with_items:
    - 01_default.conf
  notify: reload httpd

- name: Copy the config file
  template: src=httpd.conf_httpd24.j2 dest=/etc/httpd/conf/httpd.conf
  notify: reload httpd

- name: Create empty welcome.conf and userdir.conf
  copy: content="" dest=/etc//httpd/conf.d/{{ item }}
  with_items:
    - welcome.conf
    - userdir.conf
    - autoindex.conf
  notify: reload httpd

- name: Stop listening on port 443
  lineinfile: dest=/etc/httpd/conf.d/ssl.conf state=absent regexp="Listen 443*"

- name: Disable unused modules
  copy: src={{ item }} dest=/etc/httpd/conf.modules.d/{{ item }}
  with_items:
    - 00-base.conf
    - 00-dav.conf
    - 00-lua.conf
    - 00-proxy.conf
  notify: reload httpd

- name: Remove default /var/www folders
  file: path=/var/www/{{ item }} state=absent
  with_items:
    - cgi-bin
    - error
    - html
    - icons

- name: enable httpd
  service: name={{ item }} enabled=yes
  with_items:
       - httpd

Remove icons configuration for indexes
httpd: Remove icons configuration for indexes
