From 93b1d1baa17c4b82509fd76d387555491cae9c3c Mon Sep 17 00:00:00 2001 From: kjg Date: Fri, 15 May 2020 22:06:39 +0900 Subject: [PATCH] [cdist #6] create __all_in_one type --- kjg/cdist.org | 5 +++ kjg/dot-cdist/manifest/init | 3 +- kjg/dot-cdist/type/__all_in_one/manifest | 38 +++++++++++++++++++ .../type/__all_in_one/parameter/boolean | 1 + .../__all_in_one/parameter/optional_multiple | 1 + .../__all_in_one/parameter/optional_multiple~ | 1 + kjg/dot-cdist/type/__all_in_one/singleton | 0 7 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 kjg/dot-cdist/type/__all_in_one/manifest create mode 100644 kjg/dot-cdist/type/__all_in_one/parameter/boolean create mode 100644 kjg/dot-cdist/type/__all_in_one/parameter/optional_multiple create mode 100644 kjg/dot-cdist/type/__all_in_one/parameter/optional_multiple~ create mode 100644 kjg/dot-cdist/type/__all_in_one/singleton diff --git a/kjg/cdist.org b/kjg/cdist.org index 583bd21..ab709af 100644 --- a/kjg/cdist.org +++ b/kjg/cdist.org @@ -1087,3 +1087,8 @@ ex) openssl dhparam -outform PEM -out ${destination}/${domain}_dhparam.pem $keys + +* cdist6 +** __all_in_one +i used singleton, because it does not need specific host. +** __firewall diff --git a/kjg/dot-cdist/manifest/init b/kjg/dot-cdist/manifest/init index ec9fdfb..3b61b1b 100644 --- a/kjg/dot-cdist/manifest/init +++ b/kjg/dot-cdist/manifest/init @@ -3,7 +3,8 @@ case "$__target_host" in localhost) #__my_computer #__colourful_file test --colour test1 --colour test2 - __my_dotfiles + #__my_dotfiles + __all_in_one --with-x --extra-packages git ;; *) __my_nginx diff --git a/kjg/dot-cdist/type/__all_in_one/manifest b/kjg/dot-cdist/type/__all_in_one/manifest new file mode 100644 index 0000000..87057e4 --- /dev/null +++ b/kjg/dot-cdist/type/__all_in_one/manifest @@ -0,0 +1,38 @@ +#!/bin/sh + +os=$(cat "$__global/explorer/os") + +case "$os" in + alpine) + os_pkgs="netcat-openbsd and tshark" + ;; + debian|devuan) + os_pkgs="netcat tshark" + ;; + fedora) + os_pkgs="nmap-ncat wireshark-cli" + ;; + *) + echo "OS $os currently not supported" >&2 + exit 1 + ;; +esac + +base_pkgs="socat sipcalc sudo" + + +if [! -f ${__object}/parameter/with-x ]; then + for bpkg in ${base_pkgs}; do + __package ${bpkg} --state present + done + + for opkg in ${os_pkgs}; do + __package ${opkg} --state present + done +fi + +if [ -f "$__object/parameter/extra-packages" ]; then + for epkg in $(cat $__object/parameter/extra-packages); do + __package $epkg --state present + done +fi diff --git a/kjg/dot-cdist/type/__all_in_one/parameter/boolean b/kjg/dot-cdist/type/__all_in_one/parameter/boolean new file mode 100644 index 0000000..b333e3c --- /dev/null +++ b/kjg/dot-cdist/type/__all_in_one/parameter/boolean @@ -0,0 +1 @@ +with-x \ No newline at end of file diff --git a/kjg/dot-cdist/type/__all_in_one/parameter/optional_multiple b/kjg/dot-cdist/type/__all_in_one/parameter/optional_multiple new file mode 100644 index 0000000..2cfc07b --- /dev/null +++ b/kjg/dot-cdist/type/__all_in_one/parameter/optional_multiple @@ -0,0 +1 @@ +extra-packages diff --git a/kjg/dot-cdist/type/__all_in_one/parameter/optional_multiple~ b/kjg/dot-cdist/type/__all_in_one/parameter/optional_multiple~ new file mode 100644 index 0000000..d9d6344 --- /dev/null +++ b/kjg/dot-cdist/type/__all_in_one/parameter/optional_multiple~ @@ -0,0 +1 @@ +extra-packages \ No newline at end of file diff --git a/kjg/dot-cdist/type/__all_in_one/singleton b/kjg/dot-cdist/type/__all_in_one/singleton new file mode 100644 index 0000000..e69de29