Merge remote-tracking branch 'youngjin/master'
This commit is contained in:
commit
78646d5066
9 changed files with 108 additions and 3 deletions
|
@ -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
|
||||
|
|
44
youngjin.han/dot-cdist/type/__all_in_one/manifest
Executable file
44
youngjin.han/dot-cdist/type/__all_in_one/manifest
Executable 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
|
|
@ -0,0 +1 @@
|
|||
with-x
|
|
@ -0,0 +1 @@
|
|||
extra-packages
|
11
youngjin.han/dot-cdist/type/__my_firewall/manifest
Executable file
11
youngjin.han/dot-cdist/type/__my_firewall/manifest
Executable 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
|
44
youngjin.han/dot-cdist/type/__my_firewall/manifest~
Executable file
44
youngjin.han/dot-cdist/type/__my_firewall/manifest~
Executable 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
|
|
@ -0,0 +1 @@
|
|||
file
|
0
youngjin.han/dot-cdist/type/__my_firewall/singleton
Normal file
0
youngjin.han/dot-cdist/type/__my_firewall/singleton
Normal 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
|
||||
|
|
Loading…
Reference in a new issue