diff --git a/Generated/adhoc-zabbix-agent.sh b/Generated/adhoc-zabbix-agent.sh index bc71956..9cbefb4 100644 --- a/Generated/adhoc-zabbix-agent.sh +++ b/Generated/adhoc-zabbix-agent.sh @@ -10,7 +10,9 @@ pkgs() { apk update fi - apk add $1 + if [ "$1" != "" ]; then + apk add $1 + fi } #Usage: zabbix_agent2 diff --git a/Generated/adhoc-zabbix-proxy.sh b/Generated/adhoc-zabbix-proxy.sh index 3146b66..bbe7b0b 100644 --- a/Generated/adhoc-zabbix-proxy.sh +++ b/Generated/adhoc-zabbix-proxy.sh @@ -9,7 +9,9 @@ pkgs() { apk update fi - apk add $1 + if [ "$1" != "" ]; then + apk add $1 + fi } #Usage: zabbix_proxy diff --git a/Generated/container-crontab.sh b/Generated/container-crontab.sh index d0afcd6..17d1112 100644 --- a/Generated/container-crontab.sh +++ b/Generated/container-crontab.sh @@ -1,8 +1,12 @@ #!/bin/ash -#Usage: crontab_base +#Usage: crontab_base [blank] crontab_base() { - cat > /tmp/new.cron < /tmp/new.cron >>EOF + EOF + else + cat > /tmp/new.cron < /etc/motd' diff --git a/Generated/setup-docker-host.sh b/Generated/setup-docker-host.sh index 464ff8e..1f9194c 100644 --- a/Generated/setup-docker-host.sh +++ b/Generated/setup-docker-host.sh @@ -17,12 +17,18 @@ pkgs() { apk update fi - apk add $1 + if [ "$1" != "" ]; then + apk add $1 + fi } -#Usage: crontab_base +#Usage: crontab_base [blank] crontab_base() { - cat > /tmp/new.cron < /tmp/new.cron >>EOF + EOF + else + cat > /tmp/new.cron < /etc/motd' diff --git a/Generated/setup-docker-registry.sh b/Generated/setup-docker-registry.sh index ecc78fa..9b3be5b 100644 --- a/Generated/setup-docker-registry.sh +++ b/Generated/setup-docker-registry.sh @@ -17,12 +17,18 @@ pkgs() { apk update fi - apk add $1 + if [ "$1" != "" ]; then + apk add $1 + fi } -#Usage: crontab_base +#Usage: crontab_base [blank] crontab_base() { - cat > /tmp/new.cron < /tmp/new.cron >>EOF + EOF + else + cat > /tmp/new.cron < /etc/motd' diff --git a/Generated/setup-gitea-mysql-server.sh b/Generated/setup-gitea-mysql-server.sh index 441d61b..664d048 100644 --- a/Generated/setup-gitea-mysql-server.sh +++ b/Generated/setup-gitea-mysql-server.sh @@ -17,12 +17,18 @@ pkgs() { apk update fi - apk add $1 + if [ "$1" != "" ]; then + apk add $1 + fi } -#Usage: crontab_base +#Usage: crontab_base [blank] crontab_base() { - cat > /tmp/new.cron < /tmp/new.cron >>EOF + EOF + else + cat > /tmp/new.cron < /etc/motd' diff --git a/Generated/setup-gitea-server.sh b/Generated/setup-gitea-server.sh index 34f1d8b..8190581 100644 --- a/Generated/setup-gitea-server.sh +++ b/Generated/setup-gitea-server.sh @@ -17,12 +17,18 @@ pkgs() { apk update fi - apk add $1 + if [ "$1" != "" ]; then + apk add $1 + fi } -#Usage: crontab_base +#Usage: crontab_base [blank] crontab_base() { - cat > /tmp/new.cron < /tmp/new.cron >>EOF + EOF + else + cat > /tmp/new.cron < /etc/motd' @@ -57,10 +64,10 @@ reboot_system() { } repos edge -pkgs "procps htop iftop net-tools tmux iptables mg syslog-ng haveged iproute2 coreutils logrotate shadow openssh gitea" +pkgs "procps htop iftop net-tools tmux iptables mg syslog-ng haveged iproute2 coreutils logrotate shadow openssh gogs" crontab_base crontab_append "0 2 * * 5 /sbin/apk -U -a upgrade" apply_crontab enable_services boot "syslog-ng" -enable_services default "crond iptables gitea sshd" +enable_services default "crond iptables gogs sshd" reboot_system diff --git a/Generated/setup-glab-runner.sh b/Generated/setup-glab-runner.sh index 8d71c97..60c904c 100644 --- a/Generated/setup-glab-runner.sh +++ b/Generated/setup-glab-runner.sh @@ -21,12 +21,18 @@ pkgs() { apk update fi - apk add $1 + if [ "$1" != "" ]; then + apk add $1 + fi } -#Usage: crontab_base +#Usage: crontab_base [blank] crontab_base() { - cat > /tmp/new.cron < /tmp/new.cron >>EOF + EOF + else + cat > /tmp/new.cron < /etc/motd' diff --git a/Generated/setup-gns3-server.sh b/Generated/setup-gns3-server.sh index 9b7c9a0..81c98c6 100644 --- a/Generated/setup-gns3-server.sh +++ b/Generated/setup-gns3-server.sh @@ -3,7 +3,13 @@ set -ex #Usage: pkgs 'htop tmux emacs' pkgs() { - DEBIAN_FRONTED=noninteractive apt -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -q -y install $1 + if [ "$2" == "update" ]; then + DEBIAN_FRONTED=noninteractive apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -q -y update + fi + + if [ "$1" != "" ]; then + DEBIAN_FRONTED=noninteractive apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -q -y install $1 + fi } #Usage: create_group gns3 diff --git a/Generated/setup-k3s-ctrl.sh b/Generated/setup-k3s-ctrl.sh index 8c528df..797bc9f 100644 --- a/Generated/setup-k3s-ctrl.sh +++ b/Generated/setup-k3s-ctrl.sh @@ -19,12 +19,18 @@ pkgs() { apk update fi - apk add $1 + if [ "$1" != "" ]; then + apk add $1 + fi } -#Usage: crontab_base +#Usage: crontab_base [blank] crontab_base() { - cat > /tmp/new.cron < /tmp/new.cron >>EOF + EOF + else + cat > /tmp/new.cron < /etc/motd' diff --git a/Generated/setup-k3s-node.sh b/Generated/setup-k3s-node.sh index 658d547..17750e5 100644 --- a/Generated/setup-k3s-node.sh +++ b/Generated/setup-k3s-node.sh @@ -21,12 +21,18 @@ pkgs() { apk update fi - apk add $1 + if [ "$1" != "" ]; then + apk add $1 + fi } -#Usage: crontab_base +#Usage: crontab_base [blank] crontab_base() { - cat > /tmp/new.cron < /tmp/new.cron >>EOF + EOF + else + cat > /tmp/new.cron < /etc/motd' diff --git a/Generated/setup-lxd-node.sh b/Generated/setup-lxd-node.sh index 0d05a9b..debbdd7 100644 --- a/Generated/setup-lxd-node.sh +++ b/Generated/setup-lxd-node.sh @@ -18,12 +18,18 @@ pkgs() { apk update fi - apk add $1 + if [ "$1" != "" ]; then + apk add $1 + fi } -#Usage: crontab_base +#Usage: crontab_base [blank] crontab_base() { - cat > /tmp/new.cron < /tmp/new.cron >>EOF + EOF + else + cat > /tmp/new.cron < /etc/motd' @@ -150,7 +157,7 @@ enable_services() { } repos edge -pkgs "linux-lts-dev lxd-feature lxc lxc-lvm lxcfs bridge lxc-templates lxc-download xz gnupg rsync debootstrap grep zfs zfs-lts zfs-scripts zfs-libs zfs-udev eudev eudev-hwids hwdata dbus shadow util-linux util-linux-misc coreutils iproute2 findutils usbutils pciutils sysfsutils gawk procps grep binutils wget curl syslog-ng acpid awall haveged logrotate qemu qemu-img qemu-tools qemu-system-x86_64 qemu-ui-spice-core qemu-chardev-spice qemu-audio-spice qemu-ui-spice-app qemu-hw-usb-host qemu-hw-usb-redirect qemu-hw-display-virtio-gpu qemu-hw-display-virtio-vga libvirt ovmf swtpm distrobuilder distrobuilder-lxd make go git zram-init iptables ip6tables aufs-util e2fsprogs fennel lshw lua5.3-libs mosh openssl sudo tmux sysstat" +pkgs "linux-lts-dev lxd-feature lxc lxc-lvm lxcfs bridge lxc-templates lxc-download xz gnupg rsync debootstrap grep zfs zfs-lts zfs-scripts zfs-libs zfs-udev eudev eudev-hwids hwdata dbus shadow util-linux util-linux-misc coreutils iproute2 findutils usbutils pciutils sysfsutils gawk procps grep binutils wget curl syslog-ng acpid awall haveged logrotate qemu qemu-img qemu-tools qemu-system-x86_64 qemu-ui-spice-core qemu-chardev-spice qemu-audio-spice qemu-ui-spice-app qemu-hw-usb-host qemu-hw-usb-redirect qemu-hw-display-virtio-gpu qemu-hw-display-virtio-vga libvirt libvirt-daemon libvirt-client libvirt-qemu libvirt-libs ovmf swtpm distrobuilder distrobuilder-lxd make go git zram-init iptables ip6tables aufs-util e2fsprogs fennel lshw lua5.3-libs mosh openssl sudo tmux sysstat" crontab_base crontab_append "*/10 * * * * /usr/lib/sa1 1 1" crontab_append "*/10 * * * * /usr/lib/sa1 600 6 &" @@ -160,4 +167,4 @@ crontab_append "0 5 * * 5 /sbin/reboot" apply_crontab ssh_conf "22" "sysadmin" enable_services boot syslog-ng -enable_services default "crond cgroups lxd lxc lxcfs dbus zram-init" +enable_services default "crond cgroups lxd lxc lxcfs dbus zram-init libvirtd" diff --git a/Generated/setup-minecraft-server.sh b/Generated/setup-minecraft-server.sh index 6e1eb0e..368d5d0 100644 --- a/Generated/setup-minecraft-server.sh +++ b/Generated/setup-minecraft-server.sh @@ -18,12 +18,18 @@ pkgs() { apk update fi - apk add $1 + if [ "$1" != "" ]; then + apk add $1 + fi } -#Usage: crontab_base +#Usage: crontab_base [blank] crontab_base() { - cat > /tmp/new.cron < /tmp/new.cron >>EOF + EOF + else + cat > /tmp/new.cron < /etc/motd' diff --git a/Generated/setup-ossec-loki-stack.sh b/Generated/setup-ossec-loki-stack.sh index 096ec21..d78ef34 100644 --- a/Generated/setup-ossec-loki-stack.sh +++ b/Generated/setup-ossec-loki-stack.sh @@ -358,11 +358,11 @@ promtail_base_conf() { mv /etc/loki/promtail-local-config.yaml /etc/loki/promtail-local-config.yaml.bak fi - if $(which systemctl > /dev/null); then + if $(which systemctl > /dev/null); then usermod -a -G systemd-journal promtail usermod -a -G adm promtail fi - + cat > /etc/loki/promtail-local-config.yaml <> $promtail_conf <> $promtail_conf < /dev/null); then + usermod -a -G systemd-journal promtail + usermod -a -G adm promtail + fi + cat > /etc/loki/promtail-local-config.yaml <> /etc/loki/promtail-local-config.yaml <> $promtail_conf < /tmp/new.cron < /tmp/new.cron >>EOF + EOF + else + cat > /tmp/new.cron < /etc/motd' diff --git a/Generated/setup-salt-master.sh b/Generated/setup-salt-master.sh index d132811..0f1709c 100644 --- a/Generated/setup-salt-master.sh +++ b/Generated/setup-salt-master.sh @@ -18,12 +18,18 @@ pkgs() { apk update fi - apk add $1 + if [ "$1" != "" ]; then + apk add $1 + fi } -#Usage: crontab_base +#Usage: crontab_base [blank] crontab_base() { - cat > /tmp/new.cron < /tmp/new.cron >>EOF + EOF + else + cat > /tmp/new.cron < /etc/motd' diff --git a/Generated/setup-salt-minion.sh b/Generated/setup-salt-minion.sh index 9694fdf..d4fda28 100644 --- a/Generated/setup-salt-minion.sh +++ b/Generated/setup-salt-minion.sh @@ -7,7 +7,9 @@ pkgs() { apk update fi - apk add $1 + if [ "$1" != "" ]; then + apk add $1 + fi } #Usage: diff --git a/Generated/setup-snipeit.sh b/Generated/setup-snipeit.sh index a2805a4..78de45a 100644 --- a/Generated/setup-snipeit.sh +++ b/Generated/setup-snipeit.sh @@ -1,5 +1,4 @@ #!/bin/ash -set -ex URL=https://$(ip addr show dev eth0 | grep 'inet ' | awk '{print $2}' | sed 's|/24||'):443 #Usage: repos @@ -19,12 +18,18 @@ pkgs() { apk update fi - apk add $1 + if [ "$1" != "" ]; then + apk add $1 + fi } -#Usage: crontab_base +#Usage: crontab_base [blank] crontab_base() { - cat > /tmp/new.cron < /tmp/new.cron >>EOF + EOF + else + cat > /tmp/new.cron < /etc/motd' diff --git a/Generated/setup-suricata-gateway.sh b/Generated/setup-suricata-gateway.sh index c93e5a1..9100e4f 100644 --- a/Generated/setup-suricata-gateway.sh +++ b/Generated/setup-suricata-gateway.sh @@ -19,12 +19,18 @@ pkgs() { apk update fi - apk add $1 + if [ "$1" != "" ]; then + apk add $1 + fi } -#Usage: crontab_base +#Usage: crontab_base [blank] crontab_base() { - cat > /tmp/new.cron < /tmp/new.cron >>EOF + EOF + else + cat > /tmp/new.cron < /etc/motd' diff --git a/Generated/setup-wazuh-loki-stack.sh b/Generated/setup-wazuh-loki-stack.sh index 6044bd0..a81bacb 100644 --- a/Generated/setup-wazuh-loki-stack.sh +++ b/Generated/setup-wazuh-loki-stack.sh @@ -137,11 +137,11 @@ promtail_base_conf() { mv /etc/loki/promtail-local-config.yaml /etc/loki/promtail-local-config.yaml.bak fi - if $(which systemctl > /dev/null); then + if $(which systemctl > /dev/null); then usermod -a -G systemd-journal promtail usermod -a -G adm promtail fi - + cat > /etc/loki/promtail-local-config.yaml <> $promtail_conf <> $promtail_conf < /tmp/new.cron < /tmp/new.cron >>EOF + EOF + else + cat > /tmp/new.cron < /etc/motd' diff --git a/Generated/setup-zabbix-server.sh b/Generated/setup-zabbix-server.sh index 84125b8..14f6841 100644 --- a/Generated/setup-zabbix-server.sh +++ b/Generated/setup-zabbix-server.sh @@ -18,12 +18,18 @@ pkgs() { apk update fi - apk add $1 + if [ "$1" != "" ]; then + apk add $1 + fi } -#Usage: crontab_base +#Usage: crontab_base [blank] crontab_base() { - cat > /tmp/new.cron < /tmp/new.cron >>EOF + EOF + else + cat > /tmp/new.cron < /etc/motd' diff --git a/Generated/typical-crontab.sh b/Generated/typical-crontab.sh index 9f43055..0ce137c 100644 --- a/Generated/typical-crontab.sh +++ b/Generated/typical-crontab.sh @@ -1,8 +1,12 @@ #!/bin/ash -#Usage: crontab_base +#Usage: crontab_base [blank] crontab_base() { - cat > /tmp/new.cron < /tmp/new.cron >>EOF + EOF + else + cat > /tmp/new.cron < /etc/motd' diff --git a/Templates/setup-gogs-server.yaml b/Templates/setup-gogs-server.yaml new file mode 100644 index 0000000..ab4814a --- /dev/null +++ b/Templates/setup-gogs-server.yaml @@ -0,0 +1,29 @@ +Shell: '#!/bin/ash' +Script: Generated/setup-gitea-server.sh +Debug: false +Variables: + - Name: + Value: +Tasks: + - Path: Tasks/stable_apk_repos + Invo: + - 'repos edge' + - Path: Tasks/apk_pkgs + Invo: + - 'pkgs "procps htop iftop net-tools tmux iptables mg syslog-ng haveged iproute2 coreutils logrotate shadow openssh gogs"' + - Path: Tasks/crontab_base + Invo: + - 'crontab_base' + - Path: Tasks/crontab_append + Invo: + - 'crontab_append "0 2 * * 5 /sbin/apk -U -a upgrade"' + - Path: Tasks/apply_crontab + Invo: + - 'apply_crontab' + - Path: Tasks/enable_services + Invo: + - 'enable_services boot "syslog-ng"' + - 'enable_services default "crond iptables gogs sshd"' + - Path: Tasks/reboot_system + Invo: + - 'reboot_system'