From ff8b8211d0d09d4c700ae20f8ae8f2fa4c927f8a Mon Sep 17 00:00:00 2001 From: "Oleg \"Zmey!\" Vasiliev" Date: Thu, 5 Oct 2023 00:31:23 +0300 Subject: [PATCH] First release --- defaults/main.yml | 23 +++++++++++++++++++++++ handlers/main.yml | 9 +++++++++ tasks/main.yml | 24 ++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 defaults/main.yml create mode 100644 handlers/main.yml create mode 100644 tasks/main.yml diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..49be669 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,23 @@ +--- + + +nginx_unit_version: 1.31.0-1 + +nginx_unit_packages: + - nginx-unitd + - nginx-unit-php-legacy + +nginx_unit_control_socket: /run/nginx-unit.control.sock +nginx_unit_config_path: /var/lib/nginx-unit/conf.json + +nginx_unit_config: { + "settings": { + "http": { + "header_read_timeout": 10, + "body_read_timeout": 10, + "send_timeout": 15, + "idle_timeout": 120, + "log_route": true + } + } +} diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..a243901 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,9 @@ +--- + +- name: Nginx Unit | Load configuration + uri: + unix_socket: "{{ nginx_unit_control_socket }}" + url: http://localhost/config/ + method: PUT + body_format: json + src: "{{ nginx_unit_config_path }}" diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..ab2d756 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,24 @@ +--- + +- name: Nginx Unit | Install packages + package: + name: "{{ nginx_unit_packages | product([nginx_unit_version]) | map('join', '=') | list }}" + state: present + +- name: Nginx Unit | Deploy config + copy: + dest: "{{ nginx_unit_config_path }}" + content: "{{ nginx_unit_config | to_nice_json }}" + mode: "600" + owner: root + group: root + notify: Nginx Unit | Load configuration + +- name: Nginx Unit | Enable and start + service: + name: unit + state: started + enables: yes + +- name: Nginx Unit | Run handlers + meta: flush_handlers