From 3b60d556b430dad7bd0c56bdfe73c3422ebf05bf Mon Sep 17 00:00:00 2001 From: Pavel Loginov Date: Wed, 19 Jan 2022 21:47:58 +0300 Subject: [PATCH] v5.4.0.0 Changelog: https://haproxy-wi.org/changelog.py#5_4_0 --- app/scripts/ansible/roles/nginx.yml | 8 +++++ .../ansible/roles/nginx_common/tasks/main.yml | 21 ++++++++++++- .../templates/mime.types.j2 | 0 .../nginx_common/templates/nginx.conf.j2 | 31 +++++++++++++++++++ .../ansible/roles/nginx_docker/tasks/main.yml | 22 ------------- 5 files changed, 59 insertions(+), 23 deletions(-) rename app/scripts/ansible/roles/{nginx_docker => nginx_common}/templates/mime.types.j2 (100%) create mode 100644 app/scripts/ansible/roles/nginx_common/templates/nginx.conf.j2 diff --git a/app/scripts/ansible/roles/nginx.yml b/app/scripts/ansible/roles/nginx.yml index 22a78730..c62e08a2 100644 --- a/app/scripts/ansible/roles/nginx.yml +++ b/app/scripts/ansible/roles/nginx.yml @@ -45,3 +45,11 @@ https_proxy: "{{PROXY}}" tags: - system + +- name: Set correct owner + hosts: "{{ variable_host }}" + become: yes + tasks: + - name: Set + shell: "chown nginx:nginx -R {{ nginx_dir }}" + diff --git a/app/scripts/ansible/roles/nginx_common/tasks/main.yml b/app/scripts/ansible/roles/nginx_common/tasks/main.yml index 060d5886..a1c40d91 100644 --- a/app/scripts/ansible/roles/nginx_common/tasks/main.yml +++ b/app/scripts/ansible/roles/nginx_common/tasks/main.yml @@ -53,12 +53,31 @@ - name: Copy Nginx configuration in place template: src: default.conf.j2 - dest: "{{nginx_dir}}/conf.d" + dest: "{{nginx_dir}}/conf.d/default.conf" mode: 0644 force: no when: "'nginx' not in ansible_facts.packages" ignore_errors: yes +- name: Copying over nginx.conf + template: + src: nginx.conf.j2 + dest: "{{ nginx_dir }}/nginx.conf" + mode: "0666" + force: no + remote_src: true + become: true + ignore_errors: yes + +- name: Copying over mime.types + template: + src: mime.types.j2 + dest: "{{ nginx_dir }}/mime.types" + mode: "0666" + force: no + remote_src: true + become: true + ignore_errors: yes - name: Open stat port for firewalld firewalld: diff --git a/app/scripts/ansible/roles/nginx_docker/templates/mime.types.j2 b/app/scripts/ansible/roles/nginx_common/templates/mime.types.j2 similarity index 100% rename from app/scripts/ansible/roles/nginx_docker/templates/mime.types.j2 rename to app/scripts/ansible/roles/nginx_common/templates/mime.types.j2 diff --git a/app/scripts/ansible/roles/nginx_common/templates/nginx.conf.j2 b/app/scripts/ansible/roles/nginx_common/templates/nginx.conf.j2 new file mode 100644 index 00000000..2c7f6f09 --- /dev/null +++ b/app/scripts/ansible/roles/nginx_common/templates/nginx.conf.j2 @@ -0,0 +1,31 @@ +user nginx; +worker_processes 1; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + + +events { + worker_connections 1021; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; +} \ No newline at end of file diff --git a/app/scripts/ansible/roles/nginx_docker/tasks/main.yml b/app/scripts/ansible/roles/nginx_docker/tasks/main.yml index 0c2ab21e..b33d1d48 100644 --- a/app/scripts/ansible/roles/nginx_docker/tasks/main.yml +++ b/app/scripts/ansible/roles/nginx_docker/tasks/main.yml @@ -39,28 +39,6 @@ become: true ignore_errors: yes -- name: Copying over nginx.conf - template: - src: nginx.conf.j2 - dest: "{{ nginx_dir }}/nginx.conf" - mode: "0666" - owner: "{{ansible_user}}" - group: "{{ansible_user}}" - force: no - become: true - ignore_errors: yes - -- name: Copying over mime.types - template: - src: mime.types.j2 - dest: "{{ nginx_dir }}/mime.types" - mode: "0666" - owner: "{{ansible_user}}" - group: "{{ansible_user}}" - force: no - become: true - ignore_errors: yes - - name: Create Nginx docker_container: name: "{{ CONT_NAME }}"