---

- name: Create area for SSL certificates
  file:
    path: "{{ nginx_common_ssl_path }}"
    state: directory
    owner: root
    group: root
    mode: '0750'

- name: Configure missing MIME types
  lineinfile:
    dest: /etc/nginx/mime.types
    insertafter: '^types '
    line: "{{ item }}"
    backup: no
  with_items:
    - "    font/ttf                              ttf;"
    - "    font/opentype                         otf;"
  notify:
    - restart nginx

- name: Remove nginx default config files
  file:
    path: "{{ item }}"
    state: absent
  with_items:
    - /etc/nginx/conf.d/default.conf
    - /etc/nginx/conf.d/example_ssl.conf
  notify:
    - restart nginx

- name: Configure nginx
  template:
    src: nginx.conf.j2
    dest: /etc/nginx/nginx.conf
    backup: no
  notify:
    - restart nginx

---

- name: Create area for SSL certificates
  file:
    path: "{{ nginx_common_ssl_path }}"
    state: directory
    owner: root
    group: root
    mode: '0750'

- name: Configure missing MIME types
  lineinfile:
    dest: /etc/nginx/mime.types
    insertafter: '^types '
    line: "{{ item }}"
    backup: no
  with_items:
    - "    font/ttf                              ttf;"
    - "    font/opentype                         otf;"
  notify:
    - restart nginx

- name: Remove nginx default config files
  file:
    path: "{{ item }}"
    state: absent
  with_items:
    - /etc/nginx/conf.d/default.conf
    - /etc/nginx/conf.d/example_ssl.conf
  notify:
    - restart nginx

- name: Configure nginx
  template:
    src: nginx.conf.j2
    dest: /etc/nginx/nginx.conf
    backup: no
  notify:
    - restart nginx

- name: Allow nginx to open network connections
  seboolean:
    name: httpd_can_network_connect
    state: yes
    persistent: yes

Add SELinux configuration so nginx can connecto to backends.
Add SELinux configuration so nginx can connecto to backends.
