/[sysadmin-cookbook]/recepies/ganeti/migrate-lxc/B-ganeti-network-interfaces.sh
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /recepies/ganeti/migrate-lxc/B-ganeti-network-interfaces.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 306 - (hide annotations)
Sun Jan 12 13:39:28 2014 UTC (10 years, 4 months ago) by dpavlin
File MIME type: application/x-sh
File size: 836 byte(s)
migrate lxc container to ganeti
1 dpavlin 306 #!/bin/sh -xe
2    
3     . ./0-host.sh
4     . ./0-lxc.sh
5     . ./0-ganeti.sh
6    
7     ssh_lxc cat /var/lib/lxc/$host/config | grep ipv4 | tee $host/ipv4
8     public_ip=`grep 193.198 rt/ipv4 | cut -d= -f2 | cut -d/ -f1 | sed 's/ *//'`
9     local_ip=` grep 10.60 rt/ipv4 | cut -d= -f2 | cut -d/ -f1 | sed 's/ *//'`
10    
11     tee /tmp/network-interfaces-$host << __INTERFACES__
12     auto eth0 eth1 lo
13    
14     iface lo inet loopback
15    
16     iface eth0 inet static
17     address $public_ip
18     netmask 255.255.254.0
19     gateway 193.198.212.1
20    
21     iface eth1 inet static
22     address $local_ip
23     netmask 255.255.254.0
24     __INTERFACES__
25    
26     # this will backup file on original machine which is still running!
27     ping -c 1 $host && ssh_master chroot /tmp/$host bak add,commit /etc/network/interfaces
28    
29     scp /tmp/network-interfaces-$host root@$master:/tmp/
30    
31     ssh_master mv -v /tmp/network-interfaces-$host /tmp/$host/etc/network/interfaces

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26