diff --git a/balazs/dot-cdist/manifest/init b/balazs/dot-cdist/manifest/init index 0a4061b..9fd9bdc 100644 --- a/balazs/dot-cdist/manifest/init +++ b/balazs/dot-cdist/manifest/init @@ -6,16 +6,14 @@ case "$__target_host" in # Copy a cool motd from the type's file directory __motd --source "$__files/motd" -# __package emacs --state present - __timezone Europe/Zurich __my_computer -# __my_nginx + __my_nginx - __my_nginx_site woo.com - __my_nginx_site chee.se + require="__my_nginx" __my_nginx_site woo.com + require="__my_nginx" __my_nginx_site chee.se ;; esac diff --git a/balazs/dot-cdist/type/__my_computer/manifest~ b/balazs/dot-cdist/type/__my_computer/manifest~ deleted file mode 100755 index a6ac13d..0000000 --- a/balazs/dot-cdist/type/__my_computer/manifest~ +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -e - -#This is a type for practice, used to learn cdist and configure a laptop. - - -for pkg in ndisc6 emacs zsh mosh nmap sipcalc; - do __package $pkg --state present; -done diff --git a/balazs/dot-cdist/type/__my_nginx_site/gencode-remote b/balazs/dot-cdist/type/__my_nginx_site/gencode-remote new file mode 100644 index 0000000..7a74b98 --- /dev/null +++ b/balazs/dot-cdist/type/__my_nginx_site/gencode-remote @@ -0,0 +1,23 @@ +os=$(cat "$__global/explorer/os") + +#if grep -q "$something_from_message_in" "$__messages_in"; then + +case "${os}" in + alpine|gentoo) + echo /etc/init.d/nginx reload + ;; + debian|ubuntu) + echo "/usr/bin/systemctl reload nginx" + ;; +esac + +#fi + + +#if grep -q "^__your_type/object/id:conf_file_changed" "$__messages_in"; then +# echo "$reload_command" +#fi + +# Testing env -> variables are not shared between the type's manifest and the gencode-remote script +# Maybe the variables are eval-ed on the local host and won't get transferred to the remote host? +#echo "echo \"$reload_command\" >> /tmp/cmd" \ No newline at end of file diff --git a/balazs/dot-cdist/type/__my_nginx_site/manifest b/balazs/dot-cdist/type/__my_nginx_site/manifest index 7bdad79..0dbfbb6 100644 --- a/balazs/dot-cdist/type/__my_nginx_site/manifest +++ b/balazs/dot-cdist/type/__my_nginx_site/manifest @@ -1,3 +1,8 @@ +os="$(cat "$__global/explorer/os")" + +# Note: __service nginx --action reload + + domain="$__object_id" nginx_config_dir="/etc/nginx/conf.d" @@ -15,3 +20,5 @@ server { } EOF +# Messaging is not needed because atm I assume that the config file will get overwritten every run, even if the contents are the same. +#echo "conf_file_changed" >> "$__messages_out" \ No newline at end of file