Learning Circle : cidst #6 :Initial commit

This commit is contained in:
youngjin.han 2020-05-16 00:05:44 +09:00
parent 8cb2c6cc79
commit 16decdf805
9 changed files with 108 additions and 3 deletions

View File

@ -2,12 +2,14 @@ __file /etc/cdist-configured
case "$__target_host" in
localhost)
__motd
__timezone Asia/Seoul
# __motd
# __timezone Asia/Seoul
# __my_computer
# __colourful_file --colour yellow --colour blue --colour red --colour green
# __my_dotfiles
# __my_nginx_site $__target_host
# __all_in_one $__target_host --with-x --extra-packages tree --extra-packages htop
__my_firewall --file /etc/my-nftables
;;
jafo.laptop)
__motd

View File

@ -0,0 +1,44 @@
#!/bin/sh -e
os="$(cat "$__global/explorer/os")"
default_package_name="socat sipalc sudo"
if [ -f "$__object/parameter/with-x" ]; then
with_x="$(cat "$__object/parameter/with-x")"
else
with_x="$__object_id"
fi
case "$os" in
alpine)
name_netcat="netcat-openbsd"
name_wireshark="tshark"
;;
debian)
name_netcat="netcat"
name_wireshark="tshark"
;;
fedora)
name_netcat="nmap-ncat"
name_wireshark="wireshark-cli"
;;
*)
echo "Don't know how to manage packages on: $os" >&2
exit 1
:
;;
esac
all_package_name="$default_package_name $name_netcat $name_wireshark"
__package_update_index
for package in $all_package_name;
do require="__apt_update_index" __package $package --state=present
done
if [ -f "$__object/parameter/extra-packages" ]; then
for package in $(cat "$__object/parameter/extra-packages"); do
require="__apt_update_index" __package $package --state=present
done
fi

View File

@ -0,0 +1 @@
with-x

View File

@ -0,0 +1 @@
extra-packages

View File

@ -0,0 +1,11 @@
#!/bin/sh -e
if [ -x nft ]; then
echo "nft is founded"
else
echo "nft is not founded"
exit 1
fi
__file /etc/my_nftables \
--mode 0644

View File

@ -0,0 +1,44 @@
#!/bin/sh -e
os="$(cat "$__global/explorer/os")"
default_package_name="socat sipalc sudo"
if [ -f "$__object/parameter/with-x" ]; then
with_x="$(cat "$__object/parameter/with-x")"
else
with_x="$__object_id"
fi
case "$os" in
alpine)
name_netcat="netcat-openbsd"
name_wireshark="tshark"
;;
debian)
name_netcat="netcat"
name_wireshark="tshark"
;;
fedora)
name_netcat="nmap-ncat"
name_wireshark="wireshark-cli"
;;
*)
echo "Don't know how to manage packages on: $os" >&2
exit 1
:
;;
esac
all_package_name="$default_package_name $name_netcat $name_wireshark"
__package_update_index
for package in $all_package_name;
do require="__apt_update_index" __package $package --state=present
done
if [ -f "$__object/parameter/extra-packages" ]; then
for package in $(cat "$__object/parameter/extra-packages"); do
require="__apt_update_index" __package $package --state=present
done
fi

View File

@ -0,0 +1 @@
file

View File

@ -3,7 +3,8 @@
**** Lecture content
***** Objective
- Apply learnings from the previous cdist sessions
***** Steps 1: *__all_in_one* (1.25h)
***** DONE Steps 1: *__all_in_one* (1.25h)
CLOSED: [2020-05-15 금 23:16]
- Create a new type named *__all_in_one*
- Decide yourself whether it is a singleton or not
- Reason why in your cdist.org file