Compare commits
2 Commits
29c2b9b4df
...
8938feba0c
Author | SHA1 | Date | |
---|---|---|---|
8938feba0c | |||
30247b26c3 |
@ -9,15 +9,14 @@ import argparse
|
|||||||
|
|
||||||
from urlparse import urljoin
|
from urlparse import urljoin
|
||||||
|
|
||||||
PATTERN = re.compile(r"(\S+) (joined|left) the game")
|
|
||||||
|
|
||||||
PATTERNS = (
|
PATTERNS = (
|
||||||
(re.compile(r": (\S+)\[.+logged in"), "{0} joined the game"),
|
#(re.compile(r": (\S+)\[.+logged in"), "{0} joined the game"),
|
||||||
(re.compile(r"(\S+) (joined|left) the game"), "{0} {1} the game"),
|
(re.compile(r"(\S+) (joined|left) the game"), "{0} {1} the game"),
|
||||||
(re.compile(r"\[(\S+): Gave (\d+) \[(.+)\] to (\S+)\]"), "{0} gave {1} \"{2}\" to {3}"),
|
(re.compile(r"\[(\S+): Gave (\d+) \[(.+)\] to (\S+)\]"), ":police_officer: {0} gave {1} \"{2}\" to {3}"),
|
||||||
(re.compile(r"(\S+) was (\S+) by (\S+)"), ":skull: {0} was {1} by {2}"),
|
(re.compile(r"(\S+) was (\S+) by (\S+)"), ":skull: {0} was {1} by {2}"),
|
||||||
(re.compile(r"(\S+) tried to swim in lava"), ":skull: {0} tried to swim in lava"),
|
(re.compile(r"(\S+) tried to swim in lava"), ":skull: {0} tried to swim in lava"),
|
||||||
(re.compile(r"(\S+) fell from a high place"), ":skull: {0} fell from a high place"),
|
(re.compile(r"(\S+) fell from a high place"), ":skull: {0} fell from a high place"),
|
||||||
|
(re.compile(r"\[(\S+): Set own game mode to (.+) Mode\]"), ":police_officer: {0} set game mode to '{1}' mode"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ nginx_service_enabled: yes
|
|||||||
nginx_etc_path: /etc/nginx
|
nginx_etc_path: /etc/nginx
|
||||||
nginx_conf_d_path: "{{ nginx_etc_path }}/conf.d"
|
nginx_conf_d_path: "{{ nginx_etc_path }}/conf.d"
|
||||||
nginx_mime_types_path: "{{ nginx_etc_path }}/mime.types"
|
nginx_mime_types_path: "{{ nginx_etc_path }}/mime.types"
|
||||||
|
nginx_var_log_path: /var/log/nginx
|
||||||
|
|
||||||
nginx_user: nginx
|
nginx_user: nginx
|
||||||
nginx_worker_processes: auto
|
nginx_worker_processes: auto
|
||||||
@ -31,3 +32,4 @@ nginx_acme_challenge_enabled: yes
|
|||||||
nginx_acme_challenge_path: /var/www/.acme-challenge
|
nginx_acme_challenge_path: /var/www/.acme-challenge
|
||||||
|
|
||||||
nginx_conf_d: {}
|
nginx_conf_d: {}
|
||||||
|
nginx_vhosts: []
|
||||||
|
@ -45,6 +45,10 @@
|
|||||||
mode: 0644
|
mode: 0644
|
||||||
notify: reload nginx
|
notify: reload nginx
|
||||||
|
|
||||||
|
- name: configure virtual hosts
|
||||||
|
include_tasks: vhost.yaml
|
||||||
|
loop: "{{ nginx_vhosts | dict2items }}"
|
||||||
|
|
||||||
- name: manage service
|
- name: manage service
|
||||||
service:
|
service:
|
||||||
name: "{{ nginx_service_name }}"
|
name: "{{ nginx_service_name }}"
|
||||||
|
20
roles/nginx/tasks/vhost.yaml
Normal file
20
roles/nginx/tasks/vhost.yaml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
- name: configure virtual hosts
|
||||||
|
block:
|
||||||
|
- name: create webroot
|
||||||
|
file:
|
||||||
|
path: "{{ vhost.root }}"
|
||||||
|
state: directory
|
||||||
|
loop: "{{ item.value }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: vhost
|
||||||
|
|
||||||
|
- name: configure virtual host
|
||||||
|
template:
|
||||||
|
src: vhost.conf.j2
|
||||||
|
dest: "{{ nginx_conf_d_path }}/{{ item.key }}.conf"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0444
|
||||||
|
notify: reload nginx
|
||||||
|
loop: "{{ nginx_vhosts | dict2items }}"
|
@ -16,8 +16,8 @@ http {
|
|||||||
include {{ nginx_mime_types_path }};
|
include {{ nginx_mime_types_path }};
|
||||||
default_type {{ nginx_default_type }};
|
default_type {{ nginx_default_type }};
|
||||||
|
|
||||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
log_format main '$server_name $remote_addr - $remote_user [$time_local] "$request" '
|
||||||
'$status $body_bytes_sent "$http_referer" '
|
'$status $body_bytes_sent $request_time "$http_referer" '
|
||||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
access_log {{ nginx_access_log }};
|
access_log {{ nginx_access_log }};
|
||||||
|
42
roles/nginx/templates/vhost.conf.j2
Normal file
42
roles/nginx/templates/vhost.conf.j2
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
|
{% for vhost in item.value %}
|
||||||
|
server {
|
||||||
|
{% if vhost.listen is defined %}
|
||||||
|
{% for listen in vhost.listen %}
|
||||||
|
listen {{ listen }};
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
{% if vhost.server_name is defined %}
|
||||||
|
server_name {{ vhost.server_name }};
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
access_log {{ vhost.access_log | default(nginx_var_log_path + '/' + vhost.server_name + '.access.log main') }};
|
||||||
|
error_log {{ vhost.error_log | default(nginx_var_log_path + '/' + vhost.server_name + '.error.log warn') }};
|
||||||
|
|
||||||
|
{% if vhost.root is defined %}
|
||||||
|
root {{ vhost.root }};
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
index {{ vhost.index | default('index.html index.htm') }};
|
||||||
|
|
||||||
|
{% if vhost.ssl_certificate is defined %}
|
||||||
|
ssl_certificate {{ vhost.ssl_certificate }};
|
||||||
|
{% endif %}
|
||||||
|
{% if vhost.ssl_certificate_key is defined %}
|
||||||
|
ssl_certificate_key {{ vhost.ssl_certificate_key }};
|
||||||
|
{% endif %}
|
||||||
|
{% if vhost.ssl_dhparam is defined %}
|
||||||
|
ssl_dhparam {{ vhost.ssl_dhparam }};
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
location /.well-known/acme-challenge/ {
|
||||||
|
root {{ nginx_root }};
|
||||||
|
try_files $uri =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
{% if vhost.raw is defined %}
|
||||||
|
{{ vhost.raw | indent(4) }}
|
||||||
|
{% endif %}
|
||||||
|
}
|
||||||
|
{% endfor %}
|
Loading…
Reference in New Issue
Block a user