modifié : bts_annee_2/sisr2/seance_03/README.md
nouveau fichier : bts_annee_2/sisr2/seance_03/inst-hb1.sh nouveau fichier : bts_annee_2/sisr2/seance_03/inst-hb2.sh
This commit is contained in:
		@@ -1 +1 @@
 | 
			
		||||
Vagrantfiles de la troisième séance en SISR.
 | 
			
		||||
Vagrantfiles de la troisième séance en SISR, et scripts pour le heartbeat.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										49
									
								
								bts_annee_2/sisr2/seance_03/inst-hb1.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								bts_annee_2/sisr2/seance_03/inst-hb1.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
# les bases 
 | 
			
		||||
#  noeud hb1  : 192.168.0.101 
 | 
			
		||||
#  noeud hb2  : 192.168.0.102 
 | 
			
		||||
#  addr virt. : 192.168.0.103 
 | 
			
		||||
    
 | 
			
		||||
sed -i 's/bookworm/hb1/g' /etc/host{s,name}
 | 
			
		||||
apt update
 | 
			
		||||
apt install -y heartbeat apache2 net-tools
 | 
			
		||||
systemctl disable apache2
 | 
			
		||||
 | 
			
		||||
cat <<EOT> /etc/network/interfaces.d/enp0s3
 | 
			
		||||
allow-hotplug enp0s3
 | 
			
		||||
iface enp0s3 inet static
 | 
			
		||||
address 192.168.0.101/24 # a adapter pour hb2
 | 
			
		||||
EOT
 | 
			
		||||
 | 
			
		||||
cat <<EOT> /etc/network/interfaces.d/enp0s8
 | 
			
		||||
allow-hotplug enp0s8
 | 
			
		||||
iface enp0s8 inet static
 | 
			
		||||
address 10.0.0.1/24      # a adapter pour hb2
 | 
			
		||||
EOT
 | 
			
		||||
 | 
			
		||||
cd /usr/share/doc/heartbeat
 | 
			
		||||
gunzip *.gz
 | 
			
		||||
cp ha.cf /etc/ha.d
 | 
			
		||||
cp haresources /etc/ha.d
 | 
			
		||||
cp authkeys /etc/ha.d
 | 
			
		||||
cd /etc/ha.d
 | 
			
		||||
echo "192.168.0.102 hb2" >> /etc/hosts # a adapter pour hb2
 | 
			
		||||
 | 
			
		||||
cat <<EOT >> /etc/ha.d/ha.cf
 | 
			
		||||
bcast enp0s8
 | 
			
		||||
node hb1
 | 
			
		||||
node hb2
 | 
			
		||||
pacemaker off
 | 
			
		||||
EOT
 | 
			
		||||
 | 
			
		||||
# echo " hb1 192.168.0.103 apache2" >> /etc/ha.d/haresources pou Debian buster
 | 
			
		||||
echo " hb1 192.168.0.103/24/enp0s3 apache2" >> /etc/ha.d/haresources 
 | 
			
		||||
 | 
			
		||||
cat <<EOT >> /etc/ha.d/authkeys
 | 
			
		||||
auth 1
 | 
			
		||||
1 crc
 | 
			
		||||
EOT
 | 
			
		||||
 | 
			
		||||
chmod 600 /etc/ha.d/authkeys
 | 
			
		||||
echo hb1 > /var/www/html/index.html # a adapter pour hb2
 | 
			
		||||
 #
 | 
			
		||||
							
								
								
									
										49
									
								
								bts_annee_2/sisr2/seance_03/inst-hb2.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								bts_annee_2/sisr2/seance_03/inst-hb2.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
# les bases 
 | 
			
		||||
#  noeud hb1  : 192.168.0.101 
 | 
			
		||||
#  noeud hb2  : 192.168.0.102 
 | 
			
		||||
#  addr virt. : 192.168.0.103 
 | 
			
		||||
    
 | 
			
		||||
sed -i 's/bookworm/hb2/g' /etc/host{s,name}
 | 
			
		||||
apt update
 | 
			
		||||
apt install -y heartbeat apache2 net-tools
 | 
			
		||||
systemctl disable apache2
 | 
			
		||||
 | 
			
		||||
cat <<EOT> /etc/network/interfaces.d/enp0s3
 | 
			
		||||
allow-hotplug enp0s3
 | 
			
		||||
iface enp0s3 inet static
 | 
			
		||||
address 192.168.0.102/24 # a adapter pour hb2
 | 
			
		||||
EOT
 | 
			
		||||
 | 
			
		||||
cat <<EOT> /etc/network/interfaces.d/enp0s8
 | 
			
		||||
allow-hotplug enp0s8
 | 
			
		||||
iface enp0s8 inet static
 | 
			
		||||
address 10.0.0.2/24      # a adapter pour hb2
 | 
			
		||||
EOT
 | 
			
		||||
 | 
			
		||||
cd /usr/share/doc/heartbeat
 | 
			
		||||
gunzip *.gz
 | 
			
		||||
cp ha.cf /etc/ha.d
 | 
			
		||||
cp haresources /etc/ha.d
 | 
			
		||||
cp authkeys /etc/ha.d
 | 
			
		||||
cd /etc/ha.d
 | 
			
		||||
echo "192.168.0.101 hb1" >> /etc/hosts # a adapter pour hb2
 | 
			
		||||
 | 
			
		||||
cat <<EOT >> /etc/ha.d/ha.cf
 | 
			
		||||
bcast enp0s8
 | 
			
		||||
node hb1
 | 
			
		||||
node hb2
 | 
			
		||||
pacemaker off
 | 
			
		||||
EOT
 | 
			
		||||
 | 
			
		||||
# echo " hb1 192.168.0.103 apache2" >> /etc/ha.d/haresources pou Debian buster
 | 
			
		||||
echo " hb1 192.168.0.103/24/enp0s3 apache2" >> /etc/ha.d/haresources 
 | 
			
		||||
 | 
			
		||||
cat <<EOT >> /etc/ha.d/authkeys
 | 
			
		||||
auth 1
 | 
			
		||||
1 crc
 | 
			
		||||
EOT
 | 
			
		||||
 | 
			
		||||
chmod 600 /etc/ha.d/authkeys
 | 
			
		||||
echo hb2 > /var/www/html/index.html # a adapter pour hb2
 | 
			
		||||
 #
 | 
			
		||||
		Reference in New Issue
	
	Block a user