Merge remote-tracking branch 'jinguk/master'
This commit is contained in:
commit
f553784b20
6 changed files with 126 additions and 0 deletions
|
@ -1002,4 +1002,62 @@ TRACE: localhost: Saving cache: /tmp/tmp4n4p2hbt/421aa90e079fa326b6494f812ad13e7
|
||||||
INFO: localhost: Finished successful run in 2.17 seconds
|
INFO: localhost: Finished successful run in 2.17 seconds
|
||||||
VERBOSE: config: Total processing time for 1 host(s): 2.1842637062072754
|
VERBOSE: config: Total processing time for 1 host(s): 2.1842637062072754
|
||||||
|
|
||||||
|
|
||||||
* cdist3
|
* cdist3
|
||||||
|
|
||||||
|
* cdist4
|
||||||
|
** Create a new type *__my_nginx*
|
||||||
|
On the target host find out which directory nginx includes --> /etc/nginx/sites-enabled
|
||||||
|
*** log
|
||||||
|
VERBOSE: cdist: version 6.5.5-3-g6f4649ef
|
||||||
|
INFO: localhost: Starting configuration run
|
||||||
|
VERBOSE: localhost: Running global explorers
|
||||||
|
VERBOSE: localhost: Running initial manifest /tmp/tmpchto21_m/421aa90e079fa326b6494f812ad13e79/data/conf/manifest/init
|
||||||
|
VERBOSE: localhost: Preparing object __my_nginx/
|
||||||
|
VERBOSE: localhost: Running manifest and explorers for __my_nginx/
|
||||||
|
VERBOSE: localhost: Running type explorers for <CdistType __my_nginx>
|
||||||
|
VERBOSE: localhost: Running type manifest /tmp/tmpchto21_m/421aa90e079fa326b6494f812ad13e79/data/conf/type/__my_nginx/manifest for object __my_nginx/
|
||||||
|
VERBOSE: localhost: Preparing object __package/nginx
|
||||||
|
VERBOSE: localhost: Running manifest and explorers for __package/nginx
|
||||||
|
VERBOSE: localhost: Running type explorers for <CdistType __package>
|
||||||
|
VERBOSE: localhost: Running type manifest /tmp/tmpchto21_m/421aa90e079fa326b6494f812ad13e79/data/conf/type/__package/manifest for object __package/nginx
|
||||||
|
VERBOSE: localhost: Preparing object __package_apt/nginx
|
||||||
|
VERBOSE: localhost: Running manifest and explorers for __package_apt/nginx
|
||||||
|
VERBOSE: localhost: Running type explorers for <CdistType __package_apt>
|
||||||
|
VERBOSE: localhost: Running object __package_apt/nginx
|
||||||
|
VERBOSE: localhost: Running object __package/nginx
|
||||||
|
VERBOSE: localhost: Running object __my_nginx/
|
||||||
|
INFO: localhost: Finished successful run in 0.87 seconds
|
||||||
|
VERBOSE: config: Total processing time for 1 host(s): 0.8785049915313721
|
||||||
|
** Create a new tyep *__my_nginx_site*
|
||||||
|
root@mynginx2:~#ls -al /etc/nginx/sites-enabled/
|
||||||
|
total 16
|
||||||
|
drwxr-xr-x 2 root root 4096 May 11 23:29 .
|
||||||
|
drwxr-xr-x 8 root root 4096 May 11 21:40 ..
|
||||||
|
lrwxrwxrwx 1 root root 34 May 11 21:40 default -> /etc/nginx/sites-available/default
|
||||||
|
-rw-r--r-- 1 root root 243 May 11 23:29 mynginx2.test.conf
|
||||||
|
-rw-r--r-- 1 root root 243 May 11 23:27 mynginx.test.conf
|
||||||
|
root@mynginx2:~#
|
||||||
|
|
||||||
|
*** remove nginx and __my_nginx log
|
||||||
|
VERBOSE: cdist: version 6.5.5-3-g6f4649ef
|
||||||
|
INFO: mynginx2.test: Starting configuration run
|
||||||
|
VERBOSE: mynginx2.test: Running global explorers
|
||||||
|
VERBOSE: mynginx2.test: Running initial manifest /tmp/tmptq3y42m2/5e977ddad9a0047b183b6d2702795df4/data/conf/manifest/init
|
||||||
|
VERBOSE: mynginx2.test: Preparing object __my_nginx_site/mynginx2.test
|
||||||
|
VERBOSE: mynginx2.test: Running manifest and explorers for __my_nginx_site/mynginx2.test
|
||||||
|
VERBOSE: mynginx2.test: Running type explorers for <CdistType __my_nginx_site>
|
||||||
|
VERBOSE: mynginx2.test: Running type manifest /tmp/tmptq3y42m2/5e977ddad9a0047b183b6d2702795df4/data/conf/type/__my_nginx_site/manifest for object __my_nginx_site/mynginx2.test
|
||||||
|
ERROR: mynginx2.test: The requirements of the following objects could not be resolved:
|
||||||
|
__file/etc/nginx/sites-enabled/mynginx2.test.conf requires:
|
||||||
|
__package/nginx
|
||||||
|
__file/etc/nginx/sites-enabled/mynginx2.test.conf autorequires:
|
||||||
|
|
||||||
|
__my_nginx_site/mynginx2.test requires:
|
||||||
|
|
||||||
|
__my_nginx_site/mynginx2.test autorequires:
|
||||||
|
__file/etc/nginx/sites-enabled/mynginx2.test.conf
|
||||||
|
VERBOSE: config: Total processing time for 1 host(s): 0.6650142669677734
|
||||||
|
ERROR: cdist: Failed to configure the following hosts: mynginx2.tes
|
||||||
|
|
||||||
|
--> nginx is removed and "require" check nginx(__package/nginx)
|
||||||
|
|
|
@ -5,4 +5,7 @@ case "$__target_host" in
|
||||||
#__colourful_file test --colour test1 --colour test2
|
#__colourful_file test --colour test1 --colour test2
|
||||||
__my_dotfiles
|
__my_dotfiles
|
||||||
;;
|
;;
|
||||||
|
*)
|
||||||
|
#__my_nginx
|
||||||
|
__my_nginx_site $__target_host
|
||||||
esac
|
esac
|
||||||
|
|
3
kjg/dot-cdist/type/__my_nginx/manifest
Normal file
3
kjg/dot-cdist/type/__my_nginx/manifest
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
__package nginx
|
0
kjg/dot-cdist/type/__my_nginx/singleton
Normal file
0
kjg/dot-cdist/type/__my_nginx/singleton
Normal file
29
kjg/dot-cdist/type/__my_nginx_site/manifest
Normal file
29
kjg/dot-cdist/type/__my_nginx_site/manifest
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
|
DOMAIN_NAME="$__object_id"
|
||||||
|
CONF_DIR=/etc/nginx/sites-enabled
|
||||||
|
WEB_ROOT=/var/www/html/${DOMAIN_NAME}
|
||||||
|
|
||||||
|
|
||||||
|
__directory $WEB_ROOT --parents --mode 0644
|
||||||
|
|
||||||
|
require="__package/nginx" __file "${CONF_DIR}/${DOMAIN_NAME}.conf" \
|
||||||
|
--mode 0644 --source - << EOF
|
||||||
|
server {
|
||||||
|
listen *:80;
|
||||||
|
listen [::]:80;
|
||||||
|
|
||||||
|
server_name $name;
|
||||||
|
root $WEBROOT;
|
||||||
|
|
||||||
|
location /.well-known/acme-challenge/ {
|
||||||
|
root $WEBROOT;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Everything else -> ssl
|
||||||
|
location / {
|
||||||
|
return 301 https://\$host\$request_uri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
33
kjg/dot-cdist/type/__my_nginx_site/manifest~
Normal file
33
kjg/dot-cdist/type/__my_nginx_site/manifest~
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
|
||||||
|
DOMAIN_NAME="$__object_id"
|
||||||
|
CONF_DIR=/etc/nginx/sites-enabled
|
||||||
|
WEB_ROOT=/var/www/html/${DOMAIN_NAME}
|
||||||
|
|
||||||
|
#__package nginx --state installed
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#require="__package/nginx" __file "~/ungleich-learning/test.conf" \
|
||||||
|
require="__package/nginx" __file "${CONF_DIR}/${DOMAIN_NAME}.conf" \
|
||||||
|
--mode 0644 --source - << EOF
|
||||||
|
server {
|
||||||
|
listen *:80;
|
||||||
|
listen [::]:80;
|
||||||
|
|
||||||
|
server_name $name;
|
||||||
|
root $WEBROOT;
|
||||||
|
|
||||||
|
location /.well-known/acme-challenge/ {
|
||||||
|
root $WEBROOT;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Everything else -> ssl
|
||||||
|
location / {
|
||||||
|
return 301 https://\$host\$request_uri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
Loading…
Reference in a new issue