Merge lp:~thomnico/orange-box/mirror-dev into lp:orange-box
- mirror-dev
- Merge into trunk
Status: | Needs review |
---|---|
Proposed branch: | lp:~thomnico/orange-box/mirror-dev |
Merge into: | lp:orange-box |
Diff against target: |
2555 lines (+747/-727) 42 files modified
debian/changelog (+73/-11) debian/control (+13/-8) debian/install (+3/-0) debian/links (+1/-1) debian/postinst (+0/-310) debian/postrm (+0/-23) debian/preinst (+0/-136) debian/source/format (+1/-1) etc/apache2/sites-available/archive.conf (+0/-13) etc/apache2/sites-available/archive.ubuntu.com.conf (+14/-0) etc/apache2/sites-available/cdimage.ubuntu.com.conf (+14/-0) etc/apache2/sites-available/cloud-images.ubuntu.com.conf (+14/-0) etc/apache2/sites-available/ports.ubuntu.com.conf (+14/-0) etc/apache2/sites-available/releases.ubuntu.com.conf (+14/-0) etc/apache2/sites-available/ubuntu-cloud.archive.canonical.com.conf (+12/-0) etc/apache2/sites-available/ubuntu-cloud.conf (+0/-12) etc/apt/orange-box-mirror.list (+43/-20) etc/bind/named.conf.wildcard-archive (+6/-0) etc/bind/zones.wildcard-archive (+20/-0) etc/cron.d/charmstore-mirror (+0/-4) etc/cron.d/orange-box-mirror (+0/-1) etc/debconf-selections (+0/-2) etc/orangebox-mirror.state (+1/-0) etc/ucloudexclude.list (+26/-0) usr/bin/orange-box-add-node (+7/-4) usr/bin/orange-box-add-physical-nodes (+7/-2) usr/bin/orange-box-add-virtual-nodes (+24/-12) usr/bin/orange-box-amt-monitor (+3/-1) usr/bin/orange-box-apm-power-fix (+0/-38) usr/bin/orange-box-bootstrap-juju (+5/-1) usr/bin/orange-box-create-package-mirror (+14/-1) usr/bin/orange-box-demo-cleanup (+3/-1) usr/bin/orange-box-hacks (+32/-0) usr/bin/orange-box-mirror (+235/-0) usr/bin/orange-box-purge-everything (+1/-0) usr/bin/orange-box-resetproxy (+34/-0) usr/bin/orange-box-run (+21/-18) usr/bin/orange-box-setup-nat (+0/-99) usr/bin/orange-box-status-all-nodes (+11/-8) usr/lib/orange-box/templates/mirror-bind/named.conf.template (+6/-0) usr/lib/orange-box/templates/mirror-bind/zones.template (+17/-0) usr/lib/orange-box/templates/ubumirror.conf (+58/-0) |
To merge this branch: | bzr merge lp:~thomnico/orange-box/mirror-dev |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Orange Box | Pending | ||
Review via email: mp+264038@code.launchpad.net |
Commit message
Description of the change
This branch (include 2.9 modif new net as not accepted yet) ..
It add orange-box-mirror cli to sync/enable etc mirroring most of the software used.
- 546. By Nicolas Thomas
-
Fix zone issue
Fix ssh-keyscan for maas asking user intervention - 547. By Nicolas Thomas
-
fix default to em1 for internal_interface
- 548. By Nicolas Thomas
-
Rebase on ~cpe-sa/
orange- box/staging for collaborating with other SAs * Enable local mirroring
* Reduce the number of dns redirects
* remove dep on ubumirror and do a faster sync to cloud-images
* use lftp instead of apt-mirror for cloud-archive
[ Nicolas Thomas ]
* Adding support for mirror
Unmerged revisions
- 548. By Nicolas Thomas
-
Rebase on ~cpe-sa/
orange- box/staging for collaborating with other SAs * Enable local mirroring
* Reduce the number of dns redirects
* remove dep on ubumirror and do a faster sync to cloud-images
* use lftp instead of apt-mirror for cloud-archive
[ Nicolas Thomas ]
* Adding support for mirror - 547. By Nicolas Thomas
-
fix default to em1 for internal_interface
- 546. By Nicolas Thomas
-
Fix zone issue
Fix ssh-keyscan for maas asking user intervention - 545. By Nicolas Thomas
-
updates on ssh maas to ubuntu automation
modified:
debian/changelog
usr/bin/orange- box-add- virtual- nodes - 544. By Nicolas Thomas
-
releasing 2.9~ppa2
- 543. By Nicolas Thomas
-
Update source/format so zbr-buildpackages works
make ssh works correctly in add-virutal-nodesmodified:
debian/source/ format
usr/bin/orange- box-add- virtual- nodes - 542. By Nicolas Thomas
-
releasing 2.9~ppa1
- 541. By Nicolas Thomas
-
releasing 2.8~ppa1
- 540. By Nicolas Thomas
-
* Add biosdevname cmd in scripts
* Add a check/heal for VMs powermanagement ssh keys
* - 539. By Nicolas Thomas
-
releasing 2.8ubuntu1~trusty
Preview Diff
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2015-01-21 22:04:42 +0000 | |||
3 | +++ debian/changelog 2015-07-17 17:14:52 +0000 | |||
4 | @@ -1,20 +1,82 @@ | |||
15 | 1 | orange-box (1.90) unreleased; urgency=medium | 1 | orange-box (2.10~ppa6) UNRELEASED; urgency=medium |
16 | 2 | 2 | ||
17 | 3 | * etc/apt/orange-box-mirror.list, usr/bin/orange-box-create-package- | 3 | * Enable local mirroring |
18 | 4 | mirror: | 4 | * Reduce the number of dns redirects |
19 | 5 | - we're not currently using postmirror.sh, so set to /bin/true | 5 | * remove dep on ubumirror and do a faster sync to cloud-images |
20 | 6 | 6 | * use lftp instead of apt-mirror for cloud-archive | |
21 | 7 | -- Dustin Kirkland <kirkland@ubuntu.com> Fri, 09 Jan 2015 11:13:51 -0600 | 7 | |
22 | 8 | 8 | -- Nicolas Thomas <nicolas.thomas@canonical.com> Mon, 15 Jun 2015 23:24:05 +0200 | |
23 | 9 | orange-box (1.89-0ubuntu1) vivid; urgency=medium | 9 | |
24 | 10 | 10 | orange-box (2.9ubuntu1~trusty) trusty; urgency=medium | |
25 | 11 | |||
26 | 12 | * Change source/format for bzr-buildpackage to work | ||
27 | 13 | * Fix issue with the ssh checking for power management of VMs | ||
28 | 14 | * | ||
29 | 15 | * | ||
30 | 16 | |||
31 | 17 | -- Nicolas Thomas <nicolas.thomas@canonical.com> Mon, 15 Jun 2015 13:32:06 +0200 | ||
32 | 18 | |||
33 | 19 | orange-box (2.9-0ubuntu1) trusty; urgency=medium | ||
34 | 20 | |||
35 | 21 | * Add biosdevname cmd in scripts | ||
36 | 22 | * Add a check/heal for VMs powermanagement ssh keys | ||
37 | 23 | * | ||
38 | 24 | |||
39 | 25 | -- Nicolas Thomas <nicolas.thomas@canonical.com> Mon, 15 Jun 2015 10:40:23 +0200 | ||
40 | 26 | |||
41 | 27 | orange-box (2.8ubuntu1~trusty-0ubuntu1) trusty; urgency=medium | ||
42 | 28 | |||
43 | 29 | [ Nicolas Thomas ] | ||
44 | 30 | * Remove synccharmstore etc.. | ||
45 | 31 | * Adapt a number of changes to network setup etc.. | ||
46 | 32 | * Assume ob number in preinst and check in postinst in case network is not up | ||
47 | 33 | * preinst bridgeutils | ||
48 | 34 | |||
49 | 35 | -- Nicolas Thomas <nicolas.thomas@canonical.com> Thu, 11 Jun 2015 20:59:08 +0200 | ||
50 | 36 | |||
51 | 37 | orange-box (2.7) trusty; urgency=medium | ||
52 | 38 | |||
53 | 39 | [ Takenori Matsumoto ] | ||
54 | 40 | * usr/bin/orange-box-setup-nat: | ||
55 | 41 | - Fix net.ipv4.conf.all.accept_redirects | ||
56 | 42 | * usr/bin/orange-box-add-virtual-node | ||
57 | 43 | - Fix Add maas's ssh key into /home/ubuntu/.ssh/authorized_keys so that MAAS can control power via virsh | ||
58 | 44 | |||
59 | 45 | -- Takenori Matsumoto <takenori.matsumoto@canonical.com> Fri, 02 May 2015 14:13:51 -0600 | ||
60 | 46 | |||
61 | 47 | orange-box (2.6) trusty; urgency=medium | ||
62 | 48 | |||
63 | 49 | [ Takenori Matsumoto ] | ||
64 | 50 | * Re-write pachtes based on PPA (orange-box_1.89-0ubuntu1~trusty.debian.tar.xz, orange-box_1.89.orig.tar.gz) rather than trunk codes | ||
65 | 51 | |||
66 | 52 | [ takenori ] | ||
67 | 53 | * usr/bin/orange-box-add-virtual-nodes: | ||
68 | 54 | * usr/bin/orange-box-add-virtual-nodes: | ||
69 | 55 | * usr/bin/orange-box-add-virtual-nodes: | ||
70 | 56 | * : | ||
71 | 57 | |||
72 | 58 | -- Takenori Matsumoto <takenori.matsumoto@canonical.com> Fri, 02 May 2015 01:13:51 -0600 | ||
73 | 59 | |||
74 | 60 | orange-box (1.90-0mirror-0ubuntu1) utopic; urgency=medium | ||
75 | 61 | |||
76 | 62 | [ Nicolas Thomas ] | ||
77 | 63 | * Adding support for mirror | ||
78 | 64 | |||
79 | 65 | -- thomas <nicolas.thomas@canonical.com> Sat, 17 Jan 2015 00:31:37 +0100 | ||
80 | 66 | |||
81 | 67 | orange-box (1.89-0ubuntu1~trusty) trusty; urgency=medium | ||
82 | 68 | |||
83 | 69 | [ Dustin Kirkland ] | ||
84 | 11 | * usr/bin/orange-box-bootstrap-juju: | 70 | * usr/bin/orange-box-bootstrap-juju: |
85 | 12 | - go back to --upload-tools, please keep this! | 71 | - go back to --upload-tools, please keep this! |
86 | 13 | * usr/bin/orange-box-add-virtual-nodes: | 72 | * usr/bin/orange-box-add-virtual-nodes: |
87 | 14 | - use ~maas rather than hard coding to /home/maas | 73 | - use ~maas rather than hard coding to /home/maas |
88 | 15 | + note that maas 1.7 has created a home directory in /var/lib/maas | 74 | + note that maas 1.7 has created a home directory in /var/lib/maas |
89 | 16 | 75 | ||
91 | 17 | -- Dustin Kirkland <kirkland@ubuntu.com> Fri, 09 Jan 2015 11:13:49 -0600 | 76 | [ takenori ] |
92 | 77 | * : | ||
93 | 78 | |||
94 | 79 | -- Dustin Kirkland <kirkland@ubuntu.com> Wed, 29 Oct 2014 09:58:53 -0500 | ||
95 | 18 | 80 | ||
96 | 19 | orange-box (1.88-0ubuntu1) unstable; urgency=medium | 81 | orange-box (1.88-0ubuntu1) unstable; urgency=medium |
97 | 20 | 82 | ||
98 | 21 | 83 | ||
99 | === modified file 'debian/control' | |||
100 | --- debian/control 2014-09-24 12:15:15 +0000 | |||
101 | +++ debian/control 2015-07-17 17:14:52 +0000 | |||
102 | @@ -3,13 +3,17 @@ | |||
103 | 3 | Priority: optional | 3 | Priority: optional |
104 | 4 | Maintainer: Dustin Kirkland <kirkland@ubuntu.com> | 4 | Maintainer: Dustin Kirkland <kirkland@ubuntu.com> |
105 | 5 | Build-Depends: debhelper (>= 7.0.50~), | 5 | Build-Depends: debhelper (>= 7.0.50~), |
107 | 6 | Standards-Version: 3.9.4 | 6 | Standards-Version: 3.9.5 |
108 | 7 | Homepage: http://launchpad.net/orange-box | 7 | Homepage: http://launchpad.net/orange-box |
109 | 8 | 8 | ||
110 | 9 | Package: orange-box | 9 | Package: orange-box |
111 | 10 | Architecture: all | 10 | Architecture: all |
112 | 11 | Pre-Depends: | 11 | Pre-Depends: |
114 | 12 | run-one, | 12 | run-one, |
115 | 13 | maas, | ||
116 | 14 | maas-cluster-controller, | ||
117 | 15 | nmap, | ||
118 | 16 | bridge-utils, | ||
119 | 13 | Depends: ${misc:Depends}, | 17 | Depends: ${misc:Depends}, |
120 | 14 | amtterm, | 18 | amtterm, |
121 | 15 | apache2, | 19 | apache2, |
122 | @@ -27,10 +31,7 @@ | |||
123 | 27 | libglib2.0-bin, | 31 | libglib2.0-bin, |
124 | 28 | libvirt-bin, | 32 | libvirt-bin, |
125 | 29 | openssh-server, | 33 | openssh-server, |
126 | 30 | maas, | ||
127 | 31 | maas-cluster-controller, | ||
128 | 32 | network-manager, | 34 | network-manager, |
129 | 33 | nmap, | ||
130 | 34 | pastebinit, | 35 | pastebinit, |
131 | 35 | qemu-kvm, | 36 | qemu-kvm, |
132 | 36 | remmina, | 37 | remmina, |
133 | @@ -43,12 +44,16 @@ | |||
134 | 43 | vlan, | 44 | vlan, |
135 | 44 | wsmancli, | 45 | wsmancli, |
136 | 45 | x11vnc, | 46 | x11vnc, |
139 | 46 | Recommends: | 47 | biosdevname, |
140 | 47 | landscape-client, | 48 | lftp, |
141 | 49 | rsync, | ||
142 | 50 | simplestreams, | ||
143 | 48 | python-keystone, | 51 | python-keystone, |
144 | 49 | python-neutronclient, | 52 | python-neutronclient, |
145 | 50 | python-novaclient, | 53 | python-novaclient, |
147 | 51 | python-glanceclient | 54 | python-glanceclient, |
148 | 55 | Recommends: | ||
149 | 56 | landscape-client, | ||
150 | 52 | Description: Orange Box master node easy installation | 57 | Description: Orange Box master node easy installation |
151 | 53 | This package can be installed on an Ubuntu Orange Box's master node | 58 | This package can be installed on an Ubuntu Orange Box's master node |
152 | 54 | to automatically configure MAAS and Juju. | 59 | to automatically configure MAAS and Juju. |
153 | 55 | 60 | ||
154 | === added file 'debian/install' | |||
155 | --- debian/install 1970-01-01 00:00:00 +0000 | |||
156 | +++ debian/install 2015-07-17 17:14:52 +0000 | |||
157 | @@ -0,0 +1,3 @@ | |||
158 | 1 | etc/ | ||
159 | 2 | home/ | ||
160 | 3 | usr/ | ||
161 | 0 | 4 | ||
162 | === modified file 'debian/links' | |||
163 | --- debian/links 2014-05-08 23:10:25 +0000 | |||
164 | +++ debian/links 2015-07-17 17:14:52 +0000 | |||
165 | @@ -1,1 +1,1 @@ | |||
167 | 1 | /usr/bin/orange-box-setup-nat /etc/network/if-up.d/orange-box-setup-nat | 1 | |
168 | 2 | 2 | ||
169 | === added file 'debian/postinst' | |||
170 | --- debian/postinst 1970-01-01 00:00:00 +0000 | |||
171 | +++ debian/postinst 2015-07-17 17:14:52 +0000 | |||
172 | @@ -0,0 +1,332 @@ | |||
173 | 1 | #!/bin/bash | ||
174 | 2 | |||
175 | 3 | set -e | ||
176 | 4 | set -x | ||
177 | 5 | |||
178 | 6 | PKG="orange-box" | ||
179 | 7 | RETRY=120 | ||
180 | 8 | |||
181 | 9 | . /usr/lib/orange-box/inc/common | ||
182 | 10 | . /etc/orange-box.conf | ||
183 | 11 | |||
184 | 12 | check_orangebox_number() { | ||
185 | 13 | ## be sure to wake AMT first give some time and ping again. | ||
186 | 14 | nmap -p 16992 -oG - 172.27.${orangebox_number}.11-20 > /dev/null | ||
187 | 15 | sleep 12 | ||
188 | 16 | nmap -p 16992 -oG - 172.27.${orangebox_number}.11-20 > /dev/null | ||
189 | 17 | NUMAMTS=`nmap -p 16992 -oG - 172.27.${orangebox_number}.11-20 |grep open |wc -l` | ||
190 | 18 | [[ $NUMAMTS < 3 ]] && (echo "AMT or hostname not set correctly"; rm -f /etc/orange-box.conf;exit 2) | ||
191 | 19 | true | ||
192 | 20 | } | ||
193 | 21 | |||
194 | 22 | |||
195 | 23 | router_ip=172.27.${orangebox_number}.1 | ||
196 | 24 | static_low=172.27.`expr ${orangebox_number} + 2`.1 | ||
197 | 25 | static_high=172.27.`expr ${orangebox_number} + 2`.254 | ||
198 | 26 | dhcp_low=172.27.`expr ${orangebox_number} + 1`.1 | ||
199 | 27 | dhcp_high=172.27.`expr ${orangebox_number} + 1`.254 | ||
200 | 28 | br0_broadcast=172.27.`expr ${orangebox_number} + 3`.255 | ||
201 | 29 | |||
202 | 30 | setup_maas_admin() { | ||
203 | 31 | # Configure the MAAS admin user | ||
204 | 32 | # Sadly, there's no way to test if the user has been created already, | ||
205 | 33 | # so ignore errors for idempotence | ||
206 | 34 | maas-region-admin createadmin --username admin --email maas-admin@example.com --password="admin" 2>/dev/null || true | ||
207 | 35 | . /etc/maas/maas_cluster.conf | ||
208 | 36 | APIKEY=$(maas-region-admin apikey --username admin | tail -n1) | ||
209 | 37 | maas login admin $MAAS_URL $APIKEY | ||
210 | 38 | } | ||
211 | 39 | |||
212 | 40 | setup_maas_networking() { | ||
213 | 41 | count=0 | ||
214 | 42 | while ! maas admin node-group-interfaces list $CLUSTER_UUID >/dev/null 2>&1; do | ||
215 | 43 | count=$((count+1)) | ||
216 | 44 | sleep 1 | ||
217 | 45 | if [ $count -gt $RETRY ]; then | ||
218 | 46 | error "[maas admin node-group-interfaces list] failed [$RETRY] times" | ||
219 | 47 | fi | ||
220 | 48 | done | ||
221 | 49 | internal_interface=$(route -n | grep "^172\.27\.${orangebox_number}\." | sed -e "s/.* //") | ||
222 | 50 | # Support MAAS 1.5, and 1.6 | ||
223 | 51 | maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}') | ||
224 | 52 | if dpkg --compare-versions $maas_ver lt 1.6; then | ||
225 | 53 | maas admin node-group-interface update $CLUSTER_UUID $internal_interface ip_range_low=$static_low ip_range_high=$static_high management=2 broadcast_ip=$br0_broadcast router_ip=$router_ip | ||
226 | 54 | |||
227 | 55 | else | ||
228 | 56 | sh -x /var/lib/dpkg/info/maas-dns.postinst configure | ||
229 | 57 | run-one-until-success maas admin node-group-interface update $CLUSTER_UUID $internal_interface ip_range_low=$dhcp_low ip_range_high=$dhcp_high static_ip_range_low=$static_low static_ip_range_high=$static_high management=2 broadcast_ip=$br0_broadcast router_ip=$router_ip | ||
230 | 58 | |||
231 | 59 | fi | ||
232 | 60 | # Setup nat | ||
233 | 61 | # Ensure we have an external connection | ||
234 | 62 | orange-box-test-uplink | ||
235 | 63 | orange-box-setup-nat | ||
236 | 64 | # Redirect to MAAS web interface | ||
237 | 65 | cat >/var/www/html/index.html <<EOF | ||
238 | 66 | <meta http-equiv="refresh" content="0; url=/MAAS"> | ||
239 | 67 | EOF | ||
240 | 68 | } | ||
241 | 69 | |||
242 | 70 | setup_dns() { | ||
243 | 71 | # Set MAAS upstream DNS | ||
244 | 72 | maas admin maas set-config name=upstream_dns value=172.27.252.1 | ||
245 | 73 | sed -i -e "/^nameserver ${router_ip}$/d" /etc/resolvconf/resolv.conf.d/head | ||
246 | 74 | echo "nameserver ${router_ip}" >> /etc/resolvconf/resolv.conf.d/head | ||
247 | 75 | resolvconf -u | ||
248 | 76 | sed -e 's/dnssec-validation auto;/dnssec-enable no;dnssec-validation no;/g' -i /etc/bind/named.conf.options | ||
249 | 77 | } | ||
250 | 78 | |||
251 | 79 | setup_squid() { | ||
252 | 80 | maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}') | ||
253 | 81 | if dpkg --compare-versions $maas_ver lt 1.6; then | ||
254 | 82 | # This is now a transparent proxy | ||
255 | 83 | if [ -d "/etc/squid-deb-proxy" ]; then | ||
256 | 84 | echo > /etc/squid-deb-proxy/squid-deb-proxy.conf | ||
257 | 85 | fi | ||
258 | 86 | cat /usr/lib/orange-box/inc/squid.conf > /etc/squid3/squid.conf | ||
259 | 87 | # Enable squid3, disable squid-deb-proxy | ||
260 | 88 | update-rc.d -f squid-deb-proxy remove || true | ||
261 | 89 | invoke-rc.d squid-deb-proxy stop || true | ||
262 | 90 | # Create directories, if necessary | ||
263 | 91 | squid3 -z -N || true | ||
264 | 92 | ensure_running squid3 | ||
265 | 93 | fi | ||
266 | 94 | true | ||
267 | 95 | } | ||
268 | 96 | |||
269 | 97 | setup_local_mirror() { | ||
270 | 98 | # Set up the local mirror | ||
271 | 99 | # a2ensite archive | ||
272 | 100 | # a2ensite ubuntu-cloud | ||
273 | 101 | # Must enable this to make sstream and others works | ||
274 | 102 | a2ensite 000-default | ||
275 | 103 | mkdir -p /srv/mirrors/archive.ubuntu.com | ||
276 | 104 | echo '<meta http-equiv="refresh" content="0; url=MAAS/">' > /srv/mirrors/archive.ubuntu.com/index.html | ||
277 | 105 | invoke-rc.d apache2 stop || true | ||
278 | 106 | invoke-rc.d apache2 start | ||
279 | 107 | } | ||
280 | 108 | |||
281 | 109 | setup_boot_resources() { | ||
282 | 110 | # Importing boot resources | ||
283 | 111 | # This might take a long time. | ||
284 | 112 | # MAAS won't work very well until this is done, so we're going to block | ||
285 | 113 | # until this completes. | ||
286 | 114 | orange-box-test-uplink | ||
287 | 115 | # Support MAAS 1.5, and newer | ||
288 | 116 | maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}') | ||
289 | 117 | if dpkg --compare-versions $maas_ver lt 1.6; then | ||
290 | 118 | cat /usr/lib/orange-box/inc/bootresources_1.5.yaml > /etc/maas/bootresources.yaml | ||
291 | 119 | run-this-one maas-import-pxe-files --config-file /etc/maas/bootresources.yaml | ||
292 | 120 | else | ||
293 | 121 | maas admin boot-resources import | ||
294 | 122 | while [ $(maas admin boot-images read $CLUSTER_UUID | wc -l) -lt 10 ]; do | ||
295 | 123 | # Waiting for images to download | ||
296 | 124 | sleep 10 | ||
297 | 125 | done | ||
298 | 126 | # add precise to the list but don't wait it is not necessary now. | ||
299 | 127 | # usual failure is already there.. | ||
300 | 128 | maas admin boot-source-selections create 1 os="ubuntu" release="precise" arches="amd64" subarches="*" labels="*" || true | ||
301 | 129 | maas admin boot-resources import | ||
302 | 130 | fi | ||
303 | 131 | } | ||
304 | 132 | |||
305 | 133 | setup_desktop() { | ||
306 | 134 | sudo -u ubuntu dbus-launch gsettings set org.gnome.desktop.background picture-uri file:///usr/share/orange-box/orange-box-background.png | ||
307 | 135 | sudo -u ubuntu dbus-launch gsettings set com.canonical.Unity.Launcher favorites "['firefox.desktop', 'byobu.desktop', 'remmina.desktop']" | ||
308 | 136 | sudo -u ubuntu dbus-launch gsettings set org.gnome.desktop.session idle-delay 999999 | ||
309 | 137 | sudo -u ubuntu dbus-launch gsettings set org.gnome.desktop.screensaver idle-activation-enabled false | ||
310 | 138 | sudo -u ubuntu dbus-launch gsettings set org.gnome.desktop.screensaver lock-enabled false | ||
311 | 139 | if [ -e /etc/lightdm/lightdm.conf ]; then | ||
312 | 140 | sed -i -e "/autologin-user=/d" /etc/lightdm/users.conf | ||
313 | 141 | echo "autologin-user=ubuntu" >> /etc/lightdm/users.conf | ||
314 | 142 | fi | ||
315 | 143 | echo "enabled=0" > /etc/default/apport | ||
316 | 144 | invoke-rc.d apport stop || true | ||
317 | 145 | } | ||
318 | 146 | |||
319 | 147 | setup_ssh_keys() { | ||
320 | 148 | # Disable remote password authentication, since our username/password | ||
321 | 149 | # combo is very well known | ||
322 | 150 | if ! grep -qs "^PasswordAuthentication no" /etc/ssh/sshd_config 2>/dev/null; then | ||
323 | 151 | echo "PasswordAuthentication no" >> /etc/ssh/sshd_config | ||
324 | 152 | invoke-rc.d ssh stop || true | ||
325 | 153 | invoke-rc.d ssh start | ||
326 | 154 | fi | ||
327 | 155 | if [ ! -e /home/ubuntu/.ssh/id_rsa ]; then | ||
328 | 156 | su -l ubuntu -c "ssh-keygen -N '' -f /home/ubuntu/.ssh/id_rsa" | ||
329 | 157 | fi | ||
330 | 158 | maas admin sshkeys new key="$(cat /home/ubuntu/.ssh/id_rsa.pub)" || true | ||
331 | 159 | if ! grep -qs "^Host.*maas$" /home/ubuntu/.ssh/config; then | ||
332 | 160 | cat <<EOF >>/home/ubuntu/.ssh/config | ||
333 | 161 | |||
334 | 162 | Host *.maas | ||
335 | 163 | UserKnownHostsFile /dev/null | ||
336 | 164 | StrictHostKeyChecking no | ||
337 | 165 | CheckHostIP no | ||
338 | 166 | |||
339 | 167 | EOF | ||
340 | 168 | fi | ||
341 | 169 | chmod 600 /home/ubuntu/.ssh/config | ||
342 | 170 | chown -R ubuntu:ubuntu /home/ubuntu/.ssh/config | ||
343 | 171 | |||
344 | 172 | } | ||
345 | 173 | |||
346 | 174 | setup_juju() { | ||
347 | 175 | mkdir -p /home/ubuntu/.juju | ||
348 | 176 | cat >/home/ubuntu/.juju/environments.yaml <<EOF | ||
349 | 177 | default: maas | ||
350 | 178 | environments: | ||
351 | 179 | maas: | ||
352 | 180 | type: maas | ||
353 | 181 | maas-server: 'http://${router_ip}/MAAS/' | ||
354 | 182 | maas-oauth: '$APIKEY' | ||
355 | 183 | default-series: trusty | ||
356 | 184 | #enable-os-upgrade: false | ||
357 | 185 | authorized-keys-path: /home/ubuntu/.ssh/id_rsa.pub | ||
358 | 186 | admin-secret: 'admin' | ||
359 | 187 | logging-config: '<root>=DEBUG' | ||
360 | 188 | lxc-clone: true | ||
361 | 189 | EOF | ||
362 | 190 | rm -rf /home/ubuntu/.juju-plugins | ||
363 | 191 | git clone https://github.com/juju/plugins /home/ubuntu/.juju-plugins | ||
364 | 192 | sudo chown -R ubuntu:ubuntu /home/ubuntu/ | ||
365 | 193 | echo "PATH=\$PATH:/home/ubuntu/.juju-plugins:/home/ubuntu/Examples/bin" >> /home/ubuntu/.bashrc | ||
366 | 194 | #Required for local charm deployments to work. | ||
367 | 195 | sed -i -e '/^export JUJU_REPOSITORY=/d' /home/ubuntu/.bashrc | ||
368 | 196 | } | ||
369 | 197 | |||
370 | 198 | ensure_running() { | ||
371 | 199 | job="$1" | ||
372 | 200 | count=1 | ||
373 | 201 | while true; do | ||
374 | 202 | if (service $job status | grep -qs "running"); then | ||
375 | 203 | break | ||
376 | 204 | fi | ||
377 | 205 | invoke-rc.d $job start | ||
378 | 206 | sleep 1 | ||
379 | 207 | count=$((count+1)) | ||
380 | 208 | if [ $count -gt $RETRY ]; then | ||
381 | 209 | error "[$job] refused to start [$RETRY] times" | ||
382 | 210 | fi | ||
383 | 211 | done | ||
384 | 212 | } | ||
385 | 213 | |||
386 | 214 | ensure_running_maas() { | ||
387 | 215 | maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}') | ||
388 | 216 | if dpkg --compare-versions $maas_ver lt 1.6; then | ||
389 | 217 | ensure_running maas-region-celery | ||
390 | 218 | ensure_running maas-cluster-celery | ||
391 | 219 | ensure_running maas-txlongpoll | ||
392 | 220 | ensure_running maas-pserv | ||
393 | 221 | ensure_running maas-dhcp-server | ||
394 | 222 | ensure_running squid3 | ||
395 | 223 | else | ||
396 | 224 | ensure_running apache2 | ||
397 | 225 | ensure_running maas-clusterd | ||
398 | 226 | ensure_running maas-dhcpd | ||
399 | 227 | ensure_running maas-proxy | ||
400 | 228 | fi | ||
401 | 229 | invoke-rc.d tgt stop || true | ||
402 | 230 | invoke-rc.d tgt start | ||
403 | 231 | ensure_running tgt | ||
404 | 232 | } | ||
405 | 233 | |||
406 | 234 | setup_all_nodes() { | ||
407 | 235 | # Ensure that pxe and dhcp are running | ||
408 | 236 | ensure_running_maas | ||
409 | 237 | maas admin node-groups import-boot-images | ||
410 | 238 | orange-box-add-physical-nodes | ||
411 | 239 | orange-box-add-virtual-nodes | ||
412 | 240 | } | ||
413 | 241 | |||
414 | 242 | apply_patches() { | ||
415 | 243 | # This is a DISGUSTING HACK that needs to go away | ||
416 | 244 | # as soon as MAAS ships these fixes | ||
417 | 245 | cd / | ||
418 | 246 | cat /usr/lib/orange-box/patches/acquire_languages_none.patch | patch -p0 -N || true | ||
419 | 247 | maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}') | ||
420 | 248 | if dpkg --compare-versions $maas_ver lt 1.6; then | ||
421 | 249 | cat /usr/lib/orange-box/patches/arp_ip_order.patch | patch -p0 -N || true | ||
422 | 250 | cat /usr/lib/orange-box/patches/try_amt_harder.patch | patch -p0 -N || true | ||
423 | 251 | rm -f /usr/lib/python2.7/dist-packages/provisioningserver/utils/__init__.pyc | ||
424 | 252 | invoke-rc.d maas-cluster-celery stop || true | ||
425 | 253 | invoke-rc.d maas-cluster-celery start | ||
426 | 254 | fi | ||
427 | 255 | cd - | ||
428 | 256 | } | ||
429 | 257 | |||
430 | 258 | setup_landscape() { | ||
431 | 259 | # The master node will be managed by Landscape | ||
432 | 260 | # TODO: this is currently hardcoded to our own landscape account | ||
433 | 261 | if which landscape-config; then | ||
434 | 262 | case "$(hostname)" in | ||
435 | 263 | OrangeBox*|orangebox*) | ||
436 | 264 | landscape-config -a canonical-orange -t "$(hostname)__$(dmidecode -s baseboard-serial-number)" -p ubuntu-aubergine --script-users=ALL --silent --include-manager-plugins=ScriptExecution || true | ||
437 | 265 | ;; | ||
438 | 266 | esac | ||
439 | 267 | fi | ||
440 | 268 | } | ||
441 | 269 | |||
442 | 270 | setup_examples() { | ||
443 | 271 | mkdir -p /home/ubuntu | ||
444 | 272 | if [ -d /home/ubuntu/Examples/.bzr ]; then | ||
445 | 273 | bzr pull >/dev/null 2>&1 || true | ||
446 | 274 | elif [ -d /home/ubuntu/Examples ]; then | ||
447 | 275 | mv -f /home/ubuntu/Examples /home/ubuntu/.Examples | ||
448 | 276 | bzr branch lp:orange-box-examples /home/ubuntu/Examples >/dev/null 2>&1 || true | ||
449 | 277 | else | ||
450 | 278 | bzr branch lp:orange-box-examples /home/ubuntu/Examples >/dev/null 2>&1 || true | ||
451 | 279 | fi | ||
452 | 280 | chown -R ubuntu:ubuntu /home/ubuntu | ||
453 | 281 | } | ||
454 | 282 | |||
455 | 283 | case "$1" in | ||
456 | 284 | configure) | ||
457 | 285 | check_orangebox_number | ||
458 | 286 | setup_desktop | ||
459 | 287 | ###apply_patches | ||
460 | 288 | setup_maas_admin | ||
461 | 289 | setup_dns | ||
462 | 290 | if [ -n "$2" ]; then | ||
463 | 291 | echo | ||
464 | 292 | echo "INFO: Skipping importing boot resources, since this is a package upgrade" | ||
465 | 293 | echo "INFO: If you want to update boot resources, run:" | ||
466 | 294 | echo "INFO: sudo maas-import-pxe-files" | ||
467 | 295 | echo "INFO: sudo maas admin node-groups import-boot-images" | ||
468 | 296 | echo | ||
469 | 297 | else | ||
470 | 298 | setup_boot_resources | ||
471 | 299 | fi | ||
472 | 300 | setup_maas_networking | ||
473 | 301 | maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}') | ||
474 | 302 | if dpkg --compare-versions $maas_ver lt 1.6; then | ||
475 | 303 | setup_squid | ||
476 | 304 | fi | ||
477 | 305 | setup_local_mirror | ||
478 | 306 | setup_ssh_keys | ||
479 | 307 | setup_juju | ||
480 | 308 | if [ -n "$2" ]; then | ||
481 | 309 | echo | ||
482 | 310 | echo "INFO: Skipping adding all nodes, since this is a package upgrade" | ||
483 | 311 | echo "INFO: If you want to delete and add all nodes again, run:" | ||
484 | 312 | echo "INFO: sudo orange-box-add-physical-nodes" | ||
485 | 313 | echo "INFO: sudo orange-box-add-virtual-nodes" | ||
486 | 314 | echo | ||
487 | 315 | else | ||
488 | 316 | # Only add all nodes and configure landscape on initial install, not upgrades | ||
489 | 317 | setup_landscape | ||
490 | 318 | setup_all_nodes | ||
491 | 319 | fi | ||
492 | 320 | # setup_examples | ||
493 | 321 | ;; | ||
494 | 322 | abort-upgrade|abort-remove|abort-deconfigure) | ||
495 | 323 | ;; | ||
496 | 324 | *) | ||
497 | 325 | echo "postinst called with unknown argument \`$1'" >&2 | ||
498 | 326 | exit 1 | ||
499 | 327 | ;; | ||
500 | 328 | esac | ||
501 | 329 | |||
502 | 330 | #DEBHELPER# | ||
503 | 331 | |||
504 | 332 | exit 0 | ||
505 | 0 | 333 | ||
506 | === removed file 'debian/postinst' | |||
507 | --- debian/postinst 2014-11-27 23:56:37 +0000 | |||
508 | +++ debian/postinst 1970-01-01 00:00:00 +0000 | |||
509 | @@ -1,310 +0,0 @@ | |||
510 | 1 | #!/bin/sh | ||
511 | 2 | |||
512 | 3 | set -e | ||
513 | 4 | set -x | ||
514 | 5 | |||
515 | 6 | PKG="orange-box" | ||
516 | 7 | RETRY=120 | ||
517 | 8 | |||
518 | 9 | . /usr/lib/orange-box/inc/common | ||
519 | 10 | |||
520 | 11 | setup_maas_admin() { | ||
521 | 12 | # Configure the MAAS admin user | ||
522 | 13 | # Sadly, there's no way to test if the user has been created already, | ||
523 | 14 | # so ignore errors for idempotence | ||
524 | 15 | maas-region-admin createadmin --username admin --email maas-admin@example.com --password="admin" 2>/dev/null || true | ||
525 | 16 | . /etc/maas/maas_cluster.conf | ||
526 | 17 | APIKEY=$(maas-region-admin apikey --username admin | tail -n1) | ||
527 | 18 | maas login admin $MAAS_URL $APIKEY | ||
528 | 19 | } | ||
529 | 20 | |||
530 | 21 | setup_maas_networking() { | ||
531 | 22 | count=0 | ||
532 | 23 | while ! maas admin node-group-interfaces list $CLUSTER_UUID >/dev/null 2>&1; do | ||
533 | 24 | count=$((count+1)) | ||
534 | 25 | sleep 1 | ||
535 | 26 | if [ $count -gt $RETRY ]; then | ||
536 | 27 | error "[maas admin node-group-interfaces list] failed [$RETRY] times" | ||
537 | 28 | fi | ||
538 | 29 | done | ||
539 | 30 | internal_interface=$(route -n | grep "^10\.14\." | sed -e "s/.* //") | ||
540 | 31 | # Support MAAS 1.5, and 1.6 | ||
541 | 32 | maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}') | ||
542 | 33 | if dpkg --compare-versions $maas_ver lt 1.6; then | ||
543 | 34 | maas admin node-group-interface update $CLUSTER_UUID $internal_interface ip_range_low=10.14.100.1 ip_range_high=10.14.199.254 management=2 broadcast_ip=10.14.255.255 router_ip=10.14.4.1 | ||
544 | 35 | else | ||
545 | 36 | sh -x /var/lib/dpkg/info/maas-dns.postinst configure | ||
546 | 37 | run-one-until-success maas admin node-group-interface update $CLUSTER_UUID $internal_interface ip_range_low=10.14.50.1 ip_range_high=10.14.99.254 static_ip_range_low=10.14.100.1 static_ip_range_high=10.14.199.254 management=2 broadcast_ip=10.14.255.255 router_ip=10.14.4.1 | ||
547 | 38 | fi | ||
548 | 39 | # Setup nat | ||
549 | 40 | # Ensure we have an external connection | ||
550 | 41 | orange-box-test-uplink | ||
551 | 42 | orange-box-setup-nat | ||
552 | 43 | # Redirect to MAAS web interface | ||
553 | 44 | cat >/var/www/html/index.html <<EOF | ||
554 | 45 | <meta http-equiv="refresh" content="0; url=/MAAS"> | ||
555 | 46 | EOF | ||
556 | 47 | } | ||
557 | 48 | |||
558 | 49 | setup_dns() { | ||
559 | 50 | # Set MAAS upstream DNS | ||
560 | 51 | external_interface=$(ip route ls | grep ^default | awk '{print $5}') | ||
561 | 52 | dns=$(nmcli d list iface $external_interface | grep -m 1 "^IP4.DNS" | awk '{ print $2 }') | ||
562 | 53 | maas admin maas set-config name=upstream_dns value=$dns | ||
563 | 54 | sed -i -e "/^nameserver 10.14.4.1$/d" /etc/resolvconf/resolv.conf.d/head | ||
564 | 55 | echo "nameserver 10.14.4.1" >> /etc/resolvconf/resolv.conf.d/head | ||
565 | 56 | resolvconf -u | ||
566 | 57 | sed -e 's/dnssec-validation auto;/dnssec-enable no;dnssec-validation no;/g' -i /etc/bind/named.conf.options | ||
567 | 58 | } | ||
568 | 59 | |||
569 | 60 | setup_squid() { | ||
570 | 61 | maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}') | ||
571 | 62 | if dpkg --compare-versions $maas_ver lt 1.6; then | ||
572 | 63 | # This is now a transparent proxy | ||
573 | 64 | if [ -d "/etc/squid-deb-proxy" ]; then | ||
574 | 65 | echo > /etc/squid-deb-proxy/squid-deb-proxy.conf | ||
575 | 66 | fi | ||
576 | 67 | cat /usr/lib/orange-box/inc/squid.conf > /etc/squid3/squid.conf | ||
577 | 68 | # Disable squid3, enable squid-deb-proxy | ||
578 | 69 | update-rc.d -f squid-deb-proxy remove || true | ||
579 | 70 | invoke-rc.d squid-deb-proxy stop || true | ||
580 | 71 | # Create directories, if necessary | ||
581 | 72 | squid3 -z -N || true | ||
582 | 73 | ensure_running squid3 | ||
583 | 74 | fi | ||
584 | 75 | true | ||
585 | 76 | } | ||
586 | 77 | |||
587 | 78 | setup_local_mirror() { | ||
588 | 79 | # Set up the local mirror | ||
589 | 80 | a2ensite archive | ||
590 | 81 | a2ensite ubuntu-cloud | ||
591 | 82 | a2dissite 000-default | ||
592 | 83 | mkdir -p /srv/mirrors/archive.ubuntu.com | ||
593 | 84 | echo '<meta http-equiv="refresh" content="0; url=MAAS/">' > /srv/mirrors/archive.ubuntu.com/index.html | ||
594 | 85 | invoke-rc.d apache2 stop || true | ||
595 | 86 | invoke-rc.d apache2 start | ||
596 | 87 | # Sync the charm store to /srv/charmstore | ||
597 | 88 | # Note: This is going to take a LONG time | ||
598 | 89 | orange-box-sync-charmstore & | ||
599 | 90 | } | ||
600 | 91 | |||
601 | 92 | setup_boot_resources() { | ||
602 | 93 | # Importing boot resources | ||
603 | 94 | # This might take a long time. | ||
604 | 95 | # MAAS won't work very well until this is done, so we're going to block | ||
605 | 96 | # until this completes. | ||
606 | 97 | orange-box-test-uplink | ||
607 | 98 | # Support MAAS 1.5, and newer | ||
608 | 99 | maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}') | ||
609 | 100 | if dpkg --compare-versions $maas_ver lt 1.6; then | ||
610 | 101 | cat /usr/lib/orange-box/inc/bootresources_1.5.yaml > /etc/maas/bootresources.yaml | ||
611 | 102 | run-this-one maas-import-pxe-files --config-file /etc/maas/bootresources.yaml | ||
612 | 103 | else | ||
613 | 104 | maas admin boot-resources import | ||
614 | 105 | while [ $(maas admin boot-images read $CLUSTER_UUID | wc -l) -lt 10 ]; do | ||
615 | 106 | # Waiting for images to download | ||
616 | 107 | sleep 10 | ||
617 | 108 | done | ||
618 | 109 | fi | ||
619 | 110 | } | ||
620 | 111 | |||
621 | 112 | setup_desktop() { | ||
622 | 113 | sudo -u ubuntu dbus-launch gsettings set org.gnome.desktop.background picture-uri file:///usr/share/orange-box/orange-box-background.png | ||
623 | 114 | sudo -u ubuntu dbus-launch gsettings set com.canonical.Unity.Launcher favorites "['firefox.desktop', 'byobu.desktop', 'remmina.desktop']" | ||
624 | 115 | sudo -u ubuntu dbus-launch gsettings set org.gnome.desktop.session idle-delay 999999 | ||
625 | 116 | sudo -u ubuntu dbus-launch gsettings set org.gnome.desktop.screensaver idle-activation-enabled false | ||
626 | 117 | sudo -u ubuntu dbus-launch gsettings set org.gnome.desktop.screensaver lock-enabled false | ||
627 | 118 | if [ -e /etc/lightdm/lightdm.conf ]; then | ||
628 | 119 | sed -i -e "/autologin-user=/d" /etc/lightdm/users.conf | ||
629 | 120 | echo "autologin-user=ubuntu" >> /etc/lightdm/users.conf | ||
630 | 121 | fi | ||
631 | 122 | echo "enabled=0" > /etc/default/apport | ||
632 | 123 | invoke-rc.d apport stop || true | ||
633 | 124 | } | ||
634 | 125 | |||
635 | 126 | setup_ssh_keys() { | ||
636 | 127 | # Disable remote password authentication, since our username/password | ||
637 | 128 | # combo is very well known | ||
638 | 129 | if ! grep -qs "^PasswordAuthentication no" /etc/ssh/sshd_config 2>/dev/null; then | ||
639 | 130 | echo "PasswordAuthentication no" >> /etc/ssh/sshd_config | ||
640 | 131 | invoke-rc.d ssh stop || true | ||
641 | 132 | invoke-rc.d ssh start | ||
642 | 133 | fi | ||
643 | 134 | if [ ! -e /home/ubuntu/.ssh/id_rsa ]; then | ||
644 | 135 | su -l ubuntu -c "ssh-keygen -N '' -f /home/ubuntu/.ssh/id_rsa" | ||
645 | 136 | fi | ||
646 | 137 | maas admin sshkeys new key="$(cat /home/ubuntu/.ssh/id_rsa.pub)" || true | ||
647 | 138 | if ! grep -qs "^Host.*maas$" /home/ubuntu/.ssh/config; then | ||
648 | 139 | cat <<EOF >>/home/ubuntu/.ssh/config | ||
649 | 140 | |||
650 | 141 | Host *.maas | ||
651 | 142 | UserKnownHostsFile /dev/null | ||
652 | 143 | StrictHostKeyChecking no | ||
653 | 144 | CheckHostIP no | ||
654 | 145 | |||
655 | 146 | EOF | ||
656 | 147 | fi | ||
657 | 148 | chmod 600 /home/ubuntu/.ssh/config | ||
658 | 149 | chown -R ubuntu:ubuntu /home/ubuntu/.ssh/config | ||
659 | 150 | } | ||
660 | 151 | |||
661 | 152 | setup_juju() { | ||
662 | 153 | mkdir -p /home/ubuntu/.juju | ||
663 | 154 | cat >/home/ubuntu/.juju/environments.yaml <<EOF | ||
664 | 155 | default: maas | ||
665 | 156 | environments: | ||
666 | 157 | maas: | ||
667 | 158 | type: maas | ||
668 | 159 | maas-server: 'http://10.14.4.1/MAAS/' | ||
669 | 160 | maas-oauth: '$APIKEY' | ||
670 | 161 | default-series: trusty | ||
671 | 162 | #enable-os-upgrade: false | ||
672 | 163 | authorized-keys-path: /home/ubuntu/.ssh/id_rsa.pub | ||
673 | 164 | admin-secret: 'admin' | ||
674 | 165 | logging-config: '<root>=DEBUG' | ||
675 | 166 | lxc-clone: true | ||
676 | 167 | EOF | ||
677 | 168 | rm -rf /home/ubuntu/.juju-plugins | ||
678 | 169 | git clone https://github.com/juju/plugins /home/ubuntu/.juju-plugins | ||
679 | 170 | sudo chown -R ubuntu:ubuntu /home/ubuntu/ | ||
680 | 171 | echo "PATH=\$PATH:/home/ubuntu/.juju-plugins:/home/ubuntu/Examples/bin" >> /home/ubuntu/.bashrc | ||
681 | 172 | #Required for local charm deployments to work. | ||
682 | 173 | sed -i -e '/^export JUJU_REPOSITORY=/d' /home/ubuntu/.bashrc | ||
683 | 174 | echo "export JUJU_REPOSITORY=/srv/charmstore" >> /home/ubuntu/.bashrc | ||
684 | 175 | } | ||
685 | 176 | |||
686 | 177 | ensure_running() { | ||
687 | 178 | job="$1" | ||
688 | 179 | count=1 | ||
689 | 180 | while true; do | ||
690 | 181 | if (service $job status | grep -qs "running"); then | ||
691 | 182 | break | ||
692 | 183 | fi | ||
693 | 184 | invoke-rc.d $job start | ||
694 | 185 | sleep 1 | ||
695 | 186 | count=$((count+1)) | ||
696 | 187 | if [ $count -gt $RETRY ]; then | ||
697 | 188 | error "[$job] refused to start [$RETRY] times" | ||
698 | 189 | fi | ||
699 | 190 | done | ||
700 | 191 | } | ||
701 | 192 | |||
702 | 193 | ensure_running_maas() { | ||
703 | 194 | maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}') | ||
704 | 195 | if dpkg --compare-versions $maas_ver lt 1.6; then | ||
705 | 196 | ensure_running maas-region-celery | ||
706 | 197 | ensure_running maas-cluster-celery | ||
707 | 198 | ensure_running maas-txlongpoll | ||
708 | 199 | ensure_running maas-pserv | ||
709 | 200 | ensure_running maas-dhcp-server | ||
710 | 201 | ensure_running squid3 | ||
711 | 202 | else | ||
712 | 203 | ensure_running apache2 | ||
713 | 204 | ensure_running maas-clusterd | ||
714 | 205 | ensure_running maas-dhcpd | ||
715 | 206 | ensure_running maas-proxy | ||
716 | 207 | fi | ||
717 | 208 | invoke-rc.d tgt stop || true | ||
718 | 209 | invoke-rc.d tgt start | ||
719 | 210 | ensure_running tgt | ||
720 | 211 | } | ||
721 | 212 | |||
722 | 213 | setup_all_nodes() { | ||
723 | 214 | # Ensure that pxe and dhcp are running | ||
724 | 215 | ensure_running_maas | ||
725 | 216 | maas admin node-groups import-boot-images | ||
726 | 217 | orange-box-add-physical-nodes | ||
727 | 218 | orange-box-add-virtual-nodes | ||
728 | 219 | } | ||
729 | 220 | |||
730 | 221 | apply_patches() { | ||
731 | 222 | # This is a DISGUSTING HACK that needs to go away | ||
732 | 223 | # as soon as MAAS ships these fixes | ||
733 | 224 | cd / | ||
734 | 225 | cat /usr/lib/orange-box/patches/acquire_languages_none.patch | patch -p0 -N || true | ||
735 | 226 | maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}') | ||
736 | 227 | if dpkg --compare-versions $maas_ver lt 1.6; then | ||
737 | 228 | cat /usr/lib/orange-box/patches/arp_ip_order.patch | patch -p0 -N || true | ||
738 | 229 | cat /usr/lib/orange-box/patches/try_amt_harder.patch | patch -p0 -N || true | ||
739 | 230 | rm -f /usr/lib/python2.7/dist-packages/provisioningserver/utils/__init__.pyc | ||
740 | 231 | invoke-rc.d maas-cluster-celery stop || true | ||
741 | 232 | invoke-rc.d maas-cluster-celery start | ||
742 | 233 | fi | ||
743 | 234 | cd - | ||
744 | 235 | } | ||
745 | 236 | |||
746 | 237 | setup_landscape() { | ||
747 | 238 | # The master node will be managed by Landscape | ||
748 | 239 | # TODO: this is currently hardcoded to our own landscape account | ||
749 | 240 | if which landscape-config; then | ||
750 | 241 | case "$(hostname)" in | ||
751 | 242 | OrangeBox*|orangebox*) | ||
752 | 243 | landscape-config -a canonical-orange -t "$(hostname)__$(dmidecode -s baseboard-serial-number)" -p ubuntu-aubergine --script-users=ALL --silent --include-manager-plugins=ScriptExecution || true | ||
753 | 244 | ;; | ||
754 | 245 | esac | ||
755 | 246 | fi | ||
756 | 247 | } | ||
757 | 248 | |||
758 | 249 | setup_examples() { | ||
759 | 250 | mkdir -p /home/ubuntu | ||
760 | 251 | if [ -d /home/ubuntu/Examples/.bzr ]; then | ||
761 | 252 | bzr pull >/dev/null 2>&1 || true | ||
762 | 253 | elif [ -d /home/ubuntu/Examples ]; then | ||
763 | 254 | mv -f /home/ubuntu/Examples /home/ubuntu/.Examples | ||
764 | 255 | bzr branch lp:orange-box-examples /home/ubuntu/Examples >/dev/null 2>&1 || true | ||
765 | 256 | else | ||
766 | 257 | bzr branch lp:orange-box-examples /home/ubuntu/Examples >/dev/null 2>&1 || true | ||
767 | 258 | fi | ||
768 | 259 | chown -R ubuntu:ubuntu /home/ubuntu | ||
769 | 260 | } | ||
770 | 261 | |||
771 | 262 | case "$1" in | ||
772 | 263 | configure) | ||
773 | 264 | setup_desktop | ||
774 | 265 | apply_patches | ||
775 | 266 | setup_maas_admin | ||
776 | 267 | setup_dns | ||
777 | 268 | if [ -n "$2" ]; then | ||
778 | 269 | echo | ||
779 | 270 | echo "INFO: Skipping importing boot resources, since this is a package upgrade" | ||
780 | 271 | echo "INFO: If you want to update boot resources, run:" | ||
781 | 272 | echo "INFO: sudo maas-import-pxe-files" | ||
782 | 273 | echo "INFO: sudo maas admin node-groups import-boot-images" | ||
783 | 274 | echo | ||
784 | 275 | else | ||
785 | 276 | setup_boot_resources | ||
786 | 277 | fi | ||
787 | 278 | setup_maas_networking | ||
788 | 279 | maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}') | ||
789 | 280 | if dpkg --compare-versions $maas_ver lt 1.6; then | ||
790 | 281 | setup_squid | ||
791 | 282 | fi | ||
792 | 283 | setup_local_mirror | ||
793 | 284 | setup_ssh_keys | ||
794 | 285 | setup_juju | ||
795 | 286 | if [ -n "$2" ]; then | ||
796 | 287 | echo | ||
797 | 288 | echo "INFO: Skipping adding all nodes, since this is a package upgrade" | ||
798 | 289 | echo "INFO: If you want to delete and add all nodes again, run:" | ||
799 | 290 | echo "INFO: sudo orange-box-add-physical-nodes" | ||
800 | 291 | echo "INFO: sudo orange-box-add-virtual-nodes" | ||
801 | 292 | echo | ||
802 | 293 | else | ||
803 | 294 | # Only add all nodes and configure landscape on initial install, not upgrades | ||
804 | 295 | setup_landscape | ||
805 | 296 | setup_all_nodes | ||
806 | 297 | fi | ||
807 | 298 | setup_examples | ||
808 | 299 | ;; | ||
809 | 300 | abort-upgrade|abort-remove|abort-deconfigure) | ||
810 | 301 | ;; | ||
811 | 302 | *) | ||
812 | 303 | echo "postinst called with unknown argument \`$1'" >&2 | ||
813 | 304 | exit 1 | ||
814 | 305 | ;; | ||
815 | 306 | esac | ||
816 | 307 | |||
817 | 308 | #DEBHELPER# | ||
818 | 309 | |||
819 | 310 | exit 0 | ||
820 | 311 | 0 | ||
821 | === added file 'debian/postrm' | |||
822 | --- debian/postrm 1970-01-01 00:00:00 +0000 | |||
823 | +++ debian/postrm 2015-07-17 17:14:52 +0000 | |||
824 | @@ -0,0 +1,23 @@ | |||
825 | 1 | #!/bin/sh | ||
826 | 2 | |||
827 | 3 | set -e | ||
828 | 4 | |||
829 | 5 | webserver="apache2" | ||
830 | 6 | |||
831 | 7 | case "$1" in | ||
832 | 8 | remove) | ||
833 | 9 | for i in archive ubuntu-cloud archive.ubuntu.com cdimage.ubuntu.com cloud-images.ubuntu.com ports.ubuntu.com releases.ubuntu.com ubuntu-cloud.archive.canonical.com; do | ||
834 | 10 | if [ -e "/etc/apache2/sites-enabled/${i}.conf" ]; then | ||
835 | 11 | a2dissite $i | ||
836 | 12 | fi | ||
837 | 13 | done | ||
838 | 14 | invoke-rc.d $webserver reload | ||
839 | 15 | rm -f /var/log/orange-box-mirror.log | ||
840 | 16 | # rm -rf /etc/maas | ||
841 | 17 | rm -rf /var/lib/orange-box | ||
842 | 18 | ;; | ||
843 | 19 | esac | ||
844 | 20 | |||
845 | 21 | #DEBHELPER# | ||
846 | 22 | |||
847 | 23 | exit 0 | ||
848 | 0 | 24 | ||
849 | === removed file 'debian/postrm' | |||
850 | --- debian/postrm 2014-07-17 04:12:46 +0000 | |||
851 | +++ debian/postrm 1970-01-01 00:00:00 +0000 | |||
852 | @@ -1,23 +0,0 @@ | |||
853 | 1 | #!/bin/sh | ||
854 | 2 | |||
855 | 3 | set -e | ||
856 | 4 | |||
857 | 5 | webserver="apache2" | ||
858 | 6 | |||
859 | 7 | case "$1" in | ||
860 | 8 | remove) | ||
861 | 9 | for i in archive ubuntu-cloud; do | ||
862 | 10 | if [ -e "/etc/apache2/sites-enabled/${i}.conf" ]; then | ||
863 | 11 | a2dissite $i | ||
864 | 12 | fi | ||
865 | 13 | done | ||
866 | 14 | invoke-rc.d $webserver reload | ||
867 | 15 | rm -f /var/log/orange-box-mirror.log | ||
868 | 16 | rm -rf /etc/maas | ||
869 | 17 | rm -rf /var/lib/orange-box | ||
870 | 18 | ;; | ||
871 | 19 | esac | ||
872 | 20 | |||
873 | 21 | #DEBHELPER# | ||
874 | 22 | |||
875 | 23 | exit 0 | ||
876 | 24 | 0 | ||
877 | === added file 'debian/preinst' | |||
878 | --- debian/preinst 1970-01-01 00:00:00 +0000 | |||
879 | +++ debian/preinst 2015-07-17 17:14:52 +0000 | |||
880 | @@ -0,0 +1,168 @@ | |||
881 | 1 | #!/bin/sh | ||
882 | 2 | set -e | ||
883 | 3 | set -x | ||
884 | 4 | |||
885 | 5 | get_orangebox_number() { | ||
886 | 6 | ## assume hostname as been set correctly .. will be checked in postinst | ||
887 | 7 | OBNum=`hostname | cut -c 10- -` | ||
888 | 8 | echo $OBNum | ||
889 | 9 | echo "## Script generated file, others rely, know what your doing if tempering" > /etc/orange-box.conf | ||
890 | 10 | echo "orangebox_number=$OBNum" >> /etc/orange-box.conf | ||
891 | 11 | echo "orangebox_mirror=INIT">> /etc/orange-box.conf | ||
892 | 12 | } | ||
893 | 13 | |||
894 | 14 | ### According to OB networking re-design | ||
895 | 15 | orangebox_number=`get_orangebox_number` | ||
896 | 16 | default_maas_ip=172.27.${orangebox_number}.1 | ||
897 | 17 | gateway_ip=172.27.252.1 | ||
898 | 18 | external_ip=172.27.252.${orangebox_number} | ||
899 | 19 | internal_ip=172.27.${orangebox_number}.1 | ||
900 | 20 | br0_broadcast=172.27.`expr ${orangebox_number} + 3`.255 | ||
901 | 21 | |||
902 | 22 | #unnecessary comment | ||
903 | 23 | |||
904 | 24 | preflight_checks() { | ||
905 | 25 | if [ "$(id -u ubuntu)" != "1000" ]; then | ||
906 | 26 | echo "ERROR: Read the docs; a proper OrangeBox setup requires the default user to be [ubuntu]" 1>&2 | ||
907 | 27 | exit 1 | ||
908 | 28 | fi | ||
909 | 29 | #ensure em1 is the correct name | ||
910 | 30 | biosdevname -i eth1 || (echo "biosdevname should have been run already assume it does"; true) | ||
911 | 31 | # TODO: Check that the AMTs are on static IPs | ||
912 | 32 | # TODO: Check dual hard drives, which one is which | ||
913 | 33 | # TODO: Ensure we have two interfaces, one internal, one external | ||
914 | 34 | } | ||
915 | 35 | |||
916 | 36 | setup_debconf() { | ||
917 | 37 | echo "debconf maas/default-maas-url string $default_maas_ip" | debconf-set-selections - | ||
918 | 38 | echo "debconf maas-cluster-controller/maas-url string http://${default_maas_ip}/MAAS" | debconf-set-selections - | ||
919 | 39 | echo "debconf maas/installation-note boolean true" | debconf-set-selections - | ||
920 | 40 | echo "debconf iptables-persistent/autosave_done boolean true" | debconf-set-selections - | ||
921 | 41 | echo "debconf iptables-persistent/autosave_v4 boolean true" | debconf-set-selections - | ||
922 | 42 | echo "debconf iptables-persistent/autosave_v6 boolean true" | debconf-set-selections - | ||
923 | 43 | } | ||
924 | 44 | |||
925 | 45 | setup_networking() { | ||
926 | 46 | modprobe 8021q || true | ||
927 | 47 | sed -i -e "/8021q/d" /etc/modules || true | ||
928 | 48 | echo "8021q" >> /etc/modules | ||
929 | 49 | # Set up the two network interfaces | ||
930 | 50 | external_interface=$(ip route ls | grep ^default | awk '{print $5}') | ||
931 | 51 | # TODO: ip addr ls | ||
932 | 52 | for interface in $(ifconfig -a -s | grep -v ^Iface | awk '{print $1}'); do | ||
933 | 53 | case "$interface" in | ||
934 | 54 | lo|br*|wlan*|vnet*) | ||
935 | 55 | continue | ||
936 | 56 | ;; | ||
937 | 57 | $external_interface) | ||
938 | 58 | continue | ||
939 | 59 | ;; | ||
940 | 60 | *) | ||
941 | 61 | internal_interface="$interface" | ||
942 | 62 | break | ||
943 | 63 | ;; | ||
944 | 64 | esac | ||
945 | 65 | done | ||
946 | 66 | # Set a sane default as em1 because the biosdevname should have been installed and run | ||
947 | 67 | [ -z "$internal_interface" ] && internal_interface=em1 | ||
948 | 68 | # TODO: use ip | ||
949 | 69 | default_mac=$(ifconfig "$internal_interface" | grep "^$internal_interface" | sed -e "s/.*HWaddr //") | ||
950 | 70 | # Tell NetworkManager to piss off | ||
951 | 71 | sed -i -e "/^unmanaged-devices=mac:$default_mac$/d" /etc/NetworkManager/NetworkManager.conf | ||
952 | 72 | cat >>/etc/NetworkManager/NetworkManager.conf <<EOF | ||
953 | 73 | [keyfile] | ||
954 | 74 | unmanaged-devices=mac:$default_mac | ||
955 | 75 | EOF | ||
956 | 76 | invoke-rc.d network-manager stop || true | ||
957 | 77 | invoke-rc.d network-manager start | ||
958 | 78 | cat >/etc/network/interfaces <<EOF | ||
959 | 79 | auto lo | ||
960 | 80 | iface lo inet loopback | ||
961 | 81 | |||
962 | 82 | auto $external_interface | ||
963 | 83 | iface $external_interface inet static | ||
964 | 84 | address ${external_ip} | ||
965 | 85 | netmask 255.255.252.0 | ||
966 | 86 | broadcast 172.27.255.255 | ||
967 | 87 | gateway ${gateway_ip} | ||
968 | 88 | dns-nameservers ${gateway_ip} | ||
969 | 89 | |||
970 | 90 | auto $internal_interface | ||
971 | 91 | iface $internal_interface inet manual | ||
972 | 92 | |||
973 | 93 | |||
974 | 94 | auto br0 | ||
975 | 95 | iface br0 inet static | ||
976 | 96 | address ${internal_ip} | ||
977 | 97 | netmask 255.255.252.0 | ||
978 | 98 | broadcast $br0_broadcast | ||
979 | 99 | bridge_ports $internal_interface | ||
980 | 100 | bridge_stp off | ||
981 | 101 | bridge_fd 0 | ||
982 | 102 | bridge_maxwait 0 | ||
983 | 103 | |||
984 | 104 | # VLAN 2, Uplink network | ||
985 | 105 | iface ${internal_interface}.2 inet dhcp | ||
986 | 106 | vlan-raw-device $internal_interface | ||
987 | 107 | |||
988 | 108 | # Network management alias | ||
989 | 109 | iface br0:1 inet static | ||
990 | 110 | address 10.90.90.91 | ||
991 | 111 | netmask 255.255.255.0 | ||
992 | 112 | broadcast 10.90.90.255 | ||
993 | 113 | |||
994 | 114 | EOF | ||
995 | 115 | ifdown --force $internal_interface || true | ||
996 | 116 | ifdown --force br0 || true | ||
997 | 117 | ifup $internal_interface | ||
998 | 118 | ifup br0 | ||
999 | 119 | ### Same for $external_interface | ||
1000 | 120 | ifdown --force $external_interface || true | ||
1001 | 121 | ifup $external_interface | ||
1002 | 122 | |||
1003 | 123 | # Wait a moment for the network to normalize | ||
1004 | 124 | echo "INFO: Ensure networking has settled" | ||
1005 | 125 | run-one-until-success ping -c 10 maas.ubuntu.com | ||
1006 | 126 | } | ||
1007 | 127 | |||
1008 | 128 | setup_external_drive() { | ||
1009 | 129 | # External drive must be: | ||
1010 | 130 | # a) partitioned into 1 big partition | ||
1011 | 131 | # b) ext4 formatted | ||
1012 | 132 | # Find root disk | ||
1013 | 133 | root_disk=$(mount | grep " on / " | awk '{print $1}' | sed -e "s/[0-9]\+$//") | ||
1014 | 134 | # Find biggest non-root disk | ||
1015 | 135 | ext_disk=$(fdisk -l | grep "^Disk /" | grep -v $root_disk | sort -k4 -n -r | awk '{print $2}' | awk -F: '{print $1}') | ||
1016 | 136 | partition="${ext_disk}1" | ||
1017 | 137 | if [ -b "$ext_disk" ]; then | ||
1018 | 138 | if [ ! -b "$partition" ]; then | ||
1019 | 139 | # Create the partition, if it doesn't exist already | ||
1020 | 140 | echo "n | ||
1021 | 141 | p | ||
1022 | 142 | 1 | ||
1023 | 143 | |||
1024 | 144 | |||
1025 | 145 | w | ||
1026 | 146 | "|fdisk "$ext_disk" | ||
1027 | 147 | mkfs.ext4 "$partition" | ||
1028 | 148 | fi | ||
1029 | 149 | sed -i -e "/ \/srv/d" /etc/fstab | ||
1030 | 150 | # Add the fstab entry | ||
1031 | 151 | uuid=$(blkid -s UUID -o value "$partition") | ||
1032 | 152 | echo "UUID=$uuid /srv ext4 defaults 1 1" >> /etc/fstab | ||
1033 | 153 | fi | ||
1034 | 154 | umount $partition || true | ||
1035 | 155 | mount -a | ||
1036 | 156 | chown root:root /srv | ||
1037 | 157 | chmod 755 /srv | ||
1038 | 158 | } | ||
1039 | 159 | |||
1040 | 160 | |||
1041 | 161 | preflight_checks | ||
1042 | 162 | setup_external_drive | ||
1043 | 163 | setup_debconf | ||
1044 | 164 | setup_networking | ||
1045 | 165 | |||
1046 | 166 | #DEBHELPER# | ||
1047 | 167 | |||
1048 | 168 | exit 0 | ||
1049 | 0 | 169 | ||
1050 | === removed file 'debian/preinst' | |||
1051 | --- debian/preinst 2014-08-25 14:32:16 +0000 | |||
1052 | +++ debian/preinst 1970-01-01 00:00:00 +0000 | |||
1053 | @@ -1,136 +0,0 @@ | |||
1054 | 1 | #!/bin/sh | ||
1055 | 2 | set -e | ||
1056 | 3 | set -x | ||
1057 | 4 | |||
1058 | 5 | #unnecessary comment | ||
1059 | 6 | |||
1060 | 7 | preflight_checks() { | ||
1061 | 8 | if [ "$(id -u ubuntu)" != "1000" ]; then | ||
1062 | 9 | echo "ERROR: Read the docs; a proper OrangeBox setup requires the default user to be [ubuntu]" 1>&2 | ||
1063 | 10 | exit 1 | ||
1064 | 11 | fi | ||
1065 | 12 | # TODO: Check that the AMTs are on static IPs | ||
1066 | 13 | # TODO: Check dual hard drives, which one is which | ||
1067 | 14 | # TODO: Ensure we have two interfaces, one internal, one external | ||
1068 | 15 | } | ||
1069 | 16 | |||
1070 | 17 | setup_debconf() { | ||
1071 | 18 | echo "debconf maas/default-maas-url string 10.14.4.1" | debconf-set-selections - | ||
1072 | 19 | echo "debconf maas-cluster-controller/maas-url string http://10.14.4.1/MAAS" | debconf-set-selections - | ||
1073 | 20 | echo "debconf maas/installation-note boolean true" | debconf-set-selections - | ||
1074 | 21 | echo "debconf iptables-persistent/autosave_done boolean true" | debconf-set-selections - | ||
1075 | 22 | echo "debconf iptables-persistent/autosave_v4 boolean true" | debconf-set-selections - | ||
1076 | 23 | echo "debconf iptables-persistent/autosave_v6 boolean true" | debconf-set-selections - | ||
1077 | 24 | } | ||
1078 | 25 | |||
1079 | 26 | setup_networking() { | ||
1080 | 27 | modprobe 8021q || true | ||
1081 | 28 | sed -i -e "/8021q/d" /etc/modules || true | ||
1082 | 29 | echo "8021q" >> /etc/modules | ||
1083 | 30 | # Set up the two network interfaces | ||
1084 | 31 | external_interface=$(ip route ls | grep ^default | awk '{print $5}') | ||
1085 | 32 | # TODO: ip addr ls | ||
1086 | 33 | for interface in $(ifconfig -a -s | grep -v ^Iface | awk '{print $1}'); do | ||
1087 | 34 | case "$interface" in | ||
1088 | 35 | lo|br*|wlan*) | ||
1089 | 36 | continue | ||
1090 | 37 | ;; | ||
1091 | 38 | $external_interface) | ||
1092 | 39 | continue | ||
1093 | 40 | ;; | ||
1094 | 41 | *) | ||
1095 | 42 | internal_interface="$interface" | ||
1096 | 43 | break | ||
1097 | 44 | ;; | ||
1098 | 45 | esac | ||
1099 | 46 | done | ||
1100 | 47 | # Set a sane default | ||
1101 | 48 | [ -z "$internal_interface" ] && internal_interface=eth0 | ||
1102 | 49 | # TODO: use ip | ||
1103 | 50 | default_mac=$(ifconfig "$internal_interface" | grep "^$internal_interface" | sed -e "s/.*HWaddr //") | ||
1104 | 51 | # Tell NetworkManager to piss off | ||
1105 | 52 | sed -i -e "/^unmanaged-devices=mac:$default_mac$/d" /etc/NetworkManager/NetworkManager.conf | ||
1106 | 53 | cat >>/etc/NetworkManager/NetworkManager.conf <<EOF | ||
1107 | 54 | [keyfile] | ||
1108 | 55 | unmanaged-devices=mac:$default_mac | ||
1109 | 56 | EOF | ||
1110 | 57 | invoke-rc.d network-manager stop || true | ||
1111 | 58 | invoke-rc.d network-manager start | ||
1112 | 59 | cat >/etc/network/interfaces <<EOF | ||
1113 | 60 | auto lo | ||
1114 | 61 | iface lo inet loopback | ||
1115 | 62 | |||
1116 | 63 | auto $internal_interface | ||
1117 | 64 | iface $internal_interface inet manual | ||
1118 | 65 | |||
1119 | 66 | auto br0 | ||
1120 | 67 | iface br0 inet static | ||
1121 | 68 | address 10.14.4.1 | ||
1122 | 69 | netmask 255.255.0.0 | ||
1123 | 70 | broadcast 10.14.255.255 | ||
1124 | 71 | bridge_ports $internal_interface | ||
1125 | 72 | bridge_stp off | ||
1126 | 73 | bridge_fd 0 | ||
1127 | 74 | bridge_maxwait 0 | ||
1128 | 75 | |||
1129 | 76 | # VLAN 2, Uplink network | ||
1130 | 77 | iface eth0.2 inet dhcp | ||
1131 | 78 | vlan-raw-device eth0 | ||
1132 | 79 | |||
1133 | 80 | # Network management alias | ||
1134 | 81 | iface br0:1 inet static | ||
1135 | 82 | address 10.90.90.91 | ||
1136 | 83 | netmask 255.255.255.0 | ||
1137 | 84 | broadcast 10.90.90.255 | ||
1138 | 85 | |||
1139 | 86 | EOF | ||
1140 | 87 | ifdown --force $internal_interface || true | ||
1141 | 88 | ifdown --force br0 || true | ||
1142 | 89 | ifup $internal_interface | ||
1143 | 90 | ifup br0 | ||
1144 | 91 | # Wait a moment for the network to normalize | ||
1145 | 92 | echo "INFO: Ensure networking has settled" | ||
1146 | 93 | run-one-until-success ping -c 10 maas.ubuntu.com | ||
1147 | 94 | } | ||
1148 | 95 | |||
1149 | 96 | setup_external_drive() { | ||
1150 | 97 | # External drive must be: | ||
1151 | 98 | # a) partitioned into 1 big partition | ||
1152 | 99 | # b) ext4 formatted | ||
1153 | 100 | # Find root disk | ||
1154 | 101 | root_disk=$(mount | grep " on / " | awk '{print $1}' | sed -e "s/[0-9]\+$//") | ||
1155 | 102 | # Find biggest non-root disk | ||
1156 | 103 | ext_disk=$(fdisk -l | grep "^Disk /" | grep -v $root_disk | sort -k4 -n -r | awk '{print $2}' | awk -F: '{print $1}') | ||
1157 | 104 | partition="${ext_disk}1" | ||
1158 | 105 | if [ -b "$ext_disk" ]; then | ||
1159 | 106 | if [ ! -b "$partition" ]; then | ||
1160 | 107 | # Create the partition, if it doesn't exist already | ||
1161 | 108 | echo "n | ||
1162 | 109 | p | ||
1163 | 110 | 1 | ||
1164 | 111 | |||
1165 | 112 | |||
1166 | 113 | w | ||
1167 | 114 | "|fdisk "$ext_disk" | ||
1168 | 115 | mkfs.ext4 "$partition" | ||
1169 | 116 | fi | ||
1170 | 117 | sed -i -e "/ \/srv/d" /etc/fstab | ||
1171 | 118 | # Add the fstab entry | ||
1172 | 119 | uuid=$(blkid -s UUID -o value "$partition") | ||
1173 | 120 | echo "UUID=$uuid /srv ext4 defaults 1 1" >> /etc/fstab | ||
1174 | 121 | fi | ||
1175 | 122 | umount $partition || true | ||
1176 | 123 | mount -a | ||
1177 | 124 | chown root:root /srv | ||
1178 | 125 | chmod 755 /srv | ||
1179 | 126 | } | ||
1180 | 127 | |||
1181 | 128 | |||
1182 | 129 | preflight_checks | ||
1183 | 130 | setup_external_drive | ||
1184 | 131 | setup_debconf | ||
1185 | 132 | setup_networking | ||
1186 | 133 | |||
1187 | 134 | #DEBHELPER# | ||
1188 | 135 | |||
1189 | 136 | exit 0 | ||
1190 | 137 | 0 | ||
1191 | === modified file 'debian/source/format' | |||
1192 | --- debian/source/format 2014-04-04 19:40:10 +0000 | |||
1193 | +++ debian/source/format 2015-07-17 17:14:52 +0000 | |||
1194 | @@ -1,1 +1,1 @@ | |||
1196 | 1 | 3.0 (quilt) | 1 | 3.0 (native) |
1197 | 2 | 2 | ||
1198 | === removed file 'etc/apache2/sites-available/archive.conf' | |||
1199 | --- etc/apache2/sites-available/archive.conf 2014-04-11 05:16:52 +0000 | |||
1200 | +++ etc/apache2/sites-available/archive.conf 1970-01-01 00:00:00 +0000 | |||
1201 | @@ -1,13 +0,0 @@ | |||
1202 | 1 | <VirtualHost *:80> | ||
1203 | 2 | ServerName archive.ubuntu.com | ||
1204 | 3 | ServerAdmin webmaster@localhost | ||
1205 | 4 | DocumentRoot /srv/mirrors/archive.ubuntu.com/ | ||
1206 | 5 | ErrorLog ${APACHE_LOG_DIR}/error.log | ||
1207 | 6 | CustomLog ${APACHE_LOG_DIR}/access.log combined | ||
1208 | 7 | <Directory /srv/mirrors/archive.ubuntu.com/> | ||
1209 | 8 | Options Indexes FollowSymLinks Multiviews | ||
1210 | 9 | Require all granted | ||
1211 | 10 | </Directory> | ||
1212 | 11 | </VirtualHost> | ||
1213 | 12 | |||
1214 | 13 | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | ||
1215 | 14 | 0 | ||
1216 | === added file 'etc/apache2/sites-available/archive.ubuntu.com.conf' | |||
1217 | --- etc/apache2/sites-available/archive.ubuntu.com.conf 1970-01-01 00:00:00 +0000 | |||
1218 | +++ etc/apache2/sites-available/archive.ubuntu.com.conf 2015-07-17 17:14:52 +0000 | |||
1219 | @@ -0,0 +1,14 @@ | |||
1220 | 1 | <VirtualHost *:80> | ||
1221 | 2 | ServerName archive.ubuntu.com | ||
1222 | 3 | ServerAlias *.archive.ubuntu.com | ||
1223 | 4 | ServerAdmin webmaster@localhost | ||
1224 | 5 | DocumentRoot /srv/mirrors/archive.ubuntu.com/ | ||
1225 | 6 | ErrorLog ${APACHE_LOG_DIR}/error.log | ||
1226 | 7 | CustomLog ${APACHE_LOG_DIR}/access.log combined | ||
1227 | 8 | <Directory /srv/mirrors/archive.ubuntu.com/> | ||
1228 | 9 | Options Indexes FollowSymLinks Multiviews | ||
1229 | 10 | Require all granted | ||
1230 | 11 | </Directory> | ||
1231 | 12 | </VirtualHost> | ||
1232 | 13 | |||
1233 | 14 | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | ||
1234 | 0 | 15 | ||
1235 | === added file 'etc/apache2/sites-available/cdimage.ubuntu.com.conf' | |||
1236 | --- etc/apache2/sites-available/cdimage.ubuntu.com.conf 1970-01-01 00:00:00 +0000 | |||
1237 | +++ etc/apache2/sites-available/cdimage.ubuntu.com.conf 2015-07-17 17:14:52 +0000 | |||
1238 | @@ -0,0 +1,14 @@ | |||
1239 | 1 | <VirtualHost *:80> | ||
1240 | 2 | ServerName cdimage.ubuntu.com | ||
1241 | 3 | ServerAlias *.cdimage.ubuntu.com | ||
1242 | 4 | ServerAdmin root@localhost | ||
1243 | 5 | DocumentRoot /srv/mirrors/cdimage.ubuntu.com/ | ||
1244 | 6 | ErrorLog ${APACHE_LOG_DIR}/cdimage.ubuntu.com-error.log | ||
1245 | 7 | CustomLog ${APACHE_LOG_DIR}/cdimage.ubuntu.com-access.log combined | ||
1246 | 8 | <Directory /srv/mirrors/cdimage.ubuntu.com/> | ||
1247 | 9 | Options Indexes FollowSymLinks Multiviews | ||
1248 | 10 | Require all granted | ||
1249 | 11 | </Directory> | ||
1250 | 12 | </VirtualHost> | ||
1251 | 13 | |||
1252 | 14 | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | ||
1253 | 0 | 15 | ||
1254 | === added file 'etc/apache2/sites-available/cloud-images.ubuntu.com.conf' | |||
1255 | --- etc/apache2/sites-available/cloud-images.ubuntu.com.conf 1970-01-01 00:00:00 +0000 | |||
1256 | +++ etc/apache2/sites-available/cloud-images.ubuntu.com.conf 2015-07-17 17:14:52 +0000 | |||
1257 | @@ -0,0 +1,14 @@ | |||
1258 | 1 | <VirtualHost *:80> | ||
1259 | 2 | ServerName cloud-images.ubuntu.com | ||
1260 | 3 | ServerAlias *.cloud-images.ubuntu.com | ||
1261 | 4 | ServerAdmin root@localhost | ||
1262 | 5 | DocumentRoot /srv/mirrors/cloud-images.ubuntu.com/ | ||
1263 | 6 | ErrorLog ${APACHE_LOG_DIR}/cloud-images.ubuntu.com-error.log | ||
1264 | 7 | CustomLog ${APACHE_LOG_DIR}/cloud-images.ubuntu.com-access.log combined | ||
1265 | 8 | <Directory /srv/mirrors/cloud-images.ubuntu.com/> | ||
1266 | 9 | Options Indexes FollowSymLinks Multiviews | ||
1267 | 10 | Require all granted | ||
1268 | 11 | </Directory> | ||
1269 | 12 | </VirtualHost> | ||
1270 | 13 | |||
1271 | 14 | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | ||
1272 | 0 | 15 | ||
1273 | === added file 'etc/apache2/sites-available/ports.ubuntu.com.conf' | |||
1274 | --- etc/apache2/sites-available/ports.ubuntu.com.conf 1970-01-01 00:00:00 +0000 | |||
1275 | +++ etc/apache2/sites-available/ports.ubuntu.com.conf 2015-07-17 17:14:52 +0000 | |||
1276 | @@ -0,0 +1,14 @@ | |||
1277 | 1 | <VirtualHost *:80> | ||
1278 | 2 | ServerName ports.ubuntu.com | ||
1279 | 3 | ServerAlias *.ports.ubuntu.com | ||
1280 | 4 | ServerAdmin root@localhost | ||
1281 | 5 | DocumentRoot /srv/mirrors/ports.ubuntu.com/ | ||
1282 | 6 | ErrorLog ${APACHE_LOG_DIR}/ports.ubuntu.com-error.log | ||
1283 | 7 | CustomLog ${APACHE_LOG_DIR}/ports.ubuntu.com-access.log combined | ||
1284 | 8 | <Directory /srv/mirrors/ports.ubuntu.com/> | ||
1285 | 9 | Options Indexes FollowSymLinks Multiviews | ||
1286 | 10 | Require all granted | ||
1287 | 11 | </Directory> | ||
1288 | 12 | </VirtualHost> | ||
1289 | 13 | |||
1290 | 14 | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | ||
1291 | 0 | 15 | ||
1292 | === added file 'etc/apache2/sites-available/releases.ubuntu.com.conf' | |||
1293 | --- etc/apache2/sites-available/releases.ubuntu.com.conf 1970-01-01 00:00:00 +0000 | |||
1294 | +++ etc/apache2/sites-available/releases.ubuntu.com.conf 2015-07-17 17:14:52 +0000 | |||
1295 | @@ -0,0 +1,14 @@ | |||
1296 | 1 | <VirtualHost *:80> | ||
1297 | 2 | ServerName releases.ubuntu.com | ||
1298 | 3 | ServerAlias *.releases.ubuntu.com | ||
1299 | 4 | ServerAdmin root@localhost | ||
1300 | 5 | DocumentRoot /srv/mirrors/releases.ubuntu.com/ | ||
1301 | 6 | ErrorLog ${APACHE_LOG_DIR}/releases.ubuntu.com-error.log | ||
1302 | 7 | CustomLog ${APACHE_LOG_DIR}/releases.ubuntu.com-access.log combined | ||
1303 | 8 | <Directory /srv/mirrors/releases.ubuntu.com/> | ||
1304 | 9 | Options Indexes FollowSymLinks Multiviews | ||
1305 | 10 | Require all granted | ||
1306 | 11 | </Directory> | ||
1307 | 12 | </VirtualHost> | ||
1308 | 13 | |||
1309 | 14 | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | ||
1310 | 0 | 15 | ||
1311 | === added file 'etc/apache2/sites-available/ubuntu-cloud.archive.canonical.com.conf' | |||
1312 | --- etc/apache2/sites-available/ubuntu-cloud.archive.canonical.com.conf 1970-01-01 00:00:00 +0000 | |||
1313 | +++ etc/apache2/sites-available/ubuntu-cloud.archive.canonical.com.conf 2015-07-17 17:14:52 +0000 | |||
1314 | @@ -0,0 +1,12 @@ | |||
1315 | 1 | <VirtualHost *:80> | ||
1316 | 2 | ServerName ubuntu-cloud.archive.canonical.com | ||
1317 | 3 | ServerAdmin webmaster@localhost | ||
1318 | 4 | DocumentRoot /srv/mirrors/ubuntu-cloud.archive.canonical.com/ | ||
1319 | 5 | ErrorLog ${APACHE_LOG_DIR}/error.log | ||
1320 | 6 | CustomLog ${APACHE_LOG_DIR}/access.log combined | ||
1321 | 7 | <Directory /srv/mirrors/ubuntu-cloud.archive.canonical.com/> | ||
1322 | 8 | Options Indexes FollowSymLinks Multiviews | ||
1323 | 9 | Require all granted | ||
1324 | 10 | </Directory> | ||
1325 | 11 | </VirtualHost> | ||
1326 | 12 | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | ||
1327 | 0 | 13 | ||
1328 | === removed file 'etc/apache2/sites-available/ubuntu-cloud.conf' | |||
1329 | --- etc/apache2/sites-available/ubuntu-cloud.conf 2014-04-11 05:16:52 +0000 | |||
1330 | +++ etc/apache2/sites-available/ubuntu-cloud.conf 1970-01-01 00:00:00 +0000 | |||
1331 | @@ -1,12 +0,0 @@ | |||
1332 | 1 | <VirtualHost *:80> | ||
1333 | 2 | ServerName ubuntu-cloud.archive.canonical.com | ||
1334 | 3 | ServerAdmin webmaster@localhost | ||
1335 | 4 | DocumentRoot /srv/mirrors/ubuntu-cloud.archive.canonical.com/ | ||
1336 | 5 | ErrorLog ${APACHE_LOG_DIR}/error.log | ||
1337 | 6 | CustomLog ${APACHE_LOG_DIR}/access.log combined | ||
1338 | 7 | <Directory /srv/mirrors/ubuntu-cloud.archive.canonical.com/> | ||
1339 | 8 | Options Indexes FollowSymLinks Multiviews | ||
1340 | 9 | Require all granted | ||
1341 | 10 | </Directory> | ||
1342 | 11 | </VirtualHost> | ||
1343 | 12 | # vim: syntax=apache ts=4 sw=4 sts=4 sr noet | ||
1344 | 13 | 0 | ||
1345 | === modified file 'etc/apt/orange-box-mirror.list' | |||
1346 | --- etc/apt/orange-box-mirror.list 2015-01-21 22:04:42 +0000 | |||
1347 | +++ etc/apt/orange-box-mirror.list 2015-07-17 17:14:52 +0000 | |||
1348 | @@ -8,7 +8,7 @@ | |||
1349 | 8 | set var_path $base_path/var | 8 | set var_path $base_path/var |
1350 | 9 | set cleanscript /bin/true | 9 | set cleanscript /bin/true |
1351 | 10 | set defaultarch amd64 | 10 | set defaultarch amd64 |
1353 | 11 | set postmirror_script /bin/true | 11 | set postmirror_script /srv/var/postmirror.sh |
1354 | 12 | # set run_postmirror 0 | 12 | # set run_postmirror 0 |
1355 | 13 | set nthreads 20 | 13 | set nthreads 20 |
1356 | 14 | set _tilde 0 | 14 | set _tilde 0 |
1357 | @@ -16,28 +16,51 @@ | |||
1358 | 16 | ############# end config ############## | 16 | ############# end config ############## |
1359 | 17 | 17 | ||
1360 | 18 | ## Trusty | 18 | ## Trusty |
1367 | 19 | deb http://orange-box.archive.ubuntu.com/ubuntu trusty main restricted universe multiverse | 19 | deb http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse |
1368 | 20 | deb http://orange-box.archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse | 20 | deb http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse |
1369 | 21 | deb http://orange-box.archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse | 21 | deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse |
1370 | 22 | deb-i386 http://orange-box.archive.ubuntu.com/ubuntu trusty main restricted universe multiverse | 22 | deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse |
1371 | 23 | deb-i386 http://orange-box.archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse | 23 | deb-i386 http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse |
1372 | 24 | deb-i386 http://orange-box.archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse | 24 | deb-i386 http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse |
1373 | 25 | deb-i386 http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse | ||
1374 | 26 | deb-i386 http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse | ||
1375 | 27 | |||
1376 | 28 | |||
1377 | 29 | deb-src http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse | ||
1378 | 30 | deb-src http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse | ||
1379 | 31 | deb-src http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse | ||
1380 | 32 | deb-src http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse | ||
1381 | 33 | |||
1382 | 25 | 34 | ||
1383 | 26 | ## precise | 35 | ## precise |
1390 | 27 | deb http://orange-box.archive.ubuntu.com/ubuntu precise main restricted universe multiverse | 36 | deb http://archive.ubuntu.com/ubuntu precise main restricted universe multiverse |
1391 | 28 | deb http://orange-box.archive.ubuntu.com/ubuntu precise-security main restricted universe multiverse | 37 | deb http://archive.ubuntu.com/ubuntu precise-security main restricted universe multiverse |
1392 | 29 | deb http://orange-box.archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse | 38 | deb http://archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse |
1393 | 30 | deb-i386 http://orange-box.archive.ubuntu.com/ubuntu precise main restricted universe multiverse | 39 | deb http://archive.ubuntu.com/ubuntu precise-backports main restricted universe multiverse |
1394 | 31 | deb-i386 http://orange-box.archive.ubuntu.com/ubuntu precise-security main restricted universe multiverse | 40 | |
1395 | 32 | deb-i386 http://orange-box.archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse | 41 | deb-i386 http://archive.ubuntu.com/ubuntu precise main restricted universe multiverse |
1396 | 42 | deb-i386 http://archive.ubuntu.com/ubuntu precise-security main restricted universe multiverse | ||
1397 | 43 | deb-i386 http://archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse | ||
1398 | 44 | deb-src http://archive.ubuntu.com/ubuntu precise main restricted universe multiverse | ||
1399 | 45 | deb-src http://archive.ubuntu.com/ubuntu precise-security main restricted universe multiverse | ||
1400 | 46 | deb-src http://archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse | ||
1401 | 47 | |||
1402 | 48 | ##http://ubuntu-cloud.archive.canonical.com precise-updates/cloud-tools/main Sources | ||
1403 | 33 | 49 | ||
1404 | 34 | ## Cloud-archive | 50 | ## Cloud-archive |
1411 | 35 | deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/cloud-tools main | 51 | #deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/cloud-tools main |
1412 | 36 | deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/havana main | 52 | #deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/havana main |
1413 | 37 | deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/icehouse main | 53 | #deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/icehouse main |
1414 | 38 | deb-i386 http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/cloud-tools main | 54 | #deb http://ubuntu-cloud.archive.canonical.com/ubuntu trusty-updates/juno main |
1415 | 39 | deb-i386 http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/havana main | 55 | #deb-i386 http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/cloud-tools main |
1416 | 40 | deb-i386 http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/icehouse main | 56 | #deb-i386 http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/havana main |
1417 | 57 | #deb-i386 http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/icehouse main | ||
1418 | 58 | #deb-i386 http://ubuntu-cloud.archive.canonical.com/ubuntu trusty-updates/juno main | ||
1419 | 59 | #deb-src http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/cloud-tools main | ||
1420 | 60 | #deb-src http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/havana main | ||
1421 | 61 | #deb-src http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/icehouse main | ||
1422 | 62 | #deb-src http://ubuntu-cloud.archive.canonical.com/ubuntu trusty-updates/juno main | ||
1423 | 63 | |||
1424 | 41 | 64 | ||
1425 | 42 | clean http://archive.ubuntu.com/ubuntu | 65 | clean http://archive.ubuntu.com/ubuntu |
1427 | 43 | clean http://ubuntu-cloud.archive.canonical.com/ubuntu | 66 | #clean http://ubuntu-cloud.archive.canonical.com/ubuntu |
1428 | 44 | 67 | ||
1429 | === added directory 'etc/bind' | |||
1430 | === added file 'etc/bind/named.conf.wildcard-archive' | |||
1431 | --- etc/bind/named.conf.wildcard-archive 1970-01-01 00:00:00 +0000 | |||
1432 | +++ etc/bind/named.conf.wildcard-archive 2015-07-17 17:14:52 +0000 | |||
1433 | @@ -0,0 +1,6 @@ | |||
1434 | 1 | # Zone declarations. | ||
1435 | 2 | zone "archive.ubuntu.com" { | ||
1436 | 3 | type master; | ||
1437 | 4 | file "/etc/bind/zones.wildcard-archive"; | ||
1438 | 5 | }; | ||
1439 | 6 | |||
1440 | 0 | 7 | ||
1441 | === added file 'etc/bind/zones.wildcard-archive' | |||
1442 | --- etc/bind/zones.wildcard-archive 1970-01-01 00:00:00 +0000 | |||
1443 | +++ etc/bind/zones.wildcard-archive 2015-07-17 17:14:52 +0000 | |||
1444 | @@ -0,0 +1,20 @@ | |||
1445 | 1 | $TTL 300 | ||
1446 | 2 | @ IN SOA archive.ubuntu.com ubuntu.com ( | ||
1447 | 3 | 999 ; serial | ||
1448 | 4 | 600 ; Refresh | ||
1449 | 5 | 1800 ; Retry | ||
1450 | 6 | 604800 ; Expire | ||
1451 | 7 | 300 ; TTL | ||
1452 | 8 | ) | ||
1453 | 9 | |||
1454 | 10 | IN NS archive.ubuntu.com | ||
1455 | 11 | |||
1456 | 12 | |||
1457 | 13 | |||
1458 | 14 | |||
1459 | 15 | ns IN CNAME archive.ubuntu.com | ||
1460 | 16 | archive.ubuntu.com. IN A 10.14.4.1 | ||
1461 | 17 | archive.ubuntu.com IN A 10.14.4.1 | ||
1462 | 18 | ubuntu-cloud.archive.canonical.com. IN A 10.14.4.1 | ||
1463 | 19 | * IN A 10.14.4.1 | ||
1464 | 20 | |||
1465 | 0 | 21 | ||
1466 | === removed directory 'etc/cron.d' | |||
1467 | === removed file 'etc/cron.d/charmstore-mirror' | |||
1468 | --- etc/cron.d/charmstore-mirror 2014-07-30 20:05:45 +0000 | |||
1469 | +++ etc/cron.d/charmstore-mirror 1970-01-01 00:00:00 +0000 | |||
1470 | @@ -1,4 +0,0 @@ | |||
1471 | 1 | #Run every Staurday at 03:23 in the morning, if plugged in and internet is accessible the charmstore will be updated. | ||
1472 | 2 | #Remove any charmstore directories inot modified in the last 90 days to save space. | ||
1473 | 3 | 23 3 * * 6 root run-one orange-box-sync-charmstore >>/var/log/orange-box-sync-charmstore.log 2>&1 | ||
1474 | 4 | 38 4 1 * * root run-one find /srv/charmstore/ -maxdepth 1 -mindepth 1 -type d -mtime +90 -exec rm -rf {} \; | ||
1475 | 5 | 0 | ||
1476 | === removed file 'etc/cron.d/orange-box-mirror' | |||
1477 | --- etc/cron.d/orange-box-mirror 2014-06-02 15:43:19 +0000 | |||
1478 | +++ etc/cron.d/orange-box-mirror 1970-01-01 00:00:00 +0000 | |||
1479 | @@ -1,1 +0,0 @@ | |||
1480 | 1 | 42 * * * * root run-one apt-mirror /etc/apt/orange-box-mirror.list >>/var/log/orange-box-mirror.log 2>&1 | ||
1481 | 2 | 0 | ||
1482 | === modified file 'etc/debconf-selections' | |||
1483 | --- etc/debconf-selections 2014-04-04 19:42:22 +0000 | |||
1484 | +++ etc/debconf-selections 2015-07-17 17:14:52 +0000 | |||
1485 | @@ -1,5 +1,3 @@ | |||
1486 | 1 | maas-cluster-controller maas-cluster-controller/maas-url string http://10.14.4.1/MAAS | ||
1487 | 2 | maas-region-controller-min maas/default-maas-url string 10.14.4.1 | ||
1488 | 3 | maas-region-controller-min maas/installation-note boolean true | 1 | maas-region-controller-min maas/installation-note boolean true |
1489 | 4 | iptables-persistent iptables-persistent/autosave_v6 boolean true | 2 | iptables-persistent iptables-persistent/autosave_v6 boolean true |
1490 | 5 | iptables-persistent iptables-persistent/autosave_v4 boolean true | 3 | iptables-persistent iptables-persistent/autosave_v4 boolean true |
1491 | 6 | 4 | ||
1492 | === added file 'etc/orangebox-mirror.state' | |||
1493 | --- etc/orangebox-mirror.state 1970-01-01 00:00:00 +0000 | |||
1494 | +++ etc/orangebox-mirror.state 2015-07-17 17:14:52 +0000 | |||
1495 | @@ -0,0 +1,1 @@ | |||
1496 | 1 | INIT | ||
1497 | 0 | \ No newline at end of file | 2 | \ No newline at end of file |
1498 | 1 | 3 | ||
1499 | === added file 'etc/ucloudexclude.list' | |||
1500 | --- etc/ucloudexclude.list 1970-01-01 00:00:00 +0000 | |||
1501 | +++ etc/ucloudexclude.list 2015-07-17 17:14:52 +0000 | |||
1502 | @@ -0,0 +1,26 @@ | |||
1503 | 1 | lost+found/ | ||
1504 | 2 | desktop/ | ||
1505 | 3 | lucid/ | ||
1506 | 4 | full/ | ||
1507 | 5 | *jaunty* | ||
1508 | 6 | *hardy* | ||
1509 | 7 | *karmic* | ||
1510 | 8 | *lucid* | ||
1511 | 9 | *maverick* | ||
1512 | 10 | *natty* | ||
1513 | 11 | *oneiric* | ||
1514 | 12 | *quantal* | ||
1515 | 13 | *vagrant* | ||
1516 | 14 | *proposed* | ||
1517 | 15 | *raring* | ||
1518 | 16 | *saucy* | ||
1519 | 17 | *utopic* | ||
1520 | 18 | *vivid* | ||
1521 | 19 | *wily* | ||
1522 | 20 | *alpha* | ||
1523 | 21 | *snappy* | ||
1524 | 22 | *beta* | ||
1525 | 23 | *.ova | ||
1526 | 24 | *arm* | ||
1527 | 25 | *ppc* | ||
1528 | 26 | .bzr | ||
1529 | 0 | 27 | ||
1530 | === modified file 'usr/bin/orange-box-add-node' | |||
1531 | --- usr/bin/orange-box-add-node 2014-10-27 20:54:45 +0000 | |||
1532 | +++ usr/bin/orange-box-add-node 2015-07-17 17:14:52 +0000 | |||
1533 | @@ -23,6 +23,9 @@ | |||
1534 | 23 | set -e | 23 | set -e |
1535 | 24 | set -x | 24 | set -x |
1536 | 25 | 25 | ||
1537 | 26 | ## According to OB network re-design | ||
1538 | 27 | . /etc/orange-box.conf | ||
1539 | 28 | |||
1540 | 26 | ip_to_mac() { | 29 | ip_to_mac() { |
1541 | 27 | local ip="$1" | 30 | local ip="$1" |
1542 | 28 | arp -n | sort | grep -m1 "^$ip\s" | awk '{print $3}' | 31 | arp -n | sort | grep -m1 "^$ip\s" | awk '{print $3}' |
1543 | @@ -31,7 +34,7 @@ | |||
1544 | 31 | node_name() { | 34 | node_name() { |
1545 | 32 | local num="${1##*.}" | 35 | local num="${1##*.}" |
1546 | 33 | num=$((num-10)) | 36 | num=$((num-10)) |
1548 | 34 | echo "node${num}" | 37 | echo "node${num}ob${orangebox_number}" |
1549 | 35 | } | 38 | } |
1550 | 36 | 39 | ||
1551 | 37 | hostname_to_system_id() { | 40 | hostname_to_system_id() { |
1552 | @@ -60,20 +63,20 @@ | |||
1553 | 60 | maas admin zone read zone2 || maas admin zones create name=zone2 description="Physical machines on right side of Orange Box" | 63 | maas admin zone read zone2 || maas admin zones create name=zone2 description="Physical machines on right side of Orange Box" |
1554 | 61 | 64 | ||
1555 | 62 | #Create maas-br0 network if it does not already exist | 65 | #Create maas-br0 network if it does not already exist |
1557 | 63 | maas admin network read maas-br0 || maas admin networks create name=maas-br0 ip=10.14.0.0 netmask=255.255.0.0 default_gateway=10.14.4.1 dns_servers=10.14.4.1 description="Auto created when running orange-box-add-node" | 66 | maas admin network read maas-br0 || maas admin networks create name=maas-br0 ip=172.27.${orangebox_number}.0 netmask=255.255.252.0 default_gateway=172.27.${orangebox_number}.1 dns_servers=172.27.${orangebox_number}.1 description="Auto created when running orange-box-add-node" |
1558 | 64 | 67 | ||
1559 | 65 | # Loop over the list of ip addresses listening on 16992 | 68 | # Loop over the list of ip addresses listening on 16992 |
1560 | 66 | for ip in $@; do | 69 | for ip in $@; do |
1561 | 67 | mac=$(ip_to_mac $ip) | 70 | mac=$(ip_to_mac $ip) |
1562 | 68 | hostname=$(node_name $ip) | 71 | hostname=$(node_name $ip) |
1564 | 69 | node=${hostname#node} | 72 | node=`echo ${hostname}| sed "s/node\(.*\)ob${orangebox_number}/\1/"` |
1565 | 70 | if [ $node -lt 5 ]; then | 73 | if [ $node -lt 5 ]; then |
1566 | 71 | zone="zone1" | 74 | zone="zone1" |
1567 | 72 | else | 75 | else |
1568 | 73 | zone="zone2" | 76 | zone="zone2" |
1569 | 74 | fi | 77 | fi |
1570 | 75 | info "$ip --> $hostname --> $mac" | 78 | info "$ip --> $hostname --> $mac" |
1572 | 76 | if [ -z "$ip" ] || [ "$ip" = "10.14.4.1" ]; then | 79 | if [ -z "$ip" ] || [ "$ip" = "172.27.${orangebox_number}.1" ]; then |
1573 | 77 | continue | 80 | continue |
1574 | 78 | fi | 81 | fi |
1575 | 79 | # Remove it, if it's already here | 82 | # Remove it, if it's already here |
1576 | 80 | 83 | ||
1577 | === modified file 'usr/bin/orange-box-add-physical-nodes' | |||
1578 | --- usr/bin/orange-box-add-physical-nodes 2014-07-11 18:27:46 +0000 | |||
1579 | +++ usr/bin/orange-box-add-physical-nodes 2015-07-17 17:14:52 +0000 | |||
1580 | @@ -25,11 +25,16 @@ | |||
1581 | 25 | 25 | ||
1582 | 26 | oauth_login | 26 | oauth_login |
1583 | 27 | 27 | ||
1584 | 28 | ## According to OB network re-design | ||
1585 | 29 | . /etc/orange-box.conf | ||
1586 | 30 | |||
1587 | 31 | |||
1588 | 32 | |||
1589 | 28 | # Search for nodes listening on AMT's 16992 | 33 | # Search for nodes listening on AMT's 16992 |
1590 | 29 | info "Searching for all nodes on the local network listening on 16992; this will take 60 seconds...." | 34 | info "Searching for all nodes on the local network listening on 16992; this will take 60 seconds...." |
1592 | 30 | ips=$(time for i in $(seq 1 10); do nmap -p 16992 -oG - 10.14.4.1/24 | grep 16992/open | awk '{print $2}' ; done | sort -u -r) | 35 | ips=$(time for i in $(seq 1 10); do nmap -p 16992 -oG - 172.27.${orangebox_number}.1/22 | grep 16992/open | awk '{print $2}' ; done | sort -u -r) |
1593 | 31 | if [ -z "$ips" ]; then | 36 | if [ -z "$ips" ]; then |
1595 | 32 | error "nmap did not find any nodes listening on [16992] on the [10.14.4.1/24] network" | 37 | error "nmap did not find any nodes listening on [16992] on the [172.27.${orangebox_number}.1/22] network" |
1596 | 33 | fi | 38 | fi |
1597 | 34 | info "Found: [$ips]" | 39 | info "Found: [$ips]" |
1598 | 35 | 40 | ||
1599 | 36 | 41 | ||
1600 | === modified file 'usr/bin/orange-box-add-virtual-nodes' | |||
1601 | --- usr/bin/orange-box-add-virtual-nodes 2015-02-07 16:07:08 +0000 | |||
1602 | +++ usr/bin/orange-box-add-virtual-nodes 2015-07-17 17:14:52 +0000 | |||
1603 | @@ -18,6 +18,13 @@ | |||
1604 | 18 | # You should have received a copy of the GNU General Public License | 18 | # You should have received a copy of the GNU General Public License |
1605 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1606 | 20 | 20 | ||
1607 | 21 | ## | ||
1608 | 22 | ## | ||
1609 | 23 | . /etc/orange-box.conf | ||
1610 | 24 | |||
1611 | 25 | external_ip="172.27.252.${orangebox_number}" | ||
1612 | 26 | internal_ip="172.27.${orangebox_number}.1" | ||
1613 | 27 | internal_network="172.27.${orangebox_number}.0" | ||
1614 | 21 | 28 | ||
1615 | 22 | if [ "$(id -u)" != "0" ]; then | 29 | if [ "$(id -u)" != "0" ]; then |
1616 | 23 | echo "Must be run with sudo or by root" | 30 | echo "Must be run with sudo or by root" |
1617 | @@ -29,13 +36,20 @@ | |||
1618 | 29 | 36 | ||
1619 | 30 | virsh net-info default && virsh net-destroy default && virsh net-undefine default | 37 | virsh net-info default && virsh net-destroy default && virsh net-undefine default |
1620 | 31 | 38 | ||
1622 | 32 | [ -d ~maas ] || install -d /var/lib/maas --owner maas --group maas | 39 | [ -d /var/lib/maas ] || install -d /var/lib/maas --owner maas --group maas |
1623 | 33 | chsh maas -s /bin/bash | 40 | chsh maas -s /bin/bash |
1627 | 34 | [ -d ~maas/.ssh ] || echo -e "\n\n\n" | sudo -u maas ssh-keygen -N "" -t rsa -f ~maas/.ssh/id_rsa | 41 | [ -d /var/lib/maas/.ssh ] || mkdir /var/lib/maas/.ssh && chown maas:maas /var/lib/maas/.ssh |
1628 | 35 | grep 'maas@' /home/ubuntu/.ssh/authorized_keys || cat ~maas/.ssh/id_rsa.pub | tee -a /home/ubuntu/.ssh/authorized_keys | 42 | [ -f /var/lib/maas/.ssh/id_rsa ] || echo -e "\n\n\n" | sudo -u maas ssh-keygen -N "" -t rsa -f /var/lib/maas/.ssh/id_rsa |
1629 | 36 | printf "%s,%s %s %s\n" "node0.maas" "10.14.4.1" $(awk '{print $1 " " $2}' /etc/ssh/ssh_host_ecdsa_key.pub) | tee -a ~maas/.ssh/known_hosts | 43 | [ -f /var/lib/maas/.ssh/known_hosts ] || sudo -u maas ssh-keyscan 172.27.${orangebox_number}.1 |sudo -u maas tee -a /var/lib/maas/.ssh/known_hosts > /dev/null |
1630 | 44 | #Always add host keys .. not an issue if files grows | ||
1631 | 45 | sudo -u maas ssh-keyscan 172.27.${orangebox_number}.1 |sudo -u maas tee -a /var/lib/maas/.ssh/known_hosts > /dev/null | ||
1632 | 46 | sudo -u maas virsh -c qemu+ssh://ubuntu@172.27.${orangebox_number}.1/system list > /dev/null || sed -i '/ maas@/d' /home/ubuntu/.ssh/authorized_keys | ||
1633 | 47 | #If there is no key /new install or just removed add it" | ||
1634 | 48 | grep 'maas@' /home/ubuntu/.ssh/authorized_keys || cat /var/lib/maas/.ssh/id_rsa.pub | tee -a /home/ubuntu/.ssh/authorized_keys | ||
1635 | 49 | printf "%s,%s %s %s\n" "node0.maas" "$internal_ip" $(awk '{print $1 " " $2}' /etc/ssh/ssh_host_ecdsa_key.pub) | tee -a /var/lib/maas/.ssh/known_hosts | ||
1636 | 37 | chown -R ubuntu:ubuntu /home/ubuntu | 50 | chown -R ubuntu:ubuntu /home/ubuntu |
1637 | 38 | 51 | ||
1638 | 52 | |||
1639 | 39 | maas admin tags new name=virtual || true | 53 | maas admin tags new name=virtual || true |
1640 | 40 | maas admin tags new name=bootstrap || true | 54 | maas admin tags new name=bootstrap || true |
1641 | 41 | maas admin tags new name=neutron || true | 55 | maas admin tags new name=neutron || true |
1642 | @@ -53,25 +67,23 @@ | |||
1643 | 53 | maas admin zone read zone0 || maas admin zones create name=zone0 description="Virtual machines on node0" | 67 | maas admin zone read zone0 || maas admin zones create name=zone0 description="Virtual machines on node0" |
1644 | 54 | 68 | ||
1645 | 55 | #Create maas-br0 network if it does not already exist | 69 | #Create maas-br0 network if it does not already exist |
1647 | 56 | maas admin network read maas-br0 || maas admin networks create name=maas-br0 ip=10.14.0.0 netmask=255.255.0.0 default_gateway=10.14.4.1 dns_servers=10.14.4.1 description="Auto created when running orange-box-add-virtual-nodes" | 70 | ### For APAC Roadshow |
1648 | 71 | maas admin network read maas-br0 || maas admin networks create name=maas-br0 ip=${internal_network} netmask=255.255.252.0 default_gateway=${internal_ip} dns_servers=${internal_ip} description="Auto created when running orange-box-add-virtual-nodes" | ||
1649 | 72 | |||
1650 | 57 | 73 | ||
1651 | 58 | for i in $(seq 0 2 | sort -r); do | 74 | for i in $(seq 0 2 | sort -r); do |
1653 | 59 | hostname="node0vm${i}.maas" | 75 | hostname="node0vm${i}ob${orangebox_number}.maas" |
1654 | 60 | virsh destroy $hostname || true | 76 | virsh destroy $hostname || true |
1655 | 61 | virsh undefine $hostname || true | 77 | virsh undefine $hostname || true |
1656 | 62 | echo "INFO: Installing virtual machine" | 78 | echo "INFO: Installing virtual machine" |
1658 | 63 | virt-install --debug --name $hostname --ram 4096 --disk=path=/var/lib/orange-box/${hostname}-1.img,size=20 --disk=path=/var/lib/orange-box/${hostname}-2.img,size=2 --vcpus=2 --os-type=linux --pxe --network=bridge=br0,model=virtio --network=bridge=br0,model=rtl8139 --boot network --video=cirrus --graphics vnc|| true | 79 | virt-install --debug --name $hostname --ram 4096 --disk=path=/var/lib/orange-box/${hostname}-1.img,size=20 --disk=path=/var/lib/orange-box/${hostname}-2.img,size=2 --vcpus=2 --os-type=linux --pxe --network=bridge=br0 --network=bridge=br0 --boot network --video=cirrus --graphics vnc|| true |
1659 | 64 | virsh console $hostname || true | 80 | virsh console $hostname || true |
1660 | 65 | #Workaround for bug: https://bugs.launchpad.net/maas/+bug/1367482 | ||
1661 | 66 | virsh dumpxml $hostname > /tmp/${hostname}.xml | ||
1662 | 67 | sed -i -e "s#<model type='rtl8139'/>#<model type='rtl8139'/> <rom file=''/>#" /tmp/${hostname}.xml | ||
1663 | 68 | virsh define /tmp/${hostname}.xml | ||
1664 | 69 | virsh autostart $hostname | 81 | virsh autostart $hostname |
1665 | 70 | mac=$(virsh dumpxml $hostname | python -c 'import sys, lxml.etree; print list(lxml.etree.parse(sys.stdin).iter("mac"))[0].get("address")') | 82 | mac=$(virsh dumpxml $hostname | python -c 'import sys, lxml.etree; print list(lxml.etree.parse(sys.stdin).iter("mac"))[0].get("address")') |
1666 | 71 | mac2=$(virsh dumpxml $hostname | python -c 'import sys, lxml.etree; print list(lxml.etree.parse(sys.stdin).iter("mac"))[0].get("address")') | 83 | mac2=$(virsh dumpxml $hostname | python -c 'import sys, lxml.etree; print list(lxml.etree.parse(sys.stdin).iter("mac"))[0].get("address")') |
1667 | 72 | system_id=$(maas admin nodes list mac_address=$mac | grep system_id | cut -d'"' -f4) | 84 | system_id=$(maas admin nodes list mac_address=$mac | grep system_id | cut -d'"' -f4) |
1668 | 73 | if [ -n "$system_id" ]; then | 85 | if [ -n "$system_id" ]; then |
1670 | 74 | maas admin node update $system_id hostname=$hostname power_type=virsh power_parameters_power_address=qemu+ssh://ubuntu@10.14.4.1/system power_parameters_power_id=$hostname | 86 | maas admin node update $system_id hostname=$hostname power_type=virsh power_parameters_power_address=qemu+ssh://ubuntu@${internal_ip}/system power_parameters_power_id=$hostname |
1671 | 75 | maas admin tag update-nodes "virtual" add=$system_id | 87 | maas admin tag update-nodes "virtual" add=$system_id |
1672 | 76 | case $i in | 88 | case $i in |
1673 | 77 | 0) | 89 | 0) |
1674 | 78 | 90 | ||
1675 | === modified file 'usr/bin/orange-box-amt-monitor' | |||
1676 | --- usr/bin/orange-box-amt-monitor 2014-04-16 22:26:52 +0000 | |||
1677 | +++ usr/bin/orange-box-amt-monitor 2015-07-17 17:14:52 +0000 | |||
1678 | @@ -1,3 +1,5 @@ | |||
1679 | 1 | #!/bin/sh | 1 | #!/bin/sh |
1680 | 2 | 2 | ||
1682 | 3 | watch -n 10 "sudo nmap -p 16992 -oG - 10.14.4.1/24 | grep 16992/open | sort" | 3 | . /etc/orange-box.conf |
1683 | 4 | watch -n 10 "sudo nmap -p 16992 -oG - 172.27.${orangebox_number}.0/22 | grep 16992/open | sort" | ||
1684 | 5 | |||
1685 | 4 | 6 | ||
1686 | === removed file 'usr/bin/orange-box-apm-power-fix' | |||
1687 | --- usr/bin/orange-box-apm-power-fix 2014-10-31 09:19:40 +0000 | |||
1688 | +++ usr/bin/orange-box-apm-power-fix 1970-01-01 00:00:00 +0000 | |||
1689 | @@ -1,38 +0,0 @@ | |||
1690 | 1 | #!/bin/sh | ||
1691 | 2 | # | ||
1692 | 3 | # orange-box-apm-power-fix - fix for issue with orange-box-apm-power | ||
1693 | 4 | # Copyright (C) 2014 Canonical Ltd. | ||
1694 | 5 | # | ||
1695 | 6 | # Authors: Darryl Weaver <darryl.weaver@canonical.com> | ||
1696 | 7 | # | ||
1697 | 8 | # This program is free software: you can redistribute it and/or modify | ||
1698 | 9 | # it under the terms of the GNU General Public License as published by | ||
1699 | 10 | # the Free Software Foundation, version 3 of the License. | ||
1700 | 11 | # | ||
1701 | 12 | # This program is distributed in the hope that it will be useful, | ||
1702 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1703 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1704 | 15 | # GNU General Public License for more details. | ||
1705 | 16 | # | ||
1706 | 17 | # You should have received a copy of the GNU General Public License | ||
1707 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1708 | 19 | |||
1709 | 20 | set -x | ||
1710 | 21 | |||
1711 | 22 | if [ ! -f /var/lib/maas/boot-resources/current/syslinux/poweroff-APM.com ] | ||
1712 | 23 | then | ||
1713 | 24 | cd /srv/data | ||
1714 | 25 | wget https://launchpadlibrarian.net/187530745/acpioff.c32 | ||
1715 | 26 | cd /var/lib/maas/boot-resources/current/syslinux | ||
1716 | 27 | sudo mv poweroff.com poweroff-APM.com | ||
1717 | 28 | sudo mv /srv/data/acpioff.c32 poweroff.c32 | ||
1718 | 29 | fi | ||
1719 | 30 | |||
1720 | 31 | #fixing the AMT template | ||
1721 | 32 | cd /srv/data | ||
1722 | 33 | wget https://launchpadlibrarian.net/187911231/not-permitted.patch | ||
1723 | 34 | cd /etc/maas/templates/power | ||
1724 | 35 | patch < /srv/data/not-permitted.patch | ||
1725 | 36 | |||
1726 | 37 | exit | ||
1727 | 38 | |||
1728 | 39 | 0 | ||
1729 | === modified file 'usr/bin/orange-box-bootstrap-juju' | |||
1730 | --- usr/bin/orange-box-bootstrap-juju 2015-01-07 23:15:31 +0000 | |||
1731 | +++ usr/bin/orange-box-bootstrap-juju 2015-07-17 17:14:52 +0000 | |||
1732 | @@ -24,8 +24,12 @@ | |||
1733 | 24 | timeout 1m run-one-until-success nc -w 10 -zvv $@ 2>&1 | 24 | timeout 1m run-one-until-success nc -w 10 -zvv $@ 2>&1 |
1734 | 25 | } | 25 | } |
1735 | 26 | 26 | ||
1736 | 27 | ## According to OB network re-disign | ||
1737 | 28 | . /etc/orange-box.conf | ||
1738 | 29 | |||
1739 | 27 | juju status && echo "Existing deployment found, exiting." && exit 0 | 30 | juju status && echo "Existing deployment found, exiting." && exit 0 |
1741 | 28 | juju bootstrap --to node0vm0.maas --show-log --upload-tools | 31 | ###juju bootstrap --to node0ob${orangebox_number}vm0.maas --show-log --upload-tools |
1742 | 32 | juju bootstrap --to node0vm0ob${orangebox_number}.maas --show-log --upload-tools | ||
1743 | 29 | juju set-constraints "tags=" | 33 | juju set-constraints "tags=" |
1744 | 30 | juju deploy --to 0 --repository=/srv/charmstore/ local:trusty/juju-gui | 34 | juju deploy --to 0 --repository=/srv/charmstore/ local:trusty/juju-gui |
1745 | 31 | juju expose juju-gui | 35 | juju expose juju-gui |
1746 | 32 | 36 | ||
1747 | === modified file 'usr/bin/orange-box-create-package-mirror' | |||
1748 | --- usr/bin/orange-box-create-package-mirror 2015-01-21 22:04:42 +0000 | |||
1749 | +++ usr/bin/orange-box-create-package-mirror 2015-07-17 17:14:52 +0000 | |||
1750 | @@ -27,7 +27,9 @@ | |||
1751 | 27 | fi | 27 | fi |
1752 | 28 | 28 | ||
1753 | 29 | home=$PWD | 29 | home=$PWD |
1755 | 30 | IP=10.14.4.1 | 30 | . /etc/orange-box.conf |
1756 | 31 | |||
1757 | 32 | IP=172.27.${orangebox_number}.1 | ||
1758 | 31 | 33 | ||
1759 | 32 | function run_mirror { | 34 | function run_mirror { |
1760 | 33 | echo "apt-mirror /etc/apt/orange-box-mirror.list >>/var/log/orange-box-mirror.log 2>&1" | 35 | echo "apt-mirror /etc/apt/orange-box-mirror.list >>/var/log/orange-box-mirror.log 2>&1" |
1761 | @@ -95,6 +97,17 @@ | |||
1762 | 95 | echo Making mirror directories ... | 97 | echo Making mirror directories ... |
1763 | 96 | mkdir -p /srv/mirrors /srv/skel /srv/var | 98 | mkdir -p /srv/mirrors /srv/skel /srv/var |
1764 | 97 | 99 | ||
1765 | 100 | echo Creating postmirror.sh script ... | ||
1766 | 101 | # This created a blank file, for some reason :/ | ||
1767 | 102 | echo << 'EOF' > /srv/var/postmirror.sh | ||
1768 | 103 | #!/bin/sh | ||
1769 | 104 | /srv/var/clean.sh | ||
1770 | 105 | EOF | ||
1771 | 106 | |||
1772 | 107 | echo Making postmirror.sh executable ... | ||
1773 | 108 | chmod +x /srv/var/postmirror.sh | ||
1774 | 109 | echo Done. && echo | ||
1775 | 110 | |||
1776 | 98 | echo Setting up the web dirs for mirroring ... | 111 | echo Setting up the web dirs for mirroring ... |
1777 | 99 | ln -s /srv/mirrors/archive.ubuntu.com/ubuntu /var/www/html/archive.ubuntu.com | 112 | ln -s /srv/mirrors/archive.ubuntu.com/ubuntu /var/www/html/archive.ubuntu.com |
1778 | 100 | ln -s /srv/mirrors/ubuntu-cloud.archive.canonical.com/ubuntu /var/www/html/ubuntu-cloud.archive.canonical.com | 113 | ln -s /srv/mirrors/ubuntu-cloud.archive.canonical.com/ubuntu /var/www/html/ubuntu-cloud.archive.canonical.com |
1779 | 101 | 114 | ||
1780 | === modified file 'usr/bin/orange-box-demo-cleanup' | |||
1781 | --- usr/bin/orange-box-demo-cleanup 2014-10-23 22:18:49 +0000 | |||
1782 | +++ usr/bin/orange-box-demo-cleanup 2015-07-17 17:14:52 +0000 | |||
1783 | @@ -20,6 +20,8 @@ | |||
1784 | 20 | 20 | ||
1785 | 21 | ENVIRONMENT=`juju env` | 21 | ENVIRONMENT=`juju env` |
1786 | 22 | 22 | ||
1787 | 23 | . /etc/orange-box.conf | ||
1788 | 24 | |||
1789 | 23 | #Destroy juju environment | 25 | #Destroy juju environment |
1790 | 24 | juju destroy-environment $ENVIRONMENT | 26 | juju destroy-environment $ENVIRONMENT |
1791 | 25 | #make sure AMTs are all powered off | 27 | #make sure AMTs are all powered off |
1792 | @@ -27,6 +29,6 @@ | |||
1793 | 27 | if dpkg --compare-versions $maas_ver lt 1.6; then | 29 | if dpkg --compare-versions $maas_ver lt 1.6; then |
1794 | 28 | export AMT_PASSWORD=Password1+ | 30 | export AMT_PASSWORD=Password1+ |
1795 | 29 | for i in $(seq 11 19); do | 31 | for i in $(seq 11 19); do |
1797 | 30 | yes | amttool 10.14.4.$i powerdown >/dev/null 2>&1 | 32 | yes | amttool 172.27.${orangebox_number}.$i powerdown >/dev/null 2>&1 |
1798 | 31 | done | 33 | done |
1799 | 32 | fi | 34 | fi |
1800 | 33 | 35 | ||
1801 | === added file 'usr/bin/orange-box-hacks' | |||
1802 | --- usr/bin/orange-box-hacks 1970-01-01 00:00:00 +0000 | |||
1803 | +++ usr/bin/orange-box-hacks 2015-07-17 17:14:52 +0000 | |||
1804 | @@ -0,0 +1,32 @@ | |||
1805 | 1 | #!/bin/sh | ||
1806 | 2 | |||
1807 | 3 | okay() { | ||
1808 | 4 | echo "OK: $@" | ||
1809 | 5 | } | ||
1810 | 6 | |||
1811 | 7 | error() { | ||
1812 | 8 | echo "ERROR: $@" | ||
1813 | 9 | } | ||
1814 | 10 | |||
1815 | 11 | # Check powerstate in AMT | ||
1816 | 12 | for i in $(seq 1 9); do | ||
1817 | 13 | amtoutput=$(yes | amttool 10.14.4.1${i} info) | ||
1818 | 14 | if [ "$amthostname" = "node${i}amt" ]; then | ||
1819 | 15 | okay "[node${i}]: AMT is responsive" | ||
1820 | 16 | else | ||
1821 | 17 | error "[node${i}]: AMT is not responsive" | ||
1822 | 18 | fi | ||
1823 | 19 | amtpowerstate=$(echo "$amtoutput" | grep "^Powerstate:" | awk '{print $2}') | ||
1824 | 20 | if [ -n "$amtpowerstate" ]; then | ||
1825 | 21 | okay "[node${i}]: AMT powerstate [$amtpowerstate]" | ||
1826 | 22 | else | ||
1827 | 23 | error "[node${i}]: AMT powerstate unknown [$amtpowerstate]" | ||
1828 | 24 | fi | ||
1829 | 25 | uptime=$(ssh node$i.maas "uptime" 2>/dev/null) | ||
1830 | 26 | if [ -n "$uptime" ]; then | ||
1831 | 27 | okay "[node${i}]: SSH to node successful; uptime=[$uptime]" | ||
1832 | 28 | else | ||
1833 | 29 | error "[node${i}]: SSH to node unsuccessful; uptime=[$uptime]" | ||
1834 | 30 | fi | ||
1835 | 31 | echo | ||
1836 | 32 | done | ||
1837 | 0 | 33 | ||
1838 | === added file 'usr/bin/orange-box-mirror' | |||
1839 | --- usr/bin/orange-box-mirror 1970-01-01 00:00:00 +0000 | |||
1840 | +++ usr/bin/orange-box-mirror 2015-07-17 17:14:52 +0000 | |||
1841 | @@ -0,0 +1,235 @@ | |||
1842 | 1 | #!/bin/bash | ||
1843 | 2 | # | ||
1844 | 3 | # orange-box-mirror | ||
1845 | 4 | # Copyright (C) 2014 Canonical Ltd. | ||
1846 | 5 | # | ||
1847 | 6 | # Authors: Nicolas Thomas <nicolas.thomas@canonical.com> | ||
1848 | 7 | # | ||
1849 | 8 | # This program is free software: you can redistribute it and/or modify | ||
1850 | 9 | # it under the terms of the GNU General Public License as published by | ||
1851 | 10 | # the Free Software Foundation, version 3 of the License. | ||
1852 | 11 | # | ||
1853 | 12 | # This program is distributed in the hope that it will be useful, | ||
1854 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1855 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1856 | 15 | # GNU General Public License for more details. | ||
1857 | 16 | # | ||
1858 | 17 | # You should have received a copy of the GNU General Public License | ||
1859 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1860 | 19 | |||
1861 | 20 | set -ex | ||
1862 | 21 | . /etc/orange-box.conf | ||
1863 | 22 | #TODO# merge State in orange-box.conf | ||
1864 | 23 | STATE=`cat /etc/orangebox-mirror.state` | ||
1865 | 24 | |||
1866 | 25 | # looking for inconsistency / self healing | ||
1867 | 26 | dig +short xyz.archive.ubuntu.com | grep 172.27.${orangebox_number}.1 > /dev/null && CHECKEDSTATE=ENABLED || CHECKEDSTATE=DISABLED | ||
1868 | 27 | if [[ $STATE != $CHECKEDSTATE ]] | ||
1869 | 28 | then | ||
1870 | 29 | if [[ $STATE == MIRRORING ]] | ||
1871 | 30 | then | ||
1872 | 31 | echo "WAS MIRRORING" | ||
1873 | 32 | # IF nobody use the log then it is not mirroring | ||
1874 | 33 | if ( sudo fuser /var/log/orange-box-mirror.log ) | ||
1875 | 34 | then | ||
1876 | 35 | CHECKEDSTATE=MIRRORING | ||
1877 | 36 | else | ||
1878 | 37 | dig +short xyz.archive.ubuntu.com | grep 172.27.${orangebox_number}.1 && CHECKEDSTATE=ENABLED || CHECKEDSTATE=DISABLED | ||
1879 | 38 | fi | ||
1880 | 39 | fi | ||
1881 | 40 | STATE=$CHECKEDSTATE | ||
1882 | 41 | echo $CHECKEDSTATE > /etc/orangebox-mirror.state | ||
1883 | 42 | echo "Some script end up in error or been screwed healing" | ||
1884 | 43 | fi | ||
1885 | 44 | |||
1886 | 45 | is-root() | ||
1887 | 46 | { | ||
1888 | 47 | if [ "$(id -u)" != "0" ]; then | ||
1889 | 48 | echo "Must be run with sudo or by root" | ||
1890 | 49 | exit 77 | ||
1891 | 50 | fi | ||
1892 | 51 | } | ||
1893 | 52 | |||
1894 | 53 | control_c() | ||
1895 | 54 | # run if user hits control-c | ||
1896 | 55 | { | ||
1897 | 56 | echo -en "\n*** Ouch! Exiting ***\n" | ||
1898 | 57 | [[ $STATE = MIRRORING ]] && echo "DISABLED" > /etc/orangebox-mirror.state | ||
1899 | 58 | exit $? | ||
1900 | 59 | } | ||
1901 | 60 | |||
1902 | 61 | # trap keyboard interrupt (control-c) | ||
1903 | 62 | trap control_c SIGINT | ||
1904 | 63 | |||
1905 | 64 | |||
1906 | 65 | usage() | ||
1907 | 66 | { | ||
1908 | 67 | cat << EOF | ||
1909 | 68 | |||
1910 | 69 | orange-box-mirror - control usage and sync of local to OrangeBox mirrors | ||
1911 | 70 | |||
1912 | 71 | USAGE: <action> | ||
1913 | 72 | |||
1914 | 73 | The options must be passed as follows: | ||
1915 | 74 | <action> | ||
1916 | 75 | enable - enable dns modification to point to local | ||
1917 | 76 | disable - disable usage of the local mirror | ||
1918 | 77 | sync - synchronize the mirror with archive disabling it during sync | ||
1919 | 78 | status - describe current state | ||
1920 | 79 | |||
1921 | 80 | Note: actions requires root privileges use sudo | ||
1922 | 81 | |||
1923 | 82 | EOF | ||
1924 | 83 | exit 0 | ||
1925 | 84 | } | ||
1926 | 85 | |||
1927 | 86 | enable-dns-usage() | ||
1928 | 87 | { | ||
1929 | 88 | [[ $STATE = MIRRORING ]] && { echo "wait for mirroring to end"; exit 2; } | ||
1930 | 89 | [[ $STATE = ENABLED ]] && { echo "Already enabled"; exit 0; } | ||
1931 | 90 | is-root | ||
1932 | 91 | |||
1933 | 92 | #important for templating | ||
1934 | 93 | export TTL='$TTL' | ||
1935 | 94 | PWDBACK=$PWD | ||
1936 | 95 | rm -f /etc/bind/named.conf.orange-box-mirror | ||
1937 | 96 | touch /etc/bind/named.conf.orange-box-mirror | ||
1938 | 97 | for web_site in archive.ubuntu.com cdimage.ubuntu.com cloud-images.ubuntu.com releases.ubuntu.com ubuntu-cloud.archive.canonical.com | ||
1939 | 98 | do | ||
1940 | 99 | |||
1941 | 100 | a2ensite ${web_site} | ||
1942 | 101 | ## TODO check sed regex if name are other then a-z and "-" | ||
1943 | 102 | |||
1944 | 103 | ## MUST export for envsubst to work | ||
1945 | 104 | export web_site | ||
1946 | 105 | export web_site_root=`echo ${web_site} |sed 's/^[a-z,-]*.//'` | ||
1947 | 106 | export orangebox_number | ||
1948 | 107 | |||
1949 | 108 | envsubst < /usr/lib/orange-box/templates/mirror-bind/zones.template > /etc/bind/zones.${web_site} | ||
1950 | 109 | |||
1951 | 110 | envsubst < /usr/lib/orange-box/templates/mirror-bind/named.conf.template >> /etc/bind/named.conf.orange-box-mirror | ||
1952 | 111 | done | ||
1953 | 112 | # avoid conflict in etc/ files with ubumirror | ||
1954 | 113 | envsubst < /usr/lib/orange-box/templates/ubumirror.conf > /etc/ubumirror.conf | ||
1955 | 114 | |||
1956 | 115 | # make sure no duplicates and enable only if reach that point | ||
1957 | 116 | TMPFILE=`mktemp` | ||
1958 | 117 | grep -v "named.conf.orange-box-mirror" /etc/bind/named.conf > $TMPFILE || echo "was already off continue" | ||
1959 | 118 | mv $TMPFILE /etc/bind/named.conf | ||
1960 | 119 | chown bind:bind /etc/bind/named.conf | ||
1961 | 120 | echo 'include "/etc/bind/named.conf.orange-box-mirror";' >> /etc/bind/named.conf | ||
1962 | 121 | service bind9 restart | ||
1963 | 122 | service apache2 restart | ||
1964 | 123 | echo "ENABLED" > /etc/orangebox-mirror.state | ||
1965 | 124 | } | ||
1966 | 125 | |||
1967 | 126 | disable-dns-usage() | ||
1968 | 127 | { | ||
1969 | 128 | [[ $STATE = MIRRORING ]] && { echo "Mirroring in progress usage disabled"; exit 0; } | ||
1970 | 129 | [[ $STATE = DISABLED ]] && { echo "Already disabled"; exit 0; } | ||
1971 | 130 | is-root | ||
1972 | 131 | TMPFILE=`mktemp` | ||
1973 | 132 | grep -v "named.conf.orange-box-mirror" /etc/bind/named.conf > $TMPFILE || echo "was already off continue" | ||
1974 | 133 | mv $TMPFILE /etc/bind/named.conf | ||
1975 | 134 | chown bind:bind /etc/bind/named.conf | ||
1976 | 135 | service bind9 restart | ||
1977 | 136 | echo "DISABLED" > /etc/orangebox-mirror.state | ||
1978 | 137 | } | ||
1979 | 138 | |||
1980 | 139 | sync-mirror() | ||
1981 | 140 | { | ||
1982 | 141 | [[ $STATE = MIRRORING ]] && { echo "already mirroring" ;exit 2; } | ||
1983 | 142 | PREVIOUSSTATE=$STATE | ||
1984 | 143 | #trick to not rewrite disabling | ||
1985 | 144 | STATE="ENABLED" | ||
1986 | 145 | disable-dns-usage | ||
1987 | 146 | echo "MIRRORING" > /etc/orangebox-mirror.state | ||
1988 | 147 | |||
1989 | 148 | echo "Updating cloud-archive mirror" | ||
1990 | 149 | /usr/bin/lftp -c mirror -eP=8 -x icons http://ubuntu-cloud.archive.canonical.com /srv/mirrors/ubuntu-cloud.archive.canonical.com | ||
1991 | 150 | |||
1992 | 151 | echo "Updating cloud-images mirror" | ||
1993 | 152 | |||
1994 | 153 | ROOTDIR="/srv/mirrors/" | ||
1995 | 154 | RELEASES="precise trusty" | ||
1996 | 155 | |||
1997 | 156 | cd $ROOTDIR | ||
1998 | 157 | lftp -c mirror -eP=4 http://cloud-images.ubuntu.com/query | ||
1999 | 158 | for r in $RELEASES | ||
2000 | 159 | do | ||
2001 | 160 | cd $ROOTDIR/ | ||
2002 | 161 | IDREL=`grep $r cloud-images.ubuntu.com/query/released.latest.txt |awk '{print $4}' ` | ||
2003 | 162 | IDDAY=`grep -e "server" cloud-images.ubuntu.com/query/daily.latest.txt| grep -v "server-"|grep $r |awk '{print $4}' ` | ||
2004 | 163 | mkdir -p $ROOTDIR/cloud-images.ubuntu.com/server/releases/$r/ | ||
2005 | 164 | cd $ROOTDIR/cloud-images.ubuntu.com/server/releases/$r/ | ||
2006 | 165 | lftp -c mirror -eP=4 http://cloud-images.ubuntu.com/server/releases/$r/release-$IDREL/ | ||
2007 | 166 | mkdir -p $ROOTDIR/cloud-images.ubuntu.com/releases/$r/ | ||
2008 | 167 | cd $ROOTDIR/cloud-images.ubuntu.com/releases/$r/ | ||
2009 | 168 | lftp -c mirror -eP=4 http://cloud-images.ubuntu.com/releases/$r/release-$IDREL/ | ||
2010 | 169 | |||
2011 | 170 | mkdir -p $ROOTDIR/cloud-images.ubuntu.com/server/daily/$r/ | ||
2012 | 171 | cd $ROOTDIR/cloud-images.ubuntu.com/server/daily/$r/ | ||
2013 | 172 | lftp -c mirror -eP=4 http://cloud-images.ubuntu.com/server/daily/$r/$IDDAY/ || true | ||
2014 | 173 | |||
2015 | 174 | mkdir -p $ROOTDIR/cloud-images.ubuntu.com/daily/server/$r/ | ||
2016 | 175 | cd $ROOTDIR/cloud-images.ubuntu.com/daily/server/$r/ | ||
2017 | 176 | lftp -c mirror -eP=4 http://cloud-images.ubuntu.com/daily/server/$r/$IDDAY/ | ||
2018 | 177 | |||
2019 | 178 | done | ||
2020 | 179 | |||
2021 | 180 | |||
2022 | 181 | echo " apt mirror sync .... " | ||
2023 | 182 | cat > /srv/var/postmirror.sh<<EOF | ||
2024 | 183 | wget -nH --cut-dirs 4 -r --no-parent -P /srv/mirrors/archive.ubuntu.com/ubuntu/dists/trusty-updates/main/ http://archive.ubuntu.com/ubuntu/dists/trusty/main/uefi/grub2-amd64/ | ||
2025 | 184 | |||
2026 | 185 | EOF | ||
2027 | 186 | chmod 755 /srv/var/postmirror.sh | ||
2028 | 187 | run-one apt-mirror /etc/apt/orange-box-mirror.list |tee -a /var/log/orange-box-mirror.log | ||
2029 | 188 | |||
2030 | 189 | |||
2031 | 190 | run-one sstream-mirror --keyring=/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg http://maas.ubuntu.com/images/ephemeral-v2/daily/ /var/www/html/maas/images/ephemeral-v2/daily 'arch=amd64' 'subarch~(generic|hwe-t)' 'release~(trusty|precise)' --max=1 | ||
2032 | 191 | run-one sstream-mirror --keyring=/usr/share/keyrings/ubuntu-cloudimage-keyring.gpg http://maas.ubuntu.com/images/ephemeral-v2/releases/ /var/www/html/maas/images/ephemeral-v2/releases 'arch=amd64' 'subarch~(generic|hwe-t)' 'release~(trusty|precise)' --max=1 | ||
2033 | 192 | |||
2034 | 193 | maas admin boot-source update 1 url="http://172.27.${orangebox_number}.1/maas/images/ephemeral-v2/daily/streams/v1/index.sjson" | ||
2035 | 194 | |||
2036 | 195 | |||
2037 | 196 | |||
2038 | 197 | chmod -R g+rx,o+rx /srv/mirrors/*.com | ||
2039 | 198 | echo "SYNCED" > /etc/orangebox-mirror.state | ||
2040 | 199 | STATE=SYNCED | ||
2041 | 200 | case $PREVIOUSSTATE in | ||
2042 | 201 | ENABLED) | ||
2043 | 202 | enable-dns-usage | ||
2044 | 203 | ;; | ||
2045 | 204 | DISABLED) | ||
2046 | 205 | disable-dns-usage | ||
2047 | 206 | ;; | ||
2048 | 207 | esac | ||
2049 | 208 | } | ||
2050 | 209 | |||
2051 | 210 | status() | ||
2052 | 211 | { | ||
2053 | 212 | echo "This OrangeBox state is "$STATE | ||
2054 | 213 | } | ||
2055 | 214 | |||
2056 | 215 | [ $# -lt 1 ] && usage | ||
2057 | 216 | |||
2058 | 217 | ACTION=$1 | ||
2059 | 218 | |||
2060 | 219 | case $ACTION in | ||
2061 | 220 | enable) | ||
2062 | 221 | enable-dns-usage | ||
2063 | 222 | ;; | ||
2064 | 223 | disable) | ||
2065 | 224 | disable-dns-usage | ||
2066 | 225 | ;; | ||
2067 | 226 | sync) | ||
2068 | 227 | sync-mirror | ||
2069 | 228 | ;; | ||
2070 | 229 | status) | ||
2071 | 230 | status | ||
2072 | 231 | ;; | ||
2073 | 232 | *) | ||
2074 | 233 | usage | ||
2075 | 234 | ;; | ||
2076 | 235 | esac | ||
2077 | 0 | 236 | ||
2078 | === modified file 'usr/bin/orange-box-purge-everything' | |||
2079 | --- usr/bin/orange-box-purge-everything 2014-10-08 11:51:07 +0000 | |||
2080 | +++ usr/bin/orange-box-purge-everything 2015-07-17 17:14:52 +0000 | |||
2081 | @@ -21,6 +21,7 @@ | |||
2082 | 21 | 21 | ||
2083 | 22 | sudo apt-get purge $(dpkg -l | egrep "orange-box|maas|squid" | awk '{print $2}') bind9 | 22 | sudo apt-get purge $(dpkg -l | egrep "orange-box|maas|squid" | awk '{print $2}') bind9 |
2084 | 23 | rm -rf /srv/boot-resources/* /etc/bind /root/.maascli.db | 23 | rm -rf /srv/boot-resources/* /etc/bind /root/.maascli.db |
2085 | 24 | rm -rf /home/ubuntu/.juju/environments/ | ||
2086 | 24 | echo | 25 | echo |
2087 | 25 | echo "=== IT IS HIGHLY RECOMMENDED THAT YOU REBOOT NOW! ===" | 26 | echo "=== IT IS HIGHLY RECOMMENDED THAT YOU REBOOT NOW! ===" |
2088 | 26 | echo | 27 | echo |
2089 | 27 | 28 | ||
2090 | === added file 'usr/bin/orange-box-resetproxy' | |||
2091 | --- usr/bin/orange-box-resetproxy 1970-01-01 00:00:00 +0000 | |||
2092 | +++ usr/bin/orange-box-resetproxy 2015-07-17 17:14:52 +0000 | |||
2093 | @@ -0,0 +1,34 @@ | |||
2094 | 1 | #!/bin/bash | ||
2095 | 2 | # | ||
2096 | 3 | # orange-box-resetproxy | ||
2097 | 4 | # Copyright (C) 2014 Canonical Ltd. | ||
2098 | 5 | # | ||
2099 | 6 | # Authors: Nicolas Thomas <nicolas.thomas@canonical.com> | ||
2100 | 7 | # | ||
2101 | 8 | # This program is free software: you can redistribute it and/or modify | ||
2102 | 9 | # it under the terms of the GNU General Public License as published by | ||
2103 | 10 | # the Free Software Foundation, version 3 of the License. | ||
2104 | 11 | # | ||
2105 | 12 | # This program is distributed in the hope that it will be useful, | ||
2106 | 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2107 | 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2108 | 15 | # GNU General Public License for more details. | ||
2109 | 16 | # | ||
2110 | 17 | # You should have received a copy of the GNU General Public License | ||
2111 | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2112 | 19 | |||
2113 | 20 | set -ex | ||
2114 | 21 | # Only run this as root | ||
2115 | 22 | if [ $EUID -ne 0 ] | ||
2116 | 23 | then | ||
2117 | 24 | echo Execute as root or with \"sudo $0\" | ||
2118 | 25 | exit 1 | ||
2119 | 26 | fi | ||
2120 | 27 | |||
2121 | 28 | |||
2122 | 29 | |||
2123 | 30 | service maas-proxy stop | ||
2124 | 31 | rm -rf /var/spool/maas-proxy/* | ||
2125 | 32 | squid3 -z -f /etc/maas/maas-proxy.conf | ||
2126 | 33 | sleep 20 | ||
2127 | 34 | service maas-proxy start | ||
2128 | 0 | 35 | ||
2129 | === modified file 'usr/bin/orange-box-run' | |||
2130 | --- usr/bin/orange-box-run 2014-06-11 01:00:16 +0000 | |||
2131 | +++ usr/bin/orange-box-run 2015-07-17 17:14:52 +0000 | |||
2132 | @@ -24,22 +24,25 @@ | |||
2133 | 24 | cmd="tail -f /var/log/cloud-init-output.log | ccze -A" | 24 | cmd="tail -f /var/log/cloud-init-output.log | ccze -A" |
2134 | 25 | fi | 25 | fi |
2135 | 26 | 26 | ||
2154 | 27 | tmux new-window -n all-nodes "ssh node1.maas $cmd" \; \ | 27 | ## According to OB network re-design |
2155 | 28 | split-window -v "ssh node2.maas $cmd" \; \ | 28 | . /etc/orange-box.conf |
2156 | 29 | select-layout tiled \; \ | 29 | |
2157 | 30 | split-window -h "ssh node2.maas $cmd" \; \ | 30 | tmux new-window -n all-nodes "ssh node1ob${orangebox_number}.maas $cmd" \; \ |
2158 | 31 | select-layout tiled \; \ | 31 | split-window -v "ssh node2ob${orangebox_number}.maas $cmd" \; \ |
2159 | 32 | split-window -v "ssh node3.maas $cmd" \; \ | 32 | select-layout tiled \; \ |
2160 | 33 | select-layout tiled \; \ | 33 | split-window -h "ssh node2ob${orangebox_number}.maas $cmd" \; \ |
2161 | 34 | split-window -h "ssh node4.maas $cmd" \; \ | 34 | select-layout tiled \; \ |
2162 | 35 | select-layout tiled \; \ | 35 | split-window -v "ssh node3ob${orangebox_number}.maas $cmd" \; \ |
2163 | 36 | split-window -v "ssh node5.maas $cmd" \; \ | 36 | select-layout tiled \; \ |
2164 | 37 | select-layout tiled \; \ | 37 | split-window -h "ssh node4ob${orangebox_number}.maas $cmd" \; \ |
2165 | 38 | split-window -h "ssh node6.maas $cmd" \; \ | 38 | select-layout tiled \; \ |
2166 | 39 | select-layout tiled \; \ | 39 | split-window -v "ssh node5ob${orangebox_number}.maas $cmd" \; \ |
2167 | 40 | split-window -v "ssh node7.maas $cmd" \; \ | 40 | select-layout tiled \; \ |
2168 | 41 | select-layout tiled \; \ | 41 | split-window -h "ssh node6ob${orangebox_number}.maas $cmd" \; \ |
2169 | 42 | split-window -h "ssh node8.maas $cmd" \; \ | 42 | select-layout tiled \; \ |
2170 | 43 | select-layout tiled \; \ | 43 | split-window -v "ssh node7ob${orangebox_number}.maas $cmd" \; \ |
2171 | 44 | split-window -v "ssh node9.maas $cmd" \; \ | 44 | select-layout tiled \; \ |
2172 | 45 | split-window -h "ssh node8ob${orangebox_number}.maas $cmd" \; \ | ||
2173 | 46 | select-layout tiled \; \ | ||
2174 | 47 | split-window -v "ssh node9ob${orangebox_number}.maas $cmd" \; \ | ||
2175 | 45 | select-layout tiled | 48 | select-layout tiled |
2176 | 46 | 49 | ||
2177 | === added file 'usr/bin/orange-box-setup-nat' | |||
2178 | --- usr/bin/orange-box-setup-nat 1970-01-01 00:00:00 +0000 | |||
2179 | +++ usr/bin/orange-box-setup-nat 2015-07-17 17:14:52 +0000 | |||
2180 | @@ -0,0 +1,127 @@ | |||
2181 | 1 | #!/bin/bash | ||
2182 | 2 | # | ||
2183 | 3 | # orange-box-setup-nat - Setup NAT for external network access by nodes | ||
2184 | 4 | # Copyright (C) 2014 Canonical Ltd. | ||
2185 | 5 | # | ||
2186 | 6 | # Authors: Ronald McCollam <ronald.mccollam@canonical.com> | ||
2187 | 7 | # Dustin Kirkland <kirkland@canonical.com> | ||
2188 | 8 | # | ||
2189 | 9 | # This program is free software: you can redistribute it and/or modify | ||
2190 | 10 | # it under the terms of the GNU General Public License as published by | ||
2191 | 11 | # the Free Software Foundation, version 3 of the License. | ||
2192 | 12 | # | ||
2193 | 13 | # This program is distributed in the hope that it will be useful, | ||
2194 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2195 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2196 | 16 | # GNU General Public License for more details. | ||
2197 | 17 | # | ||
2198 | 18 | # You should have received a copy of the GNU General Public License | ||
2199 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2200 | 20 | |||
2201 | 21 | set -x | ||
2202 | 22 | |||
2203 | 23 | if [ "$(id -u)" != "0" ]; then | ||
2204 | 24 | echo "Must be run with sudo or by root" | ||
2205 | 25 | exit 77 | ||
2206 | 26 | fi | ||
2207 | 27 | |||
2208 | 28 | # Don't bother to restart sshd when lo is configured. | ||
2209 | 29 | if [ "$IFACE" = lo ]; then | ||
2210 | 30 | exit 0 | ||
2211 | 31 | fi | ||
2212 | 32 | |||
2213 | 33 | # According to OB network re-design | ||
2214 | 34 | . /etc/orange-box.conf | ||
2215 | 35 | |||
2216 | 36 | |||
2217 | 37 | ##internal=$(route -n | grep "^10\.14\." | sed -e "s/.* //") | ||
2218 | 38 | internal=$(route -n | grep "^172\.27\.${orangebox_number}\." | sed -e "s/.* //") | ||
2219 | 39 | external=$(ip route ls | grep ^default | awk '{print $5}') | ||
2220 | 40 | |||
2221 | 41 | if [ -z "$internal" ] || [ -z "$external" ]; then | ||
2222 | 42 | echo "usage: $0 [INTERNAL_INTERFACE] [EXTERNAL_INTERFACE]" 1>&2 | ||
2223 | 43 | exit 1 | ||
2224 | 44 | fi | ||
2225 | 45 | |||
2226 | 46 | set -e | ||
2227 | 47 | |||
2228 | 48 | # Update MAAS upstream DNS | ||
2229 | 49 | maas admin maas set-config name=upstream_dns value=172.27.252.1 || true | ||
2230 | 50 | |||
2231 | 51 | # Intel Centrino Advanced-N 6235 and Ubuntu don't work well with Wireless-N | ||
2232 | 52 | if lspci -v 2>/dev/null | grep -qs "Centrino Advanced-N 6235" 2>/dev/null; then | ||
2233 | 53 | sed -i -e "/options iwlwifi 11n_disable=1/d" /etc/modprobe.d/iwlwifi.conf | ||
2234 | 54 | echo "options iwlwifi 11n_disable=1" >> /etc/modprobe.d/iwlwifi.conf | ||
2235 | 55 | fi | ||
2236 | 56 | |||
2237 | 57 | # Configure NAT and IP forwarding, giving slave NUCs external network access | ||
2238 | 58 | # through the master. | ||
2239 | 59 | |||
2240 | 60 | # Enable IP forwarding and save for next boot | ||
2241 | 61 | echo 1 > /proc/sys/net/ipv4/ip_forward | ||
2242 | 62 | echo "net.ipv4.ip_forward=1" > /etc/sysctl.d/10-maas-ip-forward.conf | ||
2243 | 63 | echo "net.ipv4.conf.all.accept_redirects=1 >> /etc/sysctl.d/10-maas-ip-forward.conf" | ||
2244 | 64 | echo "net.ipv6.conf.all.accept_redirects=1 >> /etc/sysctl.d/10-maas-ip-forward.conf" | ||
2245 | 65 | echo "net.ipv4.conf.all.send_redirects=1 >> /etc/sysctl.d/10-maas-ip-forward.conf" | ||
2246 | 66 | sysctl --system | ||
2247 | 67 | |||
2248 | 68 | #Create the static ip tables for multi OBs. | ||
2249 | 69 | cat > /etc/rc.local <<EOF | ||
2250 | 70 | #!/bin/sh -e | ||
2251 | 71 | # | ||
2252 | 72 | # rc.local | ||
2253 | 73 | # | ||
2254 | 74 | # This script is executed at the end of each multiuser runlevel. | ||
2255 | 75 | # Make sure that the script will "exit 0" on success or any other | ||
2256 | 76 | # value on error. | ||
2257 | 77 | # | ||
2258 | 78 | # In order to enable or disable this script just change the execution | ||
2259 | 79 | # bits. | ||
2260 | 80 | # | ||
2261 | 81 | # By default this script does nothing. | ||
2262 | 82 | |||
2263 | 83 | EOF | ||
2264 | 84 | for obn in `seq 4 4 80` | ||
2265 | 85 | do | ||
2266 | 86 | [[ $obn == ${orangebox_number} ]] ||echo " ip route add 172.27.$obn.0/22 via 172.27.252.$obn " >> /etc/rc.local | ||
2267 | 87 | done | ||
2268 | 88 | echo "exit 0" >> /etc/rc.local | ||
2269 | 89 | |||
2270 | 90 | # Note that this script assumes no existing iptables rules. If you do have | ||
2271 | 91 | # any, they will be deleted. | ||
2272 | 92 | iptables --flush | ||
2273 | 93 | iptables --table nat --flush | ||
2274 | 94 | iptables --delete-chain | ||
2275 | 95 | iptables --table nat --delete-chain | ||
2276 | 96 | |||
2277 | 97 | # Firewalling this machine | ||
2278 | 98 | # Allow incoming SSH | ||
2279 | 99 | iptables -A INPUT -i $external -p tcp --dport 22 -j ACCEPT | ||
2280 | 100 | iptables -A INPUT -i $external -m state --state ESTABLISHED,RELATED -j ACCEPT | ||
2281 | 101 | ###iptables -A INPUT -i $external -j DROP | ||
2282 | 102 | |||
2283 | 103 | # Some things use the MAAS proxy - some things don't. So turn on NAT. | ||
2284 | 104 | echo "Setting up ip forwarding" | ||
2285 | 105 | iptables -t nat -A POSTROUTING -o $external -j MASQUERADE | ||
2286 | 106 | iptables -A FORWARD -i $external -o $internal -m state --state RELATED,ESTABLISHED -j ACCEPT | ||
2287 | 107 | iptables -A FORWARD -i $internal -o $external -j ACCEPT | ||
2288 | 108 | # The following line sets up a transparent proxy | ||
2289 | 109 | iptables -A PREROUTING -t nat -i br0 -p tcp -m multiport --dports 80 -j REDIRECT --to-port 3128 | ||
2290 | 110 | |||
2291 | 111 | iptables-save > /etc/iptables/rules.v4 | ||
2292 | 112 | |||
2293 | 113 | # 14.10 deprecates the iptables-persistent service in favor of netfilter-persistent | ||
2294 | 114 | service iptables-persistent restart || service netfilter-persistent restart | ||
2295 | 115 | |||
2296 | 116 | # It seems we need to restart squid3 after making these network changes | ||
2297 | 117 | maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}') | ||
2298 | 118 | if dpkg --compare-versions $maas_ver lt 1.6; then | ||
2299 | 119 | # We now run squid3, and NOT squid-deb-proxy | ||
2300 | 120 | update-rc.d -f squid-deb-proxy remove || true | ||
2301 | 121 | service squid-deb-proxy stop || true | ||
2302 | 122 | service squid3 stop || true | ||
2303 | 123 | service squid3 start | ||
2304 | 124 | else | ||
2305 | 125 | service maas-proxy stop || true | ||
2306 | 126 | service maas-proxy start || true | ||
2307 | 127 | fi | ||
2308 | 0 | 128 | ||
2309 | === removed file 'usr/bin/orange-box-setup-nat' | |||
2310 | --- usr/bin/orange-box-setup-nat 2014-10-08 11:51:07 +0000 | |||
2311 | +++ usr/bin/orange-box-setup-nat 1970-01-01 00:00:00 +0000 | |||
2312 | @@ -1,99 +0,0 @@ | |||
2313 | 1 | #!/bin/bash | ||
2314 | 2 | # | ||
2315 | 3 | # orange-box-setup-nat - Setup NAT for external network access by nodes | ||
2316 | 4 | # Copyright (C) 2014 Canonical Ltd. | ||
2317 | 5 | # | ||
2318 | 6 | # Authors: Ronald McCollam <ronald.mccollam@canonical.com> | ||
2319 | 7 | # Dustin Kirkland <kirkland@canonical.com> | ||
2320 | 8 | # | ||
2321 | 9 | # This program is free software: you can redistribute it and/or modify | ||
2322 | 10 | # it under the terms of the GNU General Public License as published by | ||
2323 | 11 | # the Free Software Foundation, version 3 of the License. | ||
2324 | 12 | # | ||
2325 | 13 | # This program is distributed in the hope that it will be useful, | ||
2326 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2327 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2328 | 16 | # GNU General Public License for more details. | ||
2329 | 17 | # | ||
2330 | 18 | # You should have received a copy of the GNU General Public License | ||
2331 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2332 | 20 | |||
2333 | 21 | set -x | ||
2334 | 22 | |||
2335 | 23 | if [ "$(id -u)" != "0" ]; then | ||
2336 | 24 | echo "Must be run with sudo or by root" | ||
2337 | 25 | exit 77 | ||
2338 | 26 | fi | ||
2339 | 27 | |||
2340 | 28 | # Don't bother to restart sshd when lo is configured. | ||
2341 | 29 | if [ "$IFACE" = lo ]; then | ||
2342 | 30 | exit 0 | ||
2343 | 31 | fi | ||
2344 | 32 | |||
2345 | 33 | internal=$(route -n | grep "^10\.14\." | sed -e "s/.* //") | ||
2346 | 34 | external=$(ip route ls | grep ^default | awk '{print $5}') | ||
2347 | 35 | |||
2348 | 36 | |||
2349 | 37 | if [ -z "$internal" ] || [ -z "$external" ]; then | ||
2350 | 38 | echo "usage: $0 [INTERNAL_INTERFACE] [EXTERNAL_INTERFACE]" 1>&2 | ||
2351 | 39 | exit 1 | ||
2352 | 40 | fi | ||
2353 | 41 | |||
2354 | 42 | set -e | ||
2355 | 43 | |||
2356 | 44 | # Update MAAS upstream DNS | ||
2357 | 45 | dns=$(nmcli d list iface $external | grep -m 1 "^IP4.DNS" | awk '{ print $2 }') | ||
2358 | 46 | maas admin maas set-config name=upstream_dns value=$dns || true | ||
2359 | 47 | |||
2360 | 48 | # Intel Centrino Advanced-N 6235 and Ubuntu don't work well with Wireless-N | ||
2361 | 49 | if lspci -v 2>/dev/null | grep -qs "Centrino Advanced-N 6235" 2>/dev/null; then | ||
2362 | 50 | sed -i -e "/options iwlwifi 11n_disable=1/d" /etc/modprobe.d/iwlwifi.conf | ||
2363 | 51 | echo "options iwlwifi 11n_disable=1" >> /etc/modprobe.d/iwlwifi.conf | ||
2364 | 52 | fi | ||
2365 | 53 | |||
2366 | 54 | # Configure NAT and IP forwarding, giving slave NUCs external network access | ||
2367 | 55 | # through the master. | ||
2368 | 56 | |||
2369 | 57 | # Enable IP forwarding and save for next boot | ||
2370 | 58 | echo 1 > /proc/sys/net/ipv4/ip_forward | ||
2371 | 59 | echo "net.ipv4.ip_forward=1" > /etc/sysctl.d/10-maas-ip-forward.conf | ||
2372 | 60 | sysctl --system | ||
2373 | 61 | |||
2374 | 62 | # Note that this script assumes no existing iptables rules. If you do have | ||
2375 | 63 | # any, they will be deleted. | ||
2376 | 64 | iptables --flush | ||
2377 | 65 | iptables --table nat --flush | ||
2378 | 66 | iptables --delete-chain | ||
2379 | 67 | iptables --table nat --delete-chain | ||
2380 | 68 | |||
2381 | 69 | # Firewalling this machine | ||
2382 | 70 | # Allow incoming SSH | ||
2383 | 71 | iptables -A INPUT -i $external -p tcp --dport 22 -j ACCEPT | ||
2384 | 72 | iptables -A INPUT -i $external -m state --state ESTABLISHED,RELATED -j ACCEPT | ||
2385 | 73 | iptables -A INPUT -i $external -j DROP | ||
2386 | 74 | |||
2387 | 75 | # Some things use the MAAS proxy - some things don't. So turn on NAT. | ||
2388 | 76 | echo "Setting up ip forwarding" | ||
2389 | 77 | iptables -t nat -A POSTROUTING -o $external -j MASQUERADE | ||
2390 | 78 | iptables -A FORWARD -i $external -o $internal -m state --state RELATED,ESTABLISHED -j ACCEPT | ||
2391 | 79 | iptables -A FORWARD -i $internal -o $external -j ACCEPT | ||
2392 | 80 | # The following line sets up a transparent proxy | ||
2393 | 81 | iptables -A PREROUTING -t nat -i br0 -p tcp -m multiport --dports 80 -j REDIRECT --to-port 3128 | ||
2394 | 82 | |||
2395 | 83 | iptables-save > /etc/iptables/rules.v4 | ||
2396 | 84 | |||
2397 | 85 | # 14.10 deprecates the iptables-persistent service in favor of netfilter-persistent | ||
2398 | 86 | service iptables-persistent restart || service netfilter-persistent restart | ||
2399 | 87 | |||
2400 | 88 | # It seems we need to restart squid3 after making these network changes | ||
2401 | 89 | maas_ver=$(dpkg -l maas | tail -n1 | awk '{print $3}') | ||
2402 | 90 | if dpkg --compare-versions $maas_ver lt 1.6; then | ||
2403 | 91 | # We now run squid3, and NOT squid-deb-proxy | ||
2404 | 92 | update-rc.d -f squid-deb-proxy remove || true | ||
2405 | 93 | service squid-deb-proxy stop || true | ||
2406 | 94 | service squid3 stop || true | ||
2407 | 95 | service squid3 start | ||
2408 | 96 | else | ||
2409 | 97 | service maas-proxy stop || true | ||
2410 | 98 | service maas-proxy start || true | ||
2411 | 99 | fi | ||
2412 | 100 | 0 | ||
2413 | === modified file 'usr/bin/orange-box-status-all-nodes' | |||
2414 | --- usr/bin/orange-box-status-all-nodes 2014-10-20 11:58:14 +0000 | |||
2415 | +++ usr/bin/orange-box-status-all-nodes 2015-07-17 17:14:52 +0000 | |||
2416 | @@ -22,6 +22,9 @@ | |||
2417 | 22 | export AMT_PASSWORD=Password1+ | 22 | export AMT_PASSWORD=Password1+ |
2418 | 23 | ERRORS=0 | 23 | ERRORS=0 |
2419 | 24 | 24 | ||
2420 | 25 | ## According to OB network re-design | ||
2421 | 26 | . /etc/orange-box.conf | ||
2422 | 27 | |||
2423 | 25 | okay() { | 28 | okay() { |
2424 | 26 | echo "OK: $@" | 29 | echo "OK: $@" |
2425 | 27 | } | 30 | } |
2426 | @@ -35,23 +38,23 @@ | |||
2427 | 35 | status_all_nodes() { | 38 | status_all_nodes() { |
2428 | 36 | # Check all VM nodes | 39 | # Check all VM nodes |
2429 | 37 | for i in $(seq 0 2); do | 40 | for i in $(seq 0 2); do |
2433 | 38 | if virsh list --all | grep node0vm${i} | grep running >/dev/null 2>&1; then | 41 | if virsh list --all | grep node0ob${orangebox_number}vm${i} | grep running >/dev/null 2>&1; then |
2434 | 39 | okay "[node0vm${i}]: Is running" | 42 | okay "[node0ob${orangebox_number}vm${i}]: Is running" |
2435 | 40 | uptime=$(ssh node0vm${i}.maas "uptime" 2>/dev/null) | 43 | uptime=$(ssh node0ob${orangebox_number}vm${i}.maas "uptime" 2>/dev/null) |
2436 | 41 | if [ -n "$uptime" ]; then | 44 | if [ -n "$uptime" ]; then |
2438 | 42 | okay "[node0vm${i}]: SSH to node successful; uptime=[$uptime]" | 45 | okay "[node0ob${orangebox_number}vm${i}]: SSH to node successful; uptime=[$uptime]" |
2439 | 43 | else | 46 | else |
2441 | 44 | error "[node0vm${i}]: SSH to node unsuccessful; uptime=[$uptime]" | 47 | error "[node0ob${orangebox_number}vm${i}]: SSH to node unsuccessful; uptime=[$uptime]" |
2442 | 45 | fi | 48 | fi |
2443 | 46 | else | 49 | else |
2445 | 47 | error "[node0vm${i}]: Is not running" | 50 | error "[node0ob${orangebox_number}vm${i}]: Is not running" |
2446 | 48 | fi | 51 | fi |
2447 | 49 | done | 52 | done |
2448 | 50 | # Check all AMT nodes | 53 | # Check all AMT nodes |
2449 | 51 | for i in $(seq 1 9); do | 54 | for i in $(seq 1 9); do |
2451 | 52 | hostname="node${i}.maas" | 55 | hostname="node${i}ob${orangebox_number}.maas" |
2452 | 53 | # (1) Ping AMT IP Addresses | 56 | # (1) Ping AMT IP Addresses |
2454 | 54 | amt_ip="10.14.4.1$i" | 57 | amt_ip="172.27.${orangebox_number}.1$i" |
2455 | 55 | if ping -c 1 -q $amt_ip >/dev/null 2>&1; then | 58 | if ping -c 1 -q $amt_ip >/dev/null 2>&1; then |
2456 | 56 | okay "[$hostname]: AMT responding to ping [$amt_ip]" | 59 | okay "[$hostname]: AMT responding to ping [$amt_ip]" |
2457 | 57 | else | 60 | else |
2458 | 58 | 61 | ||
2459 | === added directory 'usr/lib/orange-box/templates' | |||
2460 | === added directory 'usr/lib/orange-box/templates/mirror-bind' | |||
2461 | === added file 'usr/lib/orange-box/templates/mirror-bind/named.conf.template' | |||
2462 | --- usr/lib/orange-box/templates/mirror-bind/named.conf.template 1970-01-01 00:00:00 +0000 | |||
2463 | +++ usr/lib/orange-box/templates/mirror-bind/named.conf.template 2015-07-17 17:14:52 +0000 | |||
2464 | @@ -0,0 +1,6 @@ | |||
2465 | 1 | # Zone declarations for ${web_site} | ||
2466 | 2 | zone "${web_site}" { | ||
2467 | 3 | type master; | ||
2468 | 4 | file "/etc/bind/zones.${web_site}"; | ||
2469 | 5 | }; | ||
2470 | 6 | |||
2471 | 0 | 7 | ||
2472 | === added file 'usr/lib/orange-box/templates/mirror-bind/zones.template' | |||
2473 | --- usr/lib/orange-box/templates/mirror-bind/zones.template 1970-01-01 00:00:00 +0000 | |||
2474 | +++ usr/lib/orange-box/templates/mirror-bind/zones.template 2015-07-17 17:14:52 +0000 | |||
2475 | @@ -0,0 +1,17 @@ | |||
2476 | 1 | $TTL 300 | ||
2477 | 2 | @ IN SOA ${web_site} ${web_site_root} ( | ||
2478 | 3 | 999 ; serial | ||
2479 | 4 | 600 ; Refresh | ||
2480 | 5 | 1800 ; Retry | ||
2481 | 6 | 604800 ; Expire | ||
2482 | 7 | 300 ; TTL | ||
2483 | 8 | ) | ||
2484 | 9 | |||
2485 | 10 | IN NS ${web_site} | ||
2486 | 11 | |||
2487 | 12 | ns IN CNAME ${web_site} | ||
2488 | 13 | |||
2489 | 14 | ${web_site}. IN A 172.27.${orangebox_number}.1 | ||
2490 | 15 | ${web_site} IN A 172.27.${orangebox_number}.1 | ||
2491 | 16 | * IN A 172.27.${orangebox_number}.1 | ||
2492 | 17 | |||
2493 | 0 | 18 | ||
2494 | === added file 'usr/lib/orange-box/templates/ubumirror.conf' | |||
2495 | --- usr/lib/orange-box/templates/ubumirror.conf 1970-01-01 00:00:00 +0000 | |||
2496 | +++ usr/lib/orange-box/templates/ubumirror.conf 2015-07-17 17:14:52 +0000 | |||
2497 | @@ -0,0 +1,58 @@ | |||
2498 | 1 | # | ||
2499 | 2 | # ubumirror.conf - configuration file for the ubumirror scripts. | ||
2500 | 3 | # | ||
2501 | 4 | |||
2502 | 5 | # Please set the variables below to fit your site. | ||
2503 | 6 | # Which email address/user that will receive failure notices. | ||
2504 | 7 | EMAIL=root@orangebox${orangebox_number} | ||
2505 | 8 | |||
2506 | 9 | # Server's FQDN. | ||
2507 | 10 | HOSTNAME=orangebox${orangebox_number} | ||
2508 | 11 | |||
2509 | 12 | # Bandwidth limit for all mirror scripts - set to 0 for no limit. | ||
2510 | 13 | SPEED=0 | ||
2511 | 14 | |||
2512 | 15 | # I/O timeout for all mirror scripts - defaults to 600 seconds. | ||
2513 | 16 | IO_TIMEOUT=600 | ||
2514 | 17 | |||
2515 | 18 | # UBUARC_DIR is the destination for the base of the archive directory | ||
2516 | 19 | # The script won't run if this variable isn't set | ||
2517 | 20 | UBUARC_DIR="/srv/mirrors/archive.ubuntu.com/" | ||
2518 | 21 | |||
2519 | 22 | # UBUCDI_DIR is the destination for the base of the cdimage directory | ||
2520 | 23 | # The script won't run if this variable isn't set | ||
2521 | 24 | UBUCDI_DIR="/srv/mirrors/cdimage.ubuntu.com/" | ||
2522 | 25 | |||
2523 | 26 | # UBUREL_DIR is the destination for the base of the releases directory | ||
2524 | 27 | # The script won't run if this variable isn't set | ||
2525 | 28 | UBUREL_DIR="/srv/mirrors/releases.ubuntu.com/" | ||
2526 | 29 | |||
2527 | 30 | # UBUPOR_DIR is the destination for the base of the ports directory | ||
2528 | 31 | # The script (ubuports) won't run if this variable isn't set | ||
2529 | 32 | UBUPOR_DIR="/srv/mirrors/ports.ubuntu.com/" | ||
2530 | 33 | # | ||
2531 | 34 | # UBUCLOUD_DIR is the destination for the base of the cloud-image directory | ||
2532 | 35 | # The script (ubucloudimage) won't run if this variable isn't set | ||
2533 | 36 | UBUCLOUD_DIR="/srv/mirrors/cloud-images.ubuntu.com/" | ||
2534 | 37 | |||
2535 | 38 | # LOGDIR is the destination directory of all the logs | ||
2536 | 39 | LOGDIR="/var/log/ubumirrors/" | ||
2537 | 40 | |||
2538 | 41 | # UBU{ARC,CDI,REL}_MIRROR is the rsync path in the form of host::directory/ of the | ||
2539 | 42 | # upstream mirrors where the ubumirror scripts will mirror from. | ||
2540 | 43 | UBUARC_MIRROR=rsync://rsync.archive.ubuntu.com/ubuntu | ||
2541 | 44 | UBUCDI_MIRROR=rsync://rsync.cdimage.ubuntu.com/cdimage | ||
2542 | 45 | UBUREL_MIRROR=rsync://rsync.releases.ubuntu.com/releases | ||
2543 | 46 | UBUPOR_MIRROR=rsync://rsync.ports.ubuntu.com/ubuntu-ports | ||
2544 | 47 | UBUCLOUD_MIRROR=rsync://cloud-images.ubuntu.com/cloud-images | ||
2545 | 48 | |||
2546 | 49 | # UBU{ARC,CDI,REL}_EXCLUDE is what things you want to exclude | ||
2547 | 50 | UBUARC_EXCLUDE="--exclude binary-powerpc/ --exclude binary-sparc/ --exclude daily-installer-powerpc/ --exclude daily-installer-sparc/ --exclude installer-powerpc/ --exclude installer-sparc/ --exclude *_powerpc.deb --exclude *_powerpc.udeb --exclude *_sparc.deb --exclude *_sparc.udeb --exclude Contents-powerpc.gz --exclude Contents-sparc.gz " | ||
2548 | 51 | |||
2549 | 52 | UBUCDI_EXCLUDE="--exclude *-powerpc.* --exclude *-sparc.* --exclude source/ " | ||
2550 | 53 | |||
2551 | 54 | UBUREL_EXCLUDE="--exclude *-powerpc.* --exclude *-sparc.* " | ||
2552 | 55 | |||
2553 | 56 | UBUPOR_EXCLUDE="--exclude binary-powerpc/ --exclude binary-sparc/ --exclude daily-installer-powerpc/ --exclude daily-installer-sparc/ --exclude installer-powerpc/ --exclude installer-sparc/ --exclude *_powerpc.deb --exclude *_powerpc.udeb --exclude *_sparc.deb --exclude *_sparc.udeb --exclude Contents-powerpc.gz --exclude Contents-sparc.gz " | ||
2554 | 57 | |||
2555 | 58 | UBUCLOUD_EXCLUDE="" |