Page MenuHomeDevCentral

D1113.id2843.diff
No OneTemporary

D1113.id2843.diff

diff --git a/roles/webserver-core/init.sls b/roles/webserver-core/init.sls
new file mode 100644
--- /dev/null
+++ b/roles/webserver-core/init.sls
@@ -0,0 +1,11 @@
+# -------------------------------------------------------------
+# Salt — Webserver core units for all webservers roles
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Created: 2017-10-25
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+include:
+ - .letsencrypt
+ - .tools
diff --git a/roles/webserver-core/tools/files/list-nginx-vhosts.tcl b/roles/webserver-core/tools/files/list-nginx-vhosts.tcl
new file mode 100644
--- /dev/null
+++ b/roles/webserver-core/tools/files/list-nginx-vhosts.tcl
@@ -0,0 +1,61 @@
+#!/usr/bin/env tclsh8.6
+
+# -------------------------------------------------------------
+# List nginx vhosts configuration files
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Created: 2017-10-24
+# License: BSD-2-Clause
+# Source file: roles/webserver-core/tools/files/list-nginx-vhosts.tcl
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+# -------------------------------------------------------------
+# List
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+proc list_nginx_vhosts {} {
+ foreach file [get_vhosts_files] {
+ puts " include $file;"
+ }
+}
+
+proc get_vhosts_files {} {
+ lsort [glob [get_vhosts_path]]
+}
+
+proc get_vhosts_path {} {
+ join [list [get_local_etc] nginx vhosts *.conf] [file separator]
+}
+
+# -------------------------------------------------------------
+# /etc or /usr/local/etc?
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+proc get_local_etc {} {
+ if {[is_bsd_os]} {
+ return "/usr/local/etc"
+ } {
+ return "/etc"
+ }
+}
+
+proc is_bsd_os {} {
+ lcontains [exec uname] {FreeBSD OpenBSD NetBSD DragonFly Darwin}
+}
+
+proc lcontains {needle haystack} {
+ expr [lsearch $haystack $needle] >= 0
+}
+
+# -------------------------------------------------------------
+# Procedural code
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+list_nginx_vhosts
diff --git a/roles/webserver-core/tools/init.sls b/roles/webserver-core/tools/init.sls
new file mode 100644
--- /dev/null
+++ b/roles/webserver-core/tools/init.sls
@@ -0,0 +1,14 @@
+# -------------------------------------------------------------
+# Salt — Helper tools for nginx
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Created: 2017-10-24
+# License: Trivial work, not eligible to copyright
+# -------------------------------------------------------------
+
+{% from "map.jinja" import dirs with context %}
+
+{{ dirs.bin }}/list-nginx-vhosts-conf:
+ file.managed:
+ - mode: 755
+ - source: salt://roles/webserver-core/tools/files/list-nginx-vhosts.tcl
diff --git a/top.sls b/top.sls
--- a/top.sls
+++ b/top.sls
@@ -26,7 +26,7 @@
- roles/paas-lxc/lxc
- roles/mastodon
'eglide':
- - roles/webserver-core/letsencrypt
+ - roles/webserver-core
- roles/shellserver/users
- roles/shellserver/userland-software
- roles/shellserver/eglide-website

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 16:22 (28 m, 32 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260527
Default Alt Text
D1113.id2843.diff (3 KB)

Event Timeline