---
- name: Install httpd
  package:
    name: '{{ httpd_package_name }}'
    state: present
  when: manage_packages|default(false)

- name: Install httpd modules
  package:
    name: '{{ item }}'
    state: present
  with_items: '{{ httpd_modules }}'
  when: manage_packages|default(false)

- name: Allow apache proxy connections
  seboolean:
    name: httpd_can_network_connect
    state: yes
    persistent: yes

- name: Ensure httpd configuration directory exists
  file:
    path: '{{ httpd_config_dir }}'
    state: directory

- name: Ensure httpd configuration parts directory exists
  file:
    path: '{{ httpd_config_parts_dir }}'
    state: directory

- name: Enable httpd service
  service:
    name: '{{ httpd_service_name }}'
    state: started
    enabled: yes

---
- name: Install httpd
  package:
    name: '{{ httpd_package_name }}'
    state: present
  when: manage_packages|default(false)

- name: Install httpd modules
  package:
    name: '{{ item }}'
    state: present
  with_items: '{{ httpd_modules }}'
  when: manage_packages|default(false)

- name: Allow apache proxy connections
  seboolean:
    name: httpd_can_network_connect
    state: yes
    persistent: yes
  when: '"{{ ansible_selinux.mode }}" in ["enforcing", "permissive"]'

- name: Ensure httpd configuration directory exists
  file:
    path: '{{ httpd_config_dir }}'
    state: directory

- name: Ensure httpd configuration parts directory exists
  file:
    path: '{{ httpd_config_parts_dir }}'
    state: directory

- name: Enable httpd service
  service:
    name: '{{ httpd_service_name }}'
    state: started
    enabled: yes

Allow installing in systems with selinux disabled
Allow installing in systems with selinux disabled

This implements a patch provided via
https://github.com/centos-opstools/opstools-ansible/pull/103
but never got here.

The initial patch was contributed by tscofield <tscofield@gmail.com>

Change-Id: Ieb3e240a8e333e230cd8c82a20c27bb426ad47a7
