---
# RHEL Specific tasks

- name: Set the Nginx User Acount to "nginx"
  set_fact:
    nginx_user: "nginx"

- name: Install nginx
  yum: name=nginx state=present

- name: Configure NGinx Core
  template: src=etc_nginx_nginx.conf dest=/etc/nginx/nginx.conf owner=root group=root mode=0644
  notify: restart nginx

- name: Copy the default nginx config so we can have monitoring
  copy: src=default.conf dest=/etc/nginx/conf.d/default.conf owner=root group=root mode=0644
  notify: restart nginx

- name: Create the sites-available and sites-enabled folders
  file:
    name: "/etc/nginx/{{ item }}"
    owner: nginx
    group: nginx
    mode: 755
    state: directory
  with_items:
      - "sites-enabled"
      - "sites-available"

---
# RHEL Specific tasks

- name: Set the Nginx User Acount to "nginx"
  set_fact:
    nginx_user: "nginx"

- name: Install nginx
  yum: name=nginx state=present

- name: Configure NGinx Core
  template: src=etc_nginx_nginx.conf dest=/etc/nginx/nginx.conf owner=root group=root mode=0644
  notify: restart nginx

- name: Copy the default nginx config so we can have monitoring
  copy: src=default.conf dest=/etc/nginx/conf.d/default.conf owner=root group=root mode=0644
  notify: restart nginx

# Set (httpd_can_network_connect) flag on and keep it persistent across reboots
- seboolean:
    name: httpd_can_network_connect
    state: yes
    persistent: yes

- name: Create the sites-available and sites-enabled folders
  file:
    name: "/etc/nginx/{{ item }}"
    owner: nginx
    group: nginx
    mode: 755
    state: directory
  with_items:
      - "sites-enabled"
      - "sites-available"

Use SELinux to enable HTTP services to talk to the outside world
Use SELinux to enable HTTP services to talk to the outside world
