Skip to content

Commit f13ad00

Browse files
Tests création serveurs infra et OL7.3
La création du serveur master et d'infra ont été testés de bout en bout. Test avec Oracle Linux 7.3 échec : impossible d'installer le grid, java plante. README.md Précise de ne pas utiliser OL7.3 configure_global.cfg.sh Refuse une configuration avec OL7.3 BUG : prise en compte du nom de domaine réellement utilisé : dns/gen_backup_dns_script.sh dns/get_free_ip_node.sh dns/show_dns.sh dns/test_ip_node_used.sh dns/install/03_configure.sh global.cfg Ajout variable : OL7_LABEL Corrections de bugs/régression découverts durant les tests de création du serveur master et d'infra. setup_first_vms/01_prepare_master_vm.sh setup_first_vms/02_update_config.sh setup_first_vms/03_setup_infra_vm.sh setup_first_vms/vbox_scripts/00_create_install_iso.sh setup_first_vms/vbox_scripts/02_install_vm_infra.sh ssh/cleaning_known_hosts.sh yum/backup_infra_repository.sh yum/init_infra_repository.sh yum/sync_oracle_repository.sh validate_config.sh change_infra_config.sh Permet de changer toutes les variables permettant de construire un autre réseau de VMs.
1 parent ac807eb commit f13ad00

18 files changed

Lines changed: 185 additions & 125 deletions

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,13 @@ Si vous avez une configuration inférieure n'y pensez même pas.
4040
### Télécharger les logiciels suivants :
4141

4242
* VirtualBox : `zypper install [...]` ou `yum install [...]` ou `apt-get install [...]` en fonction de la distribution.
43-
44-
Testé uniquement avec openSUSE (tumbleweed).
4543

46-
* Oracle Linux 7 : uniquement l'ISO [V100082-01.iso](https://edelivery.oracle.com/osdc/faces/SearchSoftware) est nécessaire. Rechercher Linux 7, puis décocher les autres ISO.
44+
* Oracle Linux 7.2 : uniquement la première image ISO [V100082-01.iso](https://edelivery.oracle.com/osdc/faces/SearchSoftware) est nécessaire.
45+
46+
Rechercher Oracle Linux 7.2, puis décocher les autres ISO.
47+
48+
L'image de l'ISO Oracle Linux 7.3 ne fonctionne pas (V834394-01.iso), java plante lors de l'installation. En partant d'une 7.2
49+
je mets à jour sur une 7.3 mais en conservant le noyau linux 3.8.
4750

4851
* [Oracle Database 12c & Grid Infrastructure 12c](http://www.oracle.com/technetwork/database/enterprise-edition/downloads/database12c-linux-download-2240591.html)
4952

configure_global.cfg.sh

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,23 @@ do
3434
esac
3535
done
3636

37-
if [ 0 -eq 1 ]; then
38-
typeset hostvm_type=undef
39-
info "Select hypervisor :"
40-
info " 1 : vbox for linux"
41-
while [ 0 -eq 0 ] # forever
42-
do
43-
read -s -n 1 keyboard
44-
case $keyboard in
45-
1) LN
46-
info "==> VirtualBox for Linux"
47-
hostvm_type=linux_virtualbox
48-
full_linux_iso_n="$HOME/ISO/oracle_linux_7/V100082-01.iso"
49-
break
50-
;;
37+
typeset -r hostvm_type=linux_virtualbox
5138

52-
*) error "$keyboard invalid."
53-
;;
54-
esac
55-
done
56-
LN
57-
else
58-
hostvm_type=linux_virtualbox
59-
full_linux_iso_n="$HOME/ISO/oracle_linux_7/V100082-01.iso"
60-
fi # [ 0 -eq 1 ]; then
39+
# ============================================================================
40+
# Pré sélection de l'image Oracle Linux 7
41+
typeset -r OracleLinux72=V100082-01.iso
42+
typeset -r OracleLinux73=V834394-01.iso
43+
44+
full_linux_iso_n="$HOME/ISO/oracle_linux_7/$OracleLinux72"
45+
OL7_LABEL_n=7.2
46+
47+
if [ 0 -eq 1 ]; then
48+
# Oracle Linux 7.3 ne fonctionne pas du tout, java par en core dump plus autre
49+
# joyeusetées.
50+
full_linux_iso_n="$HOME/ISO/oracle_linux_7/$OracleLinux73"
51+
OL7_LABEL_n=7.3
52+
fi
53+
# ============================================================================
6154

6255
# $1 nom de la variable à renseigner
6356
# $2 Message à afficher
@@ -98,14 +91,16 @@ function read_dns_main_ip
9891
test_if_cmd_exists VBoxManage
9992
if [ $? -eq 0 ]
10093
then
101-
vm_p="$(VBoxManage list systemproperties | grep "Default machine folder:" | tr -s [:space:] | cut -d' ' -f4-)"
94+
vm_p="$(VBoxManage list systemproperties |\
95+
grep "Default machine folder:" |\
96+
tr -s [:space:] | cut -d' ' -f4-)"
10297
ask_for_variable vm_p "VMs folder :"
10398
else
10499
error "VirtualBox not installed or VBoxManage not in PATH"
105100
LN
106101
fi
107102

108-
ask_for_variable full_linux_iso_n "Full path for Oracle Linux 7 ISO (...V100082-01.iso) :"
103+
ask_for_variable full_linux_iso_n "Full path for Oracle Linux $OL7_LABEL_n ISO $OracleLinux72 :"
109104

110105
dns_main_n=$(read_dns_main_ip)
111106
ask_for_variable dns_main_n "Main DNS/box IP :"
@@ -127,8 +122,22 @@ LN
127122
exec_cmd "sed -i 's~vm_path=.*$~vm_path=\"$vm_p\"~g' ~/plescripts/global.cfg"
128123
LN
129124

125+
if [ "$HOME/ISO/oracle_linux_7/$OracleLinux73" == "$full_linux_iso_n" ]
126+
then
127+
OL7_LABEL_n=7.3
128+
line_separator
129+
error "Oracle Linux $OL7_LABEL_n don't work."
130+
error "Latest tested Release is Oracle Linux 7.2 ISO : $OracleLinux72"
131+
LN
132+
exit 1
133+
else
134+
OL7_LABEL_n=7.2
135+
fi
136+
137+
info "Setup Oracle Linux $OL7_LABEL_n"
130138
iso_path=${full_linux_iso_n%/*}
131139
iso_name=${full_linux_iso_n##*/}
140+
exec_cmd "sed -i 's/OL7_LABEL=.*/OL7_LABEL=$OL7_LABEL_n/g' ~/plescripts/global.cfg"
132141
exec_cmd "sed -i 's~iso_olinux_path=.*$~iso_olinux_path=\"$iso_path\"~g' ~/plescripts/global.cfg"
133142
exec_cmd "sed -i 's~full_linux_iso_name=.*$~full_linux_iso_name=\"\$iso_olinux_path/$iso_name\"~g' ~/plescripts/global.cfg"
134143
LN

dns/gen_backup_dns_script.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ EXEC_CMD_ACTION=EXEC
77
echo "#!/bin/bash" > ~/plescripts/tmp/restore_dns.sh
88
echo "cd ~/plescripts/dns" >> ~/plescripts/tmp/restore_dns.sh
99

10+
typeset -r domain=$(hostname -d)
11+
1012
# Trié par rapport à l'ip node.
11-
cat /var/named/named.orcl |\
12-
grep "^[[:alpha:]].*" |\
13-
grep -v localhost |\
14-
sort -n -t "." -k 4 |\
13+
cat /var/named/named.$domain |\
14+
grep "^[[:alpha:]].*" |\
15+
grep -v localhost |\
16+
sort -n -t "." -k 4 |\
1517
while read server_name f2 f3 server_ip
1618
do
1719
echo "./add_server_2_dns.sh -name=$server_name -ip=$server_ip -not_restart_named"

dns/get_free_ip_node.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@ do
4747
esac
4848
done
4949

50+
typeset -r domain=$(hostname -d)
5051
typeset -i prev_ip_node=0
5152
typeset -i ip_found=0
5253

5354
while read ip_node rem
5455
do
55-
[ $ip_node -lt $min_ip_node ] && continue
56+
[[ x"$ip_node" == x || $ip_node -lt $min_ip_node ]] && continue
5657

5758
debug "IP used is $ip_node"
5859
if [ $prev_ip_node -eq 0 ]
@@ -88,9 +89,9 @@ do
8889
prev_ip_node=$ip_node
8990

9091
[ "$DEBUG_MODE" == ENABLE ] && LN
91-
done<<<"$(cat /var/named/reverse.orcl |\
92-
grep "^[0-9]" |\
93-
grep -v arpa |\
92+
done<<<"$(cat /var/named/reverse.$domain |\
93+
grep "^[0-9]" |\
94+
grep -v arpa |\
9495
sort -n)"
9596

9697
[ "$DEBUG_MODE" == ENABLE ] && LN

dns/install/03_configure.sh

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ case $EXEC_CMD_ACTION in
5656
;;
5757
esac
5858

59-
typeset -r hostn=$(hostname -s)
60-
typeset -r domain_name=$(hostname -d)
61-
6259
IFS='.' read ip1 ip2 ip3 rem<<<"$dns_ip"
6360
typeset -r reversed_network="$ip3.$ip2.$ip1"
6461

@@ -67,37 +64,35 @@ typeset -r name_domain_template=~/plescripts/dns/install/config_template/named.d
6764
typeset -r reverse_domain_template=~/plescripts/dns/install/config_template/reverse.domain.template
6865

6966
typeset -r named_conf=$etc_path/named.conf
70-
typeset -r named_domain=$var_named_path/named.${domain_name}
71-
typeset -r reverse_domain=$var_named_path/reverse.${domain_name}
67+
typeset -r named_domain=$var_named_path/named.${infra_domain}
68+
typeset -r reverse_domain=$var_named_path/reverse.${infra_domain}
7269

7370
info "DNS :"
74-
info " server $hostn"
71+
info " server $infra_hostname"
7572
info " ip $dns_ip"
76-
info " domain $domain_name"
73+
info " domain $infra_domain"
7774
info " reversed $reversed_network"
7875
LN
7976

80-
[ x"$domain_name" = x ] && error "Vérifier la configuration de /etc/hostname" && exit 1
81-
8277
info "Configuration de $named_conf :"
8378
copy $named_conf_template $named_conf
8479
replace DNS_IP $dns_ip $named_conf
85-
replace DOMAIN_NAME $domain_name $named_conf
80+
replace DOMAIN_NAME $infra_domain $named_conf
8681
replace REVERSED_NETWORK $reversed_network $named_conf
8782
replace MY_NETWORK $infra_network $named_conf
8883
replace MY_MASK $if_pub_prefix $named_conf
8984
LN
9085

9186
info "Configuration de $named_domain"
9287
copy $name_domain_template $named_domain
93-
replace DNS_NAME $hostn $named_domain
94-
replace DNS_IP $dns_ip $named_domain
88+
replace DNS_NAME $infra_hostname $named_domain
89+
replace DNS_IP $dns_ip $named_domain
9590
LN
9691

9792
info "Configuration de $reverse_domain"
9893
copy $reverse_domain_template $reverse_domain
99-
replace DNS_NAME $hostn $reverse_domain
100-
replace DOMAIN_NAME $domain_name $reverse_domain
94+
replace DNS_NAME $infra_hostname $reverse_domain
95+
replace DOMAIN_NAME $infra_domain $reverse_domain
10196
replace REVERSED_NETWORK $reversed_network $reverse_domain
10297
replace DNS_IP_NODE $dns_ip_node $reverse_domain
10398
LN

dns/show_dns.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33

44
. ~/plescripts/plelib.sh
55

6+
typeset -r domain=$(hostname -d)
7+
68
typeset -r horizontal_separator=$( fill "~" $(( 18 + 1 + 1 + 1 + 15)) )
79
info $horizontal_separator
810
info "$(printf "%-18s | %s" "Server" "ip")"
911
info $horizontal_separator
1012

1113
# Trié par rapport à l'ip node.
12-
cat /var/named/named.orcl |\
13-
grep "^[[:alpha:]].*" |\
14-
grep -v localhost |\
15-
sort -n -t "." -k 4 |\
14+
cat /var/named/named.$domain |\
15+
grep "^[[:alpha:]].*" |\
16+
grep -v localhost |\
17+
sort -n -t "." -k 4 |\
1618
while read server_name f2 f3 server_ip
1719
do
1820
info "$(printf "%-18s | %s" $server_name $server_ip)"

dns/test_ip_node_used.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@ case $1 in
1818
;;
1919
esac
2020

21-
cat /var/named/named.orcl | grep -Eq "^[a-z].*\.$1$"
21+
typeset -r domain=$(hostname -d)
22+
23+
cat /var/named/named.$domain | grep -Eq "^[a-z].*\.$1$"
2224
[ $? -eq 0 ] && exit 1 || exit 0

global.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ typeset -r iso_olinux_path="/home/kangs/ISO/oracle_linux_7"
5858
# Nom complet de l'ISO ol7.
5959
# Variable mise à jour par le script configure_global.cfg.sh
6060
typeset -r full_linux_iso_name="$iso_olinux_path/V100082-01.iso"
61+
typeset -r OL7_LABEL=7.2
6162

6263
# Répertoire de l'ISO kickstart
6364
typeset -r iso_ks_olinux_path="$iso_olinux_path/KS_ISO"
@@ -71,7 +72,7 @@ typeset -r master_ks_cfg="$HOME/plescripts/setup_first_vms/vbox_scripts/master-k
7172
typeset -r infra_olinux_repository_path=/repo/OracleLinux
7273

7374
# latest | R3 | R4
74-
# L'activation des dépôts R3 our R4 entraînent pas mal de problèmes.
75+
# L'activation du dépôt R4 entraîne pas mal de problèmes.
7576
typeset -r default_yum_repository_release=R3
7677

7778
# ============================================================================

setup_first_vms/01_prepare_master_vm.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@ must_be_executed_on_server "$master_hostname"
1515
# Ce script doit être exécuté uniquement si le serveur d'infra existe.
1616

1717
line_separator
18+
exec_cmd nmcli connection show
19+
# xargs supprimme les éventuelles espaces de début et/ou de fin.
20+
conn_name="$(nmcli connection show | grep $if_pub_name | cut -d\ -f1-2 | xargs)"
21+
info "Connection name : $conn_name"
1822
info "Update Iface $if_pub_name :"
1923
# Le serveur sera cloné, il ne faut donc pas d'adresse mac ou d'uuid de définie.
20-
exec_cmd nmcli connection modify System\\\ $if_pub_name \
24+
exec_cmd nmcli connection modify "'$conn_name'" \
2125
ipv4.method manual \
2226
ipv4.addresses $master_ip/$if_pub_prefix \
2327
ipv4.dns $dns_ip \

setup_first_vms/02_update_config.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ exec_cmd "cat ~/plescripts/setup_first_vms/for_inputrc /etc/inputrc > new_inputr
3131
exec_cmd mv new_inputrc /etc/inputrc
3232
LN
3333

34-
line_separator
35-
info "Remove samba."
36-
exec_cmd yum -y -q erase samba-client.x86_64 samba-client-libs.x86_64 samba-common.noarch samba-common-libs.x86_64 samba-common-tools.x86_64 samba-libs.x86_64
37-
LN
38-
3934
if test_if_rpm_update_available
4035
then
4136
exec_cmd yum -y -q update

0 commit comments

Comments
 (0)