forked from rh-ecosystem-edge/enclave
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync.sh
More file actions
executable file
·81 lines (66 loc) · 3.12 KB
/
sync.sh
File metadata and controls
executable file
·81 lines (66 loc) · 3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash -e
set -o pipefail
set -e
getValue(){
python -c 'import sys, yaml, json; print(json.dumps(yaml.safe_load(sys.stdin)))' < $global_vars \
| jq -r $1
}
global_vars=${1:-config/global.yaml}
certs_vars=${2:-config/certificates.yaml}
workingDir=$(getValue .workingDir)
lck=~/.lck-rh-lz
DSTAMP=$(date +%Y%m%d_%H%M%S)
logdir=${workingDir}/logs
log="$logdir/${DSTAMP}"
_cleanup(){
rm -fr "${lck}"
}
echo " "
echo " ██████╗░███████╗██████╗░ ██╗░░██╗░█████╗░████████╗"
echo " ██╔══██╗██╔════╝██╔══██╗ ██║░░██║██╔══██╗╚══██╔══╝"
echo " ██████╔╝█████╗░░██║░░██║ ███████║███████║░░░██║░░░"
echo " ██╔══██╗██╔══╝░░██║░░██║ ██╔══██║██╔══██║░░░██║░░░"
echo " ██║░░██║███████╗██████╔╝ ██║░░██║██║░░██║░░░██║░░░"
echo " ╚═╝░░╚═╝╚══════╝╚═════╝░ ╚═╝░░╚═╝╚═╝░░╚═╝░░░╚═╝░░░"
echo " "
echo "This script is designed to be re-run on demand "
echo "NOTE: Some functions will reuse local caches "
if [ -e ${lck} ]; then
echo "Existing lock ${lck} found, exiting"
exit 1
fi
touch ${lck}
trap _cleanup EXIT
echo 'Runtime Host:'
cat /etc/redhat-release
echo ' - '
if ! [[ $(</etc/os-release) =~ CPE_NAME=\"cpe:/o:redhat:enterprise_linux:10(\.?.*)?\" ]]; then
echo "RHEL 10 Check Failed"
exit 1
fi
mkdir -p "$(dirname $log)"
date > "$log"
echo -p "Check Config .. " -n1 -s | tee -a ${log}
FList="ansible.cfg bootstrap.sh playbooks/main.yaml playbooks/ \
setup_ansible.sh setup_env.sh $global_vars $certs_vars"
for x in $FList; do
if [ -e $x ]; then
echo "file check passed ..." $x | tee -a ${log}
else
echo "Config missing : " $x | tee -a ${log}
fi
done
echo -e "\e[38;5;10m Done...\033[0m"; date
echo -p "Validating Config .. " -n1 -s | tee -a ${log}
ansible-playbook playbooks/validate-schema.yaml -e@$global_vars -e@$certs_vars --tags schema-validation 2>&1 | tee -a ${log}
bash ./validations.sh $global_vars $certs_vars 2>&1 | tee -a ${log}
echo -e "\e[38;5;10m Done...\033[0m"; date
echo -p "Building local cache .. " -n1 -s
ansible-playbook playbooks/02-mirror.yaml -e@$global_vars -e@$certs_vars --tags mirror-registry 2>&1 | tee -a ${log}
echo -e "\e[38;5;10m Done...\033[0m"; date
echo -p "Quay disconnected .." -n1 -s
ansible-playbook playbooks/06-day2.yaml -e@$global_vars -e@$certs_vars --tags quay-disconnected 2>&1 | tee -a ${log}
echo -e "\e[38;5;10m Done...\033[0m"; date
echo -p "ACM ClusterImageSets .." -n1 -s
ansible-playbook playbooks/06-day2.yaml -e@$global_vars -e@$certs_vars --tags acm-cis 2>&1 | tee -a ${log}
echo -e "\e[38;5;10m Done...\033[0m"; date