Commit 01cba070 authored by Ophélie Gagnard's avatar Ophélie Gagnard

installation/automation-script.sh: Add a script to deploy the softwares on a...

installation/automation-script.sh: Add a script to deploy the softwares on a KVM so that it produce a scan to fill the reference database.
parent e83c4d9c
#!/bin/bash
# This script is used to produce a reference database of filesystem scans in Wendelin.
# It automates the process of installing MCA on a KVM.
# It then scans some desired directories. No need to reboot to get a scan.
### INSTALL DEPENDENCIES
WENDELIN_REFERENCE=test-suite-001
WENDELIN_PWD=qxrfkwod
MCA_NAME_AND_VERSION=dep--mca--static_1-1
FLUENTBIT_NAME_AND_VERSION=dep--fluent-bit_1-1
URL_PATTERN="https://download.opensuse.org/repositories/home:/fg.nxd/Debian_11/amd64/"
APT_UTILITY_PACKAGES="sudo wget tree"
INSTALL_DEPENDENCIES_PACKAGES="dracut-core dracut dracut-network"
UEFI_KEYS_DEPENDENCIES_PACKAGES="sbsigntool efitools python3"
APT_SPECIFIC_PACKAGES="${INSTALL_DEPENDENCIES_PACKAGES} ${UEFI_KEYS_DEPENDENCIES_PACKAGES}"
MCA_PACKAGE_FILE="${MCA_NAME_AND_VERSION}_amd64.deb"
FLUENTNBIT_PACKAGE_NAME="${FLUENTBIT_PACKAGE_NAME}_amd64.deb"
MCA_PACKAGE_URL=${URL_PATTERN}${MCA_PACKAGE_FILE}
FLUENTBIT_PACKAGE_URL=${URL_PATTERN}${FLUENTBIT_MCA_PACKAGE_FILE}
FLB_PATH=/opt/${FLUENTBIT_NAME_AND_VERSION}
MCA_PATH=/opt/${MCA_NAME_AND_VERSION}
FLB_CONF_PATH=${FLB_PATH}/etc/
# utility packages
apt -y install ${APT_UTILITY_PACKAGES}
# specific packages
apt -y install ${APT_SPECIFIC_PACKAGES}
# our own packages
wget ${MCA_PACKAGE_URL}
whet ${FLUENTBIT_PACKAGE_URL}
apt -y install ./${MCA_PACKAGE_FILE} ./${FLUENTBIT_PACKAGE_FILE}
# temporary: while the fluent-bit packages does not come with its own template file "etc/flb.conf.in"
cat > ${FLB_CONF_PATH}flb.conf.in << "EOF"
[SERVICE]
flush 5
[INPUT]
name tail
path /var/log/metadata_collect.log
refresh_interval 2
[output]
name fluentbit_wendelin
match *
streamtool_uri https://softinst157546.host.vifib.net/erp5/portal_ingestion_policies/metadata_upload
user zope
password %WENDELIN_PWD%
buffer_type memory
flush_interval 60s
disable_retry_limit true
reference %WENDELIN_REFERENCE%
EOF
CONF_REGEX="s|%WENDELIN_REFERENCE%|${WENDELIN_REFERENCE}|g;s|%WENDELIN_PWD%|${WENDELIN_PWD}|g"
sed "${CONF_REFEX}" ${FLB_CONF_PATH}/flb.conf.in > ${FLB_CONF_PATH}/flb.conf
### SCAN THE DESIRED DIRECTORIES
BINARY=${MCA_PATH}/bin/metadata-collect-agent
FLB=${FLUENTBIT_PATH}/bin/fluent-bit
FLB_CONF=${FLUENTBIT_PATH}/etc/flb.conf
LOG=/var/log/metadata_collect.log
PATH_TO_SCAN=/bin
${BINARY} ${PATH_TO_SCAN} ${FLB} ${FLB_PLUGIN} ${FLB_CONF} ${LOG}
PATH_TO_SCAN=/sbin
${BINARY} ${PATH_TO_SCAN} ${FLB} ${FLB_PLUGIN} ${FLB_CONF} ${LOG}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment