darexsu.nginx
Ansible Rolle Nginx
- Rolle:
- Playbooks (Merge-Version):
- Playbooks (Vollversion):
Plattformen
Testen | Repo: Distribution | 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 |
Installation
ansible-galaxy install darexsu.nginx --force
Merge-Verhalten
Ersetzen oder Mergen von Wörterbüchern (mit "hash_behaviour=replace" in ansible.cfg):
# Ersetzen # Mergen
--- ---
vars: vars:
dict: merge:
a: "wert" dict:
b: "wert" a: "wert"
b: "wert"
# Wie funktioniert Merge?
Ihre Variablen [host_vars] --> Standardvariablen [aktuelle Rolle] --> Standardvariablen [eingeschlossene Rolle]
dict: dict: dict:
a: "1" --> a: "1" --> a: "1"
b: "2" --> b: "2"
c: "3"
Installieren und Konfigurieren: Nginx (Merge-Version)
---
- hosts: all
become: true
vars:
merge:
# Nginx
nginx:
enabled: true
repo: "nginx"
# Nginx -> installieren
nginx_install:
enabled: true
# Nginx -> konfigurieren -> 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 -> konfigurieren -> {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: Rolle darexsu.nginx einbeziehen
include_role:
name: darexsu.nginx
Installieren: Nginx, Repository: Distribution (Merge-Version)
---
- hosts: all
become: true
vars:
merge:
# Nginx
nginx:
enabled: true
repo: "distribution"
# Nginx -> installieren
nginx_install:
enabled: true
tasks:
- name: Rolle darexsu.nginx einbeziehen
include_role:
name: darexsu.nginx
Installieren: Nginx, Repository: Nginx (Merge-Version)
---
- hosts: all
become: true
vars:
merge:
# Nginx
nginx:
enabled: true
repo: "nginx"
# Nginx -> installieren
nginx_install:
enabled: true
tasks:
- name: Rolle darexsu.nginx einbeziehen
include_role:
name: darexsu.nginx
Konfigurieren: nginx.conf (Merge-Version)
---
- hosts: all
become: true
vars:
merge:
# Nginx
nginx:
enabled: true
repo: "nginx"
# Nginx -> konfigurieren -> 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: Rolle darexsu.nginx einbeziehen
include_role:
name: darexsu.nginx
Konfigurieren: virtualhost.conf tcpip-Socket (Merge-Version)
---
- hosts: all
become: true
vars:
merge:
# Nginx
nginx:
enabled: true
# Nginx -> konfigurieren -> {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: Rolle darexsu.nginx einbeziehen
include_role:
name: darexsu.nginx
Konfigurieren: virtualhost.conf Unix-Socket (Merge-Version)
---
- hosts: all
become: true
vars:
merge:
# Nginx
nginx:
enabled: true
# Nginx -> konfigurieren -> {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: Rolle darexsu.nginx einbeziehen
include_role:
name: darexsu.nginx
Konfigurieren: mehrere virtualhost.conf hinzufügen (Merge-Version)
---
- hosts: all
become: true
vars:
merge:
# Nginx
nginx:
enabled: true
# Nginx -> konfigurieren -> 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 -> konfigurieren -> 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: Rolle darexsu.nginx einbeziehen
include_role:
name: darexsu.nginx
Installieren und Konfigurieren: Nginx (Vollversion)
---
- hosts: all
become: true
vars:
# Nginx
nginx:
enabled: true
repo: "nginx"
service:
enabled: true
state: "started"
# Nginx -> installieren
nginx_install:
enabled: true
# Nginx -> konfigurieren -> 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 -> konfigurieren -> {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: Rolle darexsu.nginx einbeziehen
include_role:
name: darexsu.nginx
Installieren: Nginx, Repository: Distribution (Vollversion)
---
- hosts: all
become: true
vars:
# Nginx
nginx:
enabled: true
repo: "distribution"
service:
enabled: true
state: "started"
# Nginx -> installieren
nginx_install:
enabled: true
tasks:
- name: Rolle darexsu.nginx einbeziehen
include_role:
name: darexsu.nginx
Installieren: Nginx, Repository: Nginx (Vollversion)
---
- hosts: all
become: true
vars:
# Nginx
nginx:
enabled: true
repo: "nginx"
service:
enabled: true
state: "started"
# Nginx -> installieren
nginx_install:
enabled: true
tasks:
- name: Rolle darexsu.nginx einbeziehen
include_role:
name: darexsu.nginx
Konfigurieren: nginx.conf (Vollversion)
---
- hosts: all
become: true
vars:
# Nginx
nginx:
enabled: true
repo: "nginx"
service:
enabled: true
state: "started"
# Nginx -> konfigurieren -> 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: Rolle darexsu.nginx einbeziehen
include_role:
name: darexsu.nginx
Konfigurieren: virtualhost.conf tcpip-Socket (Vollversion)
---
- hosts: all
become: true
vars:
# Nginx
nginx:
enabled: true
repo: "nginx"
service:
enabled: true
state: "started"
# Nginx -> konfigurieren -> {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: Rolle darexsu.nginx einbeziehen
include_role:
name: darexsu.nginx
Konfigurieren: virtualhost.conf Unix-Socket (Vollversion)
---
- hosts: all
become: true
vars:
# Nginx
nginx:
enabled: true
repo: "nginx"
service:
enabled: true
state: "started"
# Nginx -> konfigurieren -> {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: Rolle darexsu.nginx einbeziehen
include_role:
name: darexsu.nginx
Konfigurieren: mehrere virtualhost.conf hinzufügen (Vollversion)
---
- hosts: all
become: true
vars:
# Nginx
nginx:
enabled: true
repo: "nginx"
service:
enabled: true
state: "started"
# Nginx -> konfigurieren -> 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 -> konfigurieren -> 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: Rolle darexsu.nginx einbeziehen
include_role:
name: darexsu.nginx