First release

master
Oleg "Zmey!" Vasiliev 2023-10-05 00:31:23 +03:00
parent 9d5dd26cf6
commit ff8b8211d0
3 changed files with 56 additions and 0 deletions

23
defaults/main.yml Normal file
View File

@ -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
}
}
}

9
handlers/main.yml Normal file
View File

@ -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 }}"

24
tasks/main.yml Normal file
View File

@ -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