Skip to content
Snippets Groups Projects
Commit 9faf4455 authored by root's avatar root
Browse files

create script to ask variables interactively

parent 381a1590
Branches
Tags
No related merge requests found
#!/bin/bash
set -e
if [ -f group_vars/all/variables.yml ]; then
echo "Variables file (group_vars/all/variables.yml) is configure manually. please take a look if everything is correct and move to next step"
cat group_vars/all/variables.yml
else
echo "set FQDN which will be used to access the soctools services. (the DNS record should already be in place.)"
read -p 'soctoolsproxy: ' soctoolsproxy
if [ -z $soctoolsproxy ]; then
echo "Error: Empty string for soctoolsproxy! exiting..."
exit 1
fi
echo
echo "Organization's top level domain (will be used as organization name and organization domain in different services)"
read -p 'domain: ' domain
if [ -z $domain ]; then
echo "Error: Empty string for domain! exiting..."
exit 1
fi
echo
echo
echo
echo "Please provide following parameters for first socctolls user which will be created during the initialization with organization admin privileges:"
echo "firstname - First name of the user"
echo "lastname - Last name of the user"
echo "username - Username of the user"
echo "DN - Distinguished Name of the user, for user certificate"
echo "CN - Common Name of the user, for user certificate"
echo "Email will be generated automatically in Username@Domain format becouse of format restrictions in some services"
sleep 10
for i in firstname lastname username DN CN; do
read -p "${i}: " $i
if [ -z $i ]; then
echo "Error: Empty string for ${i}! exiting..."
exit 1
fi
done
echo
echo
echo
sleep 2
echo "Please check the gethered variables and type 'yes' if everything is correct: "
echo "soctoolsproxy: $soctoolsproxy"
echo "domain: $domain"
echo "firstname: $firstname"
echo "lastname: $lastname"
echo "username: $username"
echo "DN: $DN"
echo "CN: $CN"
echo
echo
sleep 10
read -p "Correct? type 'yes' or 'no': " ANSWER
if [ $ANSWER = "yes" ]; then
if ! [ -f group_vars/all/variables.template ]; then
echo "template file(group_vars/all/variables.template) does not exists! exiting ..."
exit 1
else
cp -f group_vars/all/variables.template group_vars/all/variables.yml
sed -i "s/CHANGE_ME_TO_FQDN/${soctoolsproxy}/g" group_vars/all/variables.yml
sed -i "s/soctools.test/${domain}/g" group_vars/all/variables.yml
sed -i "11s/soc_admin/${firstname}/" group_vars/all/variables.yml
sed -i "12s/SOC/${lastname}/" group_vars/all/variables.yml
sed -i "13s/soc_admin/${username}/" group_vars/all/variables.yml
sed -i "14s/soc_admin/${username}/" group_vars/all/variables.yml
sed -i "15s/SOC_Admin/${DN}/" group_vars/all/variables.yml
sed -i "16s/SOC_Admin/${CN}/" group_vars/all/variables.yml
sed -i "26s/soc_admin/${username}/" group_vars/all/variables.yml
echo
echo
echo "variables file generated (group_vars/all/variables.yml)"
sleep 2
echo "move to next command to deploy the soctools cluster."
echo 'Thank You!'
fi
else
echo "Exiting based of user input ..."
exit 0
fi
fi
--- ---
soctoolsproxy: "CHANGE_ME_TO_FQDN"
maxmind_key: "" maxmind_key: ""
docker_build_dir: "{{playbook_dir}}/build" docker_build_dir: "{{playbook_dir}}/build"
...@@ -15,6 +13,12 @@ suffix: a20201004 ...@@ -15,6 +13,12 @@ suffix: a20201004
kibana_plugins_version: "v0.7" kibana_plugins_version: "v0.7"
THEHIVE_KIBANA_USER:
username: "kibana"
name: "Kibana"
surname: "User"
roles: '["read", "write"]'
haproxy_name: "soctools-haproxy" haproxy_name: "soctools-haproxy"
haproxy_version: "2.2" haproxy_version: "2.2"
haproxy_img: "{{repo}}/haproxy:{{version}}{{suffix}}" haproxy_img: "{{repo}}/haproxy:{{version}}{{suffix}}"
......
---
# set FQDN which will be used to access the soctools services. (the DNS record should already be in place.)
soctoolsproxy: "CHANGE_ME_TO_FQDN"
# Organization's top level domain (will be used as organization name and organization domain in different services)
domain: "soctools.test"
#List of users which will be created during the initialization with organization admin privileges
soctools_users:
- firstname: "soc_admin"
lastname: "SOC"
username: "soc_admin"
email: "soc_admin@{{domain}}"
DN: "CN=SOC_Admin"
CN: "SOC_Admin"
# - firstname: "soc_admin_2"
# lastname: "SOC"
# username: "soc_admin_2"
# email: "soc_admin_2@{{domain}}"
# DN: "CN=SOC_Admin_2"
# CN: "SOC_Admin_2"
# list of users(username) from previous step which will recive admin roles in ODFE. (Minimum one user is required)
ODFE_ADMIN_USERS:
- soc_admin
# - soc_admin_2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment