darexsu.nginx
Rola Ansible Nginx
- Rola:
- Playbooki (wersja scalania):
- Playbooki (pełna wersja):
Platformy
Testowanie | repo: dystrybucja | repo: nginx |
---|---|---|
Debian 11 | Nginx 1.18 | nginx.org |
Debian 10 | Nginx 1.14 | nginx.org |
Ubuntu 20.04 | Nginx 1.18-1.20 | nginx.org |
Ubuntu 18.04 | Nginx 1.18-1.20 | nginx.org |
Oracle Linux 8 | Nginx 1.14-1.20 | nginx.org |
Rocky Linux 8 | Nginx 1.14-1.20 | nginx.org |
Instalacja
ansible-galaxy install darexsu.nginx --force
Zachowanie scalania
Zastąp lub scal słowniki (z "hash_behaviour=replace" w ansible.cfg):
# Zastąp # Scal
--- ---
vars: vars:
dict: merge:
a: "value" dict:
b: "value" a: "value"
b: "value"
# Jak działa scalanie?
Twoje zmienne [host_vars] --> domyślne zmienne [aktualna rola] --> domyślne zmienne [dołączona rola]
dict: dict: dict:
a: "1" --> a: "1" --> a: "1"
b: "2" --> b: "2"
c: "3"
Instalacja i konfiguracja: Nginx (wersja scalania)
---
- hosts: all
become: true
vars:
merge:
# Nginx
nginx:
enabled: true
repo: "nginx"
# Nginx -> instalacja
nginx_install:
enabled: true
# Nginx -> konfiguracja -> nginx.conf
nginx_conf:
enabled: true
data:
user: "www-data"
worker_processes: "auto"
error_log: "/var/log/nginx/error.log notice"
pidfile: "/var/run/nginx.pid"
worker_connections: "1024"
# ...
# Nginx -> konfiguracja -> {virtualhost}.conf
nginx_virtualhost:
default_conf:
enabled: true
file: "default.conf"
state: "present"
src: "nginx_virtualhost.j2"
backup: false
data:
listen_port: "80"
listen_ipv6: false
server_name: "localhost"
root: "/usr/share/nginx/html"
index: "index.html index.htm index.php"
error_page: ""
access_log: false
error_log: false
tcp_ip_socket:
enabled: false
listen: "127.0.0.1:9000"
unix_socket:
enabled: true
file: "php-fpm.sock"
tasks:
- name: dołącz rolę darexsu.nginx
include_role:
name: darexsu.nginx
Instalacja: Nginx, repozytorium: dystrybucja (wersja scalania)
---
- hosts: all
become: true
vars:
merge:
# Nginx
nginx:
enabled: true
repo: "distribution"
# Nginx -> instalacja
nginx_install:
enabled: true
tasks:
- name: dołącz rolę darexsu.nginx
include_role:
name: darexsu.nginx
Instalacja: Nginx, repozytorium: nginx (wersja scalania)
---
- hosts: all
become: true
vars:
merge:
# Nginx
nginx:
enabled: true
repo: "nginx"
# Nginx -> instalacja
nginx_install:
enabled: true
tasks:
- name: dołącz rolę darexsu.nginx
include_role:
name: darexsu.nginx
Konfiguracja: nginx.conf (wersja scalania)
---
- hosts: all
become: true
vars:
merge:
# Nginx
nginx:
enabled: true
repo: "nginx"
# Nginx -> konfiguracja -> nginx.conf
nginx_conf:
enabled: true
file: "nginx.conf"
src: "nginx_conf.j2"
backup: false
data:
user: "www-data"
worker_processes: "auto"
error_log: "/var/log/nginx/error.log notice"
pidfile: "/var/run/nginx.pid"
worker_connections: "1024"
multi_accept: "off"
mime_file_path: "/etc/nginx/mime.types"
access_log: "/var/log/nginx/access.log"
sendfile: "off"
tcp_nopush: "off"
tcp_nodelay: "on"
keepalive_timeout: "75s"
keepalive_requests: "1000"
tasks:
- name: dołącz rolę darexsu.nginx
include_role:
name: darexsu.nginx
Konfiguracja: virtualhost.conf socket tcpip (wersja scalania)
---
- hosts: all
become: true
vars:
merge:
# Nginx
nginx:
enabled: true
# Nginx -> konfiguracja -> {virtualhost}.conf
nginx_virtualhost:
default_conf:
enabled: true
file: "default.conf"
state: "present"
src: "nginx_virtualhost.j2"
backup: false
data:
listen_port: "80"
listen_ipv6: false
server_name: "localhost"
root: "/usr/share/nginx/html"
index: "index.html index.htm index.php"
error_page: ""
access_log: false
error_log: false
tcp_ip_socket:
enabled: true
listen: "127.0.0.1:9000"
unix_socket:
enabled: false
file: "php-fpm.sock"
tasks:
- name: dołącz rolę darexsu.nginx
include_role:
name: darexsu.nginx
Konfiguracja: virtualhost.conf socket unix (wersja scalania)
---
- hosts: all
become: true
vars:
merge:
# Nginx
nginx:
enabled: true
# Nginx -> konfiguracja -> {virtualhost}.conf
nginx_virtualhost:
default_conf:
enabled: true
file: "default.conf"
state: "present"
src: "nginx_virtualhost.j2"
backup: false
data:
listen_port: "80"
listen_ipv6: false
server_name: "localhost"
root: "/usr/share/nginx/html"
index: "index.html index.htm index.php"
error_page: ""
access_log: false
error_log: false
tcp_ip_socket:
enabled: true
listen: "127.0.0.1:9000"
unix_socket:
enabled: false
file: "php-fpm.sock"
tasks:
- name: dołącz rolę darexsu.nginx
include_role:
name: darexsu.nginx
Konfiguracja: dodaj wiele virtualhost.conf (wersja scalania)
---
- hosts: all
become: true
vars:
merge:
# Nginx
nginx:
enabled: true
# Nginx -> konfiguracja -> default.conf
nginx_virtualhost:
default_conf:
enabled: true
file: "default.conf"
state: "present"
src: "nginx_virtualhost.j2"
backup: false
data:
listen_port: "80"
listen_ipv6: false
server_name: "localhost"
root: "/usr/share/nginx/html"
index: "index.html index.htm index.php"
error_page: ""
access_log: false
error_log: false
tcp_ip_socket:
enabled: true
listen: "127.0.0.1:9000"
unix_socket:
enabled: false
file: "php-fpm.sock"
# Nginx -> konfiguracja -> new.conf
new_conf:
enabled: true
file: "new.conf"
state: "present"
src: "nginx_virtualhost.j2"
backup: false
data:
listen_port: "80"
listen_ipv6: false
server_name: "localhost"
root: "/usr/share/nginx/html"
index: "index.html index.htm index.php"
error_page: ""
access_log: false
error_log: false
tcp_ip_socket:
enabled: true
listen: "127.0.0.1:9001"
unix_socket:
enabled: false
file: "php-fpm.sock"
tasks:
- name: dołącz rolę darexsu.nginx
include_role:
name: darexsu.nginx
Instalacja i konfiguracja: Nginx (pełna wersja)
---
- hosts: all
become: true
vars:
# Nginx
nginx:
enabled: true
repo: "nginx"
service:
enabled: true
state: "started"
# Nginx -> instalacja
nginx_install:
enabled: true
# Nginx -> konfiguracja -> nginx.conf
nginx_conf:
enabled: true
file: "nginx.conf"
src: "nginx_conf.j2"
backup: false
data:
user: "www-data"
worker_processes: "auto"
error_log: "/var/log/nginx/error.log notice"
pidfile: "/var/run/nginx.pid"
worker_connections: "1024"
multi_accept: "off"
mime_file_path: "/etc/nginx/mime.types"
access_log: "/var/log/nginx/access.log"
sendfile: "off"
tcp_nopush: "off"
tcp_nodelay: "on"
keepalive_timeout: "75s"
keepalive_requests: "1000"
# Nginx -> konfiguracja -> {virtualhost}.conf
nginx_virtualhost:
default_conf:
enabled: true
file: "default.conf"
state: "present"
src: "nginx_virtualhost.j2"
backup: false
data:
listen_port: "80"
listen_ipv6: false
server_name: "localhost"
root: "/usr/share/nginx/html"
index: "index.html index.htm index.php"
error_page: ""
access_log: false
error_log: false
tcp_ip_socket:
enabled: false
listen: "127.0.0.1:9000"
unix_socket:
enabled: true
file: "php-fpm.sock"
tasks:
- name: dołącz rolę darexsu.nginx
include_role:
name: darexsu.nginx
Instalacja: Nginx, repozytorium: dystrybucja (pełna wersja)
---
- hosts: all
become: true
vars:
# Nginx
nginx:
enabled: true
repo: "distribution"
service:
enabled: true
state: "started"
# Nginx -> instalacja
nginx_install:
enabled: true
tasks:
- name: dołącz rolę darexsu.nginx
include_role:
name: darexsu.nginx
Instalacja: Nginx, repozytorium: nginx (pełna wersja)
---
- hosts: all
become: true
vars:
# Nginx
nginx:
enabled: true
repo: "nginx"
service:
enabled: true
state: "started"
# Nginx -> instalacja
nginx_install:
enabled: true
tasks:
- name: dołącz rolę darexsu.nginx
include_role:
name: darexsu.nginx
Konfiguracja: nginx.conf (pełna wersja)
---
- hosts: all
become: true
vars:
# Nginx
nginx:
enabled: true
repo: "nginx"
service:
enabled: true
state: "started"
# Nginx -> konfiguracja -> nginx.conf
nginx_conf:
enabled: true
file: "nginx.conf"
src: "nginx_conf.j2"
backup: false
data:
user: "www-data"
worker_processes: "auto"
error_log: "/var/log/nginx/error.log notice"
pidfile: "/var/run/nginx.pid"
worker_connections: "1024"
multi_accept: "off"
mime_file_path: "/etc/nginx/mime.types"
access_log: "/var/log/nginx/access.log"
sendfile: "off"
tcp_nopush: "off"
tcp_nodelay: "on"
keepalive_timeout: "75s"
keepalive_requests: "1000"
tasks:
- name: dołącz rolę darexsu.nginx
include_role:
name: darexsu.nginx
Konfiguracja: virtualhost.conf socket tcpip (pełna wersja)
---
- hosts: all
become: true
vars:
# Nginx
nginx:
enabled: true
repo: "nginx"
service:
enabled: true
state: "started"
# Nginx -> konfiguracja -> {virtualhost}.conf
nginx_virtualhost:
default_conf:
enabled: true
file: "default.conf"
state: "present"
src: "nginx_virtualhost.j2"
backup: false
data:
listen_port: "80"
listen_ipv6: false
server_name: "localhost"
root: "/usr/share/nginx/html"
index: "index.html index.htm index.php"
error_page: ""
access_log: false
error_log: false
tcp_ip_socket:
enabled: true
listen: "127.0.0.1:9000"
unix_socket:
enabled: false
file: "php-fpm.sock"
tasks:
- name: dołącz rolę darexsu.nginx
include_role:
name: darexsu.nginx
Konfiguracja: virtualhost.conf socket unix (pełna wersja)
---
- hosts: all
become: true
vars:
# Nginx
nginx:
enabled: true
repo: "nginx"
service:
enabled: true
state: "started"
# Nginx -> konfiguracja -> {virtualhost}.conf
nginx_virtualhost:
default_conf:
enabled: true
file: "default.conf"
state: "present"
src: "nginx_virtualhost.j2"
backup: false
data:
listen_port: "80"
listen_ipv6: false
server_name: "localhost"
root: "/usr/share/nginx/html"
index: "index.html index.htm index.php"
error_page: ""
access_log: false
error_log: false
tcp_ip_socket:
enabled: true
listen: "127.0.0.1:9000"
unix_socket:
enabled: false
file: "php-fpm.sock"
tasks:
- name: dołącz rolę darexsu.nginx
include_role:
name: darexsu.nginx
Konfiguracja: dodaj wiele virtualhost.conf (pełna wersja)
---
- hosts: all
become: true
vars:
# Nginx
nginx:
enabled: true
repo: "nginx"
service:
enabled: true
state: "started"
# Nginx -> konfiguracja -> default.conf
nginx_virtualhost:
default_conf:
enabled: true
file: "default.conf"
state: "present"
src: "nginx_virtualhost.j2"
backup: false
data:
listen_port: "80"
listen_ipv6: false
server_name: "localhost"
root: "/usr/share/nginx/html"
index: "index.html index.htm index.php"
error_page: ""
access_log: false
error_log: false
tcp_ip_socket:
enabled: true
listen: "127.0.0.1:9000"
unix_socket:
enabled: false
file: "php-fpm.sock"
# Nginx -> konfiguracja -> new.conf
new_conf:
enabled: true
file: "new.conf"
state: "present"
src: "nginx_virtualhost.j2"
backup: false
data:
listen_port: "80"
listen_ipv6: false
server_name: "localhost"
root: "/usr/share/nginx/html"
index: "index.html index.htm index.php"
error_page: ""
access_log: false
error_log: false
tcp_ip_socket:
enabled: true
listen: "127.0.0.1:9001"
unix_socket:
enabled: false
file: "php-fpm.sock"
tasks:
- name: dołącz rolę darexsu.nginx
include_role:
name: darexsu.nginx
Zainstaluj
ansible-galaxy install darexsu.nginx
Licencja
mit
Pobrania
2.4k
Właściciel