-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
renamed var: semaphore_port -> semaphore_listenport introduced vars: semaphore_listenip semaphore_default_user_make_admin: true|false added vars for nginx reverse config (new vars) including dist-specfic vars: semaphore_nginx_deploy_reverseconfig semaphore_nginx_template semaphore_nginx_remove_default_config semaphore_nginx_config_filename semaphore_nginx_use_nginx_common_snippet semaphore_nginx_snippet_directory semaphore_nginx_tls_hardening_snippet semaphore_tls_hsts_enable: true|false semaphore_tls_hsts_time: integer semaphore_nginx_ssl_certificate semaphore_nginx_ssl_certificate_key semaphore_nginx_default_config semaphore_nginx_config_src_dir semaphore_nginx_config_dst_dir improved query if default user already exists (query specifically the semaphore_default_user not if any user exists) option to make default user admin (var: semaphore_default_user_make_admin) changed default config to builtin-default of semaphore (you can omit --config on commands this way): semaphore_config_path: "/etc/semaphore/semaphore.json" -> "/etc/semaphore/config.json"
- Loading branch information
Stefan Schwarz
committed
Apr 28, 2023
1 parent
201d743
commit f1720b0
Showing
8 changed files
with
174 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
- name: Remove default config (when enabled) | ||
ansible.builtin.file: | ||
path: "{{ semaphore_nginx_default_config }}" | ||
state: absent | ||
notify: Restart nginx | ||
when: semaphore_nginx_remove_default_config | ||
|
||
- name: Ensure nginx config is present | ||
ansible.builtin.template: | ||
dest: "{{ semaphore_nginx_config_src_dir }}/{{ semaphore_nginx_config_filename }}" | ||
mode: "0644" | ||
src: "{{ semaphore_nginx_template }}" | ||
notify: Restart nginx | ||
|
||
- name: Enable nginx config via symbolic link | ||
ansible.builtin.file: | ||
src: "{{ semaphore_nginx_config_src_dir }}/{{ semaphore_nginx_config_filename }}" | ||
dest: "{{ semaphore_nginx_config_dst_dir }}/{{ semaphore_nginx_config_filename }}" | ||
state: link | ||
notify: Restart nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
server { | ||
listen 80 {% if semaphore_nginx_remove_default_config %}default_server{% endif %}; | ||
listen [::]:80 {% if semaphore_nginx_remove_default_config %}default_server{% endif %}; | ||
server_name {{ semaphore_hostname }}; | ||
|
||
location / { | ||
# remember: 301 = moved permanently (search engines will react), 302 = moved temporarily (search engines will hold back) | ||
return 301 https://$server_name$request_uri; | ||
} | ||
} | ||
|
||
server { | ||
listen 443 ssl http2 {% if semaphore_nginx_remove_default_config %}default_server{% endif %}; | ||
listen [::]:443 ssl http2 {% if semaphore_nginx_remove_default_config %}default_server{% endif %}; | ||
server_name {{ semaphore_hostname }}; | ||
|
||
client_max_body_size 0; | ||
chunked_transfer_encoding on; | ||
|
||
{% if semaphore_nginx_use_nginx_common_snippet %} | ||
include {{ semaphore_nginx_tls_hardening_snippet }}; | ||
{% else %} | ||
ssl_protocols TLSv1.2 TLSv1.3; | ||
ssl_prefer_server_ciphers on; | ||
ssl_ciphers CHACHA20:-AES:AESGCM:AESCCM:!kRSA:!PSK:!aECDSA:!aDSS:!aNULL:!eNULL:!SHA1:!MD5; | ||
ssl_ecdh_curve X25519:secp521r1:secp384r1; | ||
{% if semaphore_tls_hsts_enable %} | ||
add_header Strict-Transport-Security "max-age={{ semaphore_tls_hsts_time }}"; | ||
{% endif %} | ||
{% endif %} | ||
|
||
ssl_certificate {{ semaphore_nginx_ssl_certificate }}; | ||
ssl_certificate_key {{ semaphore_nginx_ssl_certificate_key }}; | ||
|
||
location / { | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
|
||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
proxy_pass http://{{ semaphore_listenip }}:{{ semaphore_listenport }}; | ||
proxy_read_timeout 30; | ||
|
||
proxy_buffering off; | ||
proxy_request_buffering off; | ||
} | ||
|
||
location /api/ws { | ||
proxy_pass http://{{ semaphore_listenip }}:{{ semaphore_listenport }}/api/ws; | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
proxy_set_header Origin ""; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
# vars specific for Debian systems | ||
semaphore_nginx_default_config: "/etc/nginx/sites-enabled/default" | ||
semaphore_nginx_config_src_dir: "/etc/nginx/sites-available" | ||
semaphore_nginx_config_dst_dir: "/etc/nginx/sites-enabled" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
# vars specific for RedHat systems | ||
semaphore_nginx_default_config: "/etc/nginx/conf.d/default.conf" | ||
# semaphore_nginx_config_src_dir: "" | ||
semaphore_nginx_config_dst_dir: "/etc/nginx/conf.d" |