-
Notifications
You must be signed in to change notification settings - Fork 0
/
newroot.sh
executable file
·133 lines (114 loc) · 3.25 KB
/
newroot.sh
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
131
132
133
#!/bin/bash
help_fn () {
echo ""
echo "usage: ./newroot.sh name type"
echo ""
echo " name - name of the new application/bigip to deploy"
echo " For instance, green_dot_trading or bip4stl20"
echo ""
echo " type - this should either be DO or AS3. Don't try and get cute."
exit 1
}
DO_fn () {
#
# boilerplate stuff for the environment setups and main.tf in the newly created deployment
#
read -r -d '' THEENV <<- EOM
bigip_address = "10.10.10.245"
bigip_username = "admin"
bigip_password = "originalPassword"
admin_password = "NewHotPassWord!"
root_password = "NewHotPassWord!"
f5service_password = "NewHotPassWord!"
hostname = "$NAME.yourdomain.int"
dmz1_private = "172.31.1.2/24"
dmz1_public = "9.99.4.18/29"
dmz2_private = "10.10.100.3/24"
default_route = "172.31.1.254"
mgmt_route = "10.10.10.254"
EOM
read -r -d '' THEMAIN <<- EOMM
variable "bigip_address" {}
variable "bigip_username" {}
variable "bigip_password" {}
variable "hostname" {}
variable "root_password" {}
variable "admin_password" {}
variable "f5service_password" {}
variable "dmz1_private" {}
variable "dmz1_public" {}
variable "dmz2_private" {}
variable "default_route" {}
variable "mgmt_route" {}
module "onboard_bigip" {
source = "../../modules/onboard_bigip"
bigip_address = var.bigip_address
bigip_username = var.bigip_username
bigip_password = var.bigip_password
hostname = var.hostname
root_password = var.root_password
admin_password = var.admin_password
f5service_password = var.f5service_password
dmz1_private = var.dmz1_private
dmz1_public = var.dmz1_public
dmz2_private = var.dmz2_private
default_route = var.default_route
mgmt_route = var.mgmt_route
}
EOMM
}
AS3_fn () {
#
# boilerplate stuff for the environment setups and main.tf in the newly created deployment
#
# probably need a couple different versions of this (or handle it some other way completely..)
# effectively, you'll need one of these for each AS3 template you want to support
#
read -r -d '' THEENV <<- EOM
bigip_address = "10.10.10.245"
bigip_username = "ADUserName"
bigip_password = "theUserPassword"
EOM
read -r -d '' THEMAIN <<- EOMM
variable "bigip_address" {}
variable "bigip_username" {}
variable "bigip_password" {}
module "https_no_waf_module" {
source = "../../modules/https_no_waf"
bigip_address = var.bigip_address
bigip_username = var.bigip_username
bigip_password = var.bigip_password
tenant = "spooky"
fqdn = "www_ps_com"
env = "stage"
app_id = "0x1979"
allowed_vlan = "/Common/dmz1"
client_ssl_profile = "/Common/clientssl"
server_ssl_profile = "/Common/serverssl"
public_ip = "69.44.4.23"
public_ip_label = "ip69_44_4_23"
public_port = 885
app_servers = [{ serverAddresses=["205.170.190.124"], servicePort=53, shareNodes=true},{serverAddresses=["205.170.190.124"], servicePort=99, shareNodes=true}]
}
EOMM
}
[ -z "$1" ] && help_fn
[ -z "$2" ] && help_fn
if [ "$2" == "DO" ] || [ "$2" == "AS3" ]
then
NAME=$1
TYPE=$2
else
help_fn
fi
if [ "$TYPE" == "DO" ]
then
DO_fn
else
AS3_fn
fi
mkdir roots/$NAME
mkdir roots/$NAME/env
echo "$THEENV" > roots/$NAME/env/prod.tfvars
echo "$THEENV" > roots/$NAME/env/stage.tfvars
echo "$THEMAIN" > roots/$NAME/main.tf