From 1b60734f2d39e6a62e65860940087625926645c2 Mon Sep 17 00:00:00 2001 From: llnu Date: Thu, 7 May 2020 12:01:09 +0200 Subject: [PATCH] learning session, new tipes updated cdist.org --- balazs/dot-cdist/manifest/init | 5 +++++ balazs/dot-cdist/type/__my_nginx/manifest | 7 +++++++ balazs/dot-cdist/type/__my_nginx/manifest~ | 5 +++++ balazs/dot-cdist/type/__my_nginx/singleton | 0 .../type/__my_nginx_site/files/chee.se.conf | 17 +++++++++++++++++ .../type/__my_nginx_site/files/woo.com.conf | 17 +++++++++++++++++ balazs/dot-cdist/type/__my_nginx_site/manifest | 17 +++++++++++++++++ balazs/dot-cdist/type/__my_nginx_site/manifest~ | 1 + 8 files changed, 69 insertions(+) create mode 100644 balazs/dot-cdist/type/__my_nginx/manifest create mode 100644 balazs/dot-cdist/type/__my_nginx/manifest~ create mode 100644 balazs/dot-cdist/type/__my_nginx/singleton create mode 100644 balazs/dot-cdist/type/__my_nginx_site/files/chee.se.conf create mode 100644 balazs/dot-cdist/type/__my_nginx_site/files/woo.com.conf create mode 100644 balazs/dot-cdist/type/__my_nginx_site/manifest create mode 100644 balazs/dot-cdist/type/__my_nginx_site/manifest~ diff --git a/balazs/dot-cdist/manifest/init b/balazs/dot-cdist/manifest/init index 5b7466d..0a4061b 100644 --- a/balazs/dot-cdist/manifest/init +++ b/balazs/dot-cdist/manifest/init @@ -11,6 +11,11 @@ case "$__target_host" in __timezone Europe/Zurich __my_computer + +# __my_nginx + + __my_nginx_site woo.com + __my_nginx_site chee.se ;; esac diff --git a/balazs/dot-cdist/type/__my_nginx/manifest b/balazs/dot-cdist/type/__my_nginx/manifest new file mode 100644 index 0000000..fe6320e --- /dev/null +++ b/balazs/dot-cdist/type/__my_nginx/manifest @@ -0,0 +1,7 @@ + +__package nginx --state present + + +#Should I export this variable somehow and use it in an other type? +#nginx_config_dir="/etc/nginx/" + diff --git a/balazs/dot-cdist/type/__my_nginx/manifest~ b/balazs/dot-cdist/type/__my_nginx/manifest~ new file mode 100644 index 0000000..7758880 --- /dev/null +++ b/balazs/dot-cdist/type/__my_nginx/manifest~ @@ -0,0 +1,5 @@ + +__package nginx --state present + +nginx_config_dir="/etc/nginx/" + diff --git a/balazs/dot-cdist/type/__my_nginx/singleton b/balazs/dot-cdist/type/__my_nginx/singleton new file mode 100644 index 0000000..e69de29 diff --git a/balazs/dot-cdist/type/__my_nginx_site/files/chee.se.conf b/balazs/dot-cdist/type/__my_nginx_site/files/chee.se.conf new file mode 100644 index 0000000..2c00ee0 --- /dev/null +++ b/balazs/dot-cdist/type/__my_nginx_site/files/chee.se.conf @@ -0,0 +1,17 @@ +# This is a default site configuration which will simply return 404, preventing +# chance access to any other virtualhost. + +server { + listen 80 default_server; + listen [::]:80 default_server; + + # Everything is a 404 +# location / { +# return 404; +# } + + # You may need this to prevent return 404 recursion. +# location = /404.html { +# internal; +# } +} diff --git a/balazs/dot-cdist/type/__my_nginx_site/files/woo.com.conf b/balazs/dot-cdist/type/__my_nginx_site/files/woo.com.conf new file mode 100644 index 0000000..2c00ee0 --- /dev/null +++ b/balazs/dot-cdist/type/__my_nginx_site/files/woo.com.conf @@ -0,0 +1,17 @@ +# This is a default site configuration which will simply return 404, preventing +# chance access to any other virtualhost. + +server { + listen 80 default_server; + listen [::]:80 default_server; + + # Everything is a 404 +# location / { +# return 404; +# } + + # You may need this to prevent return 404 recursion. +# location = /404.html { +# internal; +# } +} diff --git a/balazs/dot-cdist/type/__my_nginx_site/manifest b/balazs/dot-cdist/type/__my_nginx_site/manifest new file mode 100644 index 0000000..7bdad79 --- /dev/null +++ b/balazs/dot-cdist/type/__my_nginx_site/manifest @@ -0,0 +1,17 @@ +domain="$__object_id" +nginx_config_dir="/etc/nginx/conf.d" + +require="__package/nginx" __file $nginx_config_dir/$domain.conf --source - << EOF + +server { + + server_name $domain; + listen [::]:80 ; + + location / { + autoindex on; + root /var/www/html/$domain; + } +} +EOF + diff --git a/balazs/dot-cdist/type/__my_nginx_site/manifest~ b/balazs/dot-cdist/type/__my_nginx_site/manifest~ new file mode 100644 index 0000000..bbc7518 --- /dev/null +++ b/balazs/dot-cdist/type/__my_nginx_site/manifest~ @@ -0,0 +1 @@ +require="__package/nginx" __file $nginx_config_dir/"$__object_id".conf \ No newline at end of file