renommé : bts_annee_2/sisr2/seance_03/inst-hb1.sh -> bts_annee_2/sisr2/seance_03/hb1/inst-hb1.sh renommé : bts_annee_2/sisr2/seance_03/inst-hb2.sh -> bts_annee_2/sisr2/seance_03/hb2/inst-hb2.sh renommé : bts_annee_2/sisr2/seance_03/Vagrantfile_bookworm -> bts_annee_2/sisr2/seance_03/vagrant/Vagrantfile_bookworm renommé : bts_annee_2/sisr2/seance_03/Vagrantfile_rsync -> bts_annee_2/sisr2/seance_03/vagrant/Vagrantfile_rsync
		
			
				
	
	
		
			50 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
#!/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
 | 
						||
 #
 |