---
- name: install apache2 packages
  yum: pkg={{ item }} state=installed
  with_items:
   - httpd
   - httpd-devel
  sudo: true

- name: change port on Apache2 config
  lineinfile: dest=/etc/httpd/conf/httpd.conf regexp="^Listen " insertafter="^Listen " line="Listen {{ http_port }}"
  sudo: true
  notify:
    - restart httpd

- name: set up vhosts include directory
  command: mkdir -p /etc/httpd/vhosts creates=/etc/httpd/vhosts
  sudo: true

- name: add vhosts include file
  template: src=redhat_apache_vhosts_conf.j2 dest=/etc/httpd/conf.d/vhosts.conf
  sudo: true

- name: add vhosts file
  template: src=apache_vhost.j2 dest=/etc/httpd/vhosts/{{ webserver_hostname }}.conf
  sudo: true
  notify:
    - restart httpd


---
- name: install apache2 packages
  yum: pkg={{ item }} state=installed
  with_items:
   - httpd
   - httpd-devel
  sudo: true

- name: change port on Apache2 config
  lineinfile: dest=/etc/httpd/conf/httpd.conf regexp="^Listen " insertafter="^Listen " line="Listen {{ http_port }}"
  sudo: true
  notify:
    - restart httpd

- name: set up vhosts include directory
  command: mkdir -p /etc/httpd/vhosts creates=/etc/httpd/vhosts
  sudo: true

- name: add vhosts include file
  template: src=redhat_apache_vhosts_conf.j2 dest=/etc/httpd/conf.d/vhosts.conf
  sudo: true

- name: add vhosts file
  template: src=apache_vhost.j2 dest=/etc/httpd/vhosts/{{ webserver_hostname }}.conf
  sudo: true
  notify:
    - restart httpd

# Make sure httpd is ON and configured to start on boot
- service: name=httpd state=started enabled=yes

Make sure httpd is ON and configured to start on boot
Make sure httpd is ON and configured to start on boot
