-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate-airskiff.yaml
130 lines (115 loc) · 5.65 KB
/
template-airskiff.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
heat_template_version: 2015-04-30
description: |
Template to deploy an Ubuntu compute instance behind a proxy server
parameters:
availability_zone:
type: string
label: Availability Zone
description: Availability zone to use for the compute instance
key_name:
type: string
label: Key Name
description: The name of the key-pair to use for the compute instance
image:
type: string
label: Image Name
description: Name of the image to use for the compute instance
flavor:
type: string
label: Flavor
description: Flavor to use for the compute instance
network_id:
type: string
label: Network ID
description: ID of the network to use for the compute instance
http_proxy:
type: string
label: HTTP Proxy Address
description: Address of your HTTP proxy server
https_proxy:
type: string
label: HTTPS Proxy Address
description: Address of your HTTPS proxy server
resources:
osh_aio:
type: OS::Nova::Server
properties:
availability_zone: { get_param: availability_zone }
key_name: { get_param: key_name }
image: { get_param: image}
flavor: { get_param: flavor }
networks:
- network: { get_param: network_id }
user_data_format: RAW
user_data:
str_replace:
template: |
#!/bin/bash
set -xe
# Set proxy environment variables
tee -a /etc/environment << EOF
http_proxy=$http_proxy
https_proxy=$https_proxy
no_proxy=localhost,127.0.0.1,172.17.0.1,.svc.cluster.local
HTTP_PROXY=$http_proxy
HTTPS_PROXY=$https_proxy
NO_PROXY=localhost,127.0.0.1,172.17.0.1,svc.cluster.local
PROXY=$http_proxy
USE_PROXY=true
EOF
source /etc/environment
# Grant ubuntu user passwordless sudo
echo "ubuntu ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# Add proxy addresses to APT config
tee /etc/apt/apt.conf << EOF
Acquire::http::proxy "$http_proxy";
Acquire::https::proxy "$https_proxy";
EOF
# Set git config
git config --system url."https://".insteadOf git://
git config --system http.proxy "$http_proxy"
git config --system https.proxy "$https_proxy"
# Add hostname to /etc/hosts
echo $(hostname -I | cut -d\ -f1) $(hostname) | tee -a /etc/hosts
# Configure Docker for usage behind proxy servers
mkdir -p /etc/systemd/system/docker.service.d
tee /etc/systemd/system/docker.service.d/http-proxy.conf << EOF
[Service]
Environment="HTTP_PROXY=$http_proxy" "HTTPS_PROXY=$https_proxy" "NO_PROXY=localhost,127.0.0.1"
EOF
# Clone Airskiff
git clone https://github.com/mattmceuen/airskiff.git /opt/airskiff
chown -R ubuntu: /opt
# Deploy Airskiff
su -c "cd /opt/airskiff && /bin/bash /opt/airskiff/tools/common/setup-proxy.sh"
su -c "cd /opt/airskiff && /bin/bash /opt/airskiff/tools/deployment/developer/nfs/000-install-packages.sh" ubuntu
su -c "cd /opt/airskiff && /bin/bash /opt/airskiff/tools/deployment/developer/nfs/005-make-airship.sh" ubuntu
# Add proxy information to OSH local playbook vars
tee -a tools/gate/devel/local-vars.yaml << EOF
proxy:
http: $http_proxy
https: $https_proxy
noproxy: localhost,127.0.0.1,172.17.0.1,.svc.cluster.local
EOF
# Add DNS nameservers present in /etc/resolv.conf to OSH playbook vars
sed -ne "s/nameserver //p" /etc/resolv.conf | while read -r ns; do
sed -i -e "/external_dns_nameservers:/ a\ - ${ns}" \
tools/images/kubeadm-aio/assets/opt/playbooks/vars.yaml
done
su -c "cd /opt/airskiff && /bin/bash /opt/airskiff/tools/deployment/developer/nfs/010-deploy-k8s.sh" ubuntu
su -c "cd /opt/airskiff && /bin/bash /opt/airskiff/tools/deployment/developer/nfs/020-setup-client.sh" ubuntu
su -c "cd /opt/airskiff && /bin/bash /opt/airskiff/tools/deployment/developer/nfs/030-ingress.sh" ubuntu
su -c "cd /opt/airskiff && /bin/bash /opt/airskiff/tools/deployment/developer/nfs/040-nfs-provisioner.sh" ubuntu
su -c "cd /opt/airskiff && /bin/bash /opt/airskiff/tools/deployment/developer/nfs/050-mariadb.sh" ubuntu
su -c "cd /opt/airskiff && /bin/bash /opt/airskiff/tools/deployment/developer/nfs/060-rabbitmq.sh" ubuntu
su -c "cd /opt/airskiff && /bin/bash /opt/airskiff/tools/deployment/developer/nfs/070-memcached.sh" ubuntu
su -c "cd /opt/airskiff && /bin/bash /opt/airskiff/tools/deployment/developer/nfs/080-keystone.sh" ubuntu
su -c "cd /opt/airskiff && /bin/bash /opt/airskiff/tools/deployment/developer/nfs/090-postgresql.sh" ubuntu
su -c "cd /opt/airskiff && /bin/bash /opt/airskiff/tools/deployment/developer/nfs/100-barbican.sh" ubuntu
su -c "cd /opt/airskiff && /bin/bash /opt/airskiff/tools/deployment/developer/nfs/110-deckhand.sh" ubuntu
su -c "cd /opt/airskiff && /bin/bash /opt/airskiff/tools/deployment/developer/nfs/120-armada.sh" ubuntu
su -c "cd /opt/airskiff && /bin/bash /opt/airskiff/tools/deployment/developer/nfs/130-shipyard.sh" ubuntu
su -c "cd /opt/airskiff && /bin/bash /opt/airskiff/tools/deployment/developer/nfs/140-pegleg.sh" ubuntu
params:
$http_proxy: { get_param: http_proxy }
$https_proxy: { get_param: https_proxy }