-
Notifications
You must be signed in to change notification settings - Fork 0
/
ultimate.tf
160 lines (138 loc) · 4.09 KB
/
ultimate.tf
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
provider "aws" {
access_key = ""
secret_key = ""
region = "us-west-2"
}
resource "aws_instance" "web" {
ami = "ami-00f7c900d2e7133e1"
instance_type = "t2.micro"
key_name = "chave"
associate_public_ip_address = "true"
tags {
Name = "Gustavo Neri"
}
connection {
type = "ssh"
user = "centos"
private_key = "${file("/home/local")}"
timeout = "2m"
}
## instalando o docker ##
provisioner "remote-exec" {
inline = [
"sudo yum install -y yum-utils device-mapper-persistent-data lvm2",
"sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo",
"sudo yum-config-manager --enable docker-ce-edge",
"sudo yum-config-manager --enable docker-ce-test",
"sudo yum-config-manager --disable docker-ce-edge",
"sudo yum install -y docker-ce",
"sudo systemctl start docker",
]
}
provisioner "remote-exec" {
inline = [
"sudo docker run -d --volume /srv/docker/gitlab/redis:/var/lib/redis --restart=always --name=gitlab-redis sameersbn/redis:4.0.9-1",
]
}
provisioner "remote-exec" {
inline = [
"sudo docker run -d --volume /srv/docker/gitlab/postgresql:/var/lib/postgresql --env 'DB_USER=root' --env 'DB_PASS=Cdt@12345678' --env 'DB_NAME=gitlab_hqproduction' --env 'DB_EXTENSION=pg_trgm' --restart=always --name=gitlab-postgresql sameersbn/postgresql:10",
]
}
provisioner "remote-exec" {
inline = [
"sudo docker run -d --volume /srv/gitlab-runner/config:/etc/gitlab-runner --volume /var/run/docker.sock:/var/run/docker.sock --restart=always --name=gitlab-runner gitlab/gitlab-runner:latest",
]
}
provisioner "remote-exec" {
inline = [
"sudo docker run -d --volume /srv/docker/gitlab/gitlab:/home/git/data --link gitlab-postgresql:postgresql --link gitlab-redis:redisio --publish 10080:80 --publish 10022:22 --env 'DEBUG=false' --env 'DB_ADAPTER=postgresql' --env 'DB_HOST=gitlab-postgresql' --env 'DB_PORT=5432' --env 'DB_USER=root' --env 'DB_PASS=Cdt@12345678' --env 'DB_NAME=gitlab_hqproduction' --env 'GITLAB_PORT=10080' --env 'GITLAB_SSH_PORT=10022' --env 'GITLAB_SECRETS_DB_KEY_BASE=secrettest' --env 'GITLAB_SECRETS_SECRET_KEY_BASE=secrettest' --env 'GITLAB_SECRETS_OTP_KEY_BASE=secrettest' --env 'GITLAB_ROOT_PASS=Cdt@12345678' --env 'GITLAB_HTTPS=false' --restart=always --name=gitlab sameersbn/gitlab:latest",
]
}
}
resource "aws_security_group" "security_group" {
ingress {
protocol = "0"
from_port = 22
to_port = 22
cidr_blocks = ["10.0.1.0/24"]
}
ingress {
protocol = "0"
from_port = 0
to_port = 65535
cidr_blocks = ["10.0.0.0/24"]
}
ingress {
protocol = "0"
from_port = 8443
to_port = 8443
cidr_blocks = ["10.0.0.0/24"]
}
ingress {
protocol = "0"
from_port = 10022
to_port = 10022
cidr_blocks = ["10.0.0.0/24"]
}
ingress {
protocol = "0"
from_port = 10080
to_port = 10080
cidr_blocks = ["10.0.0.0/24"]
}
ingress {
protocol = "0"
from_port = 53
to_port = 53
cidr_blocks = ["10.0.0.0/24"]
}
ingress {
protocol = "0"
from_port = 80
to_port = 80
cidr_blocks = ["10.0.0.0/24"]
}
ingress {
protocol = "0"
from_port = 443
to_port = 443
cidr_blocks = ["10.0.0.0/24"]
}
egress {
protocol = "0"
from_port = 8443
to_port = 8443
cidr_blocks = ["10.0.0.0/24"]
}
egress {
protocol = "0"
from_port = 10022
to_port = 10022
cidr_blocks = ["10.0.0.0/24"]
}
egress {
protocol = "0"
from_port = 10080
to_port = 10080
cidr_blocks = ["10.0.0.0/24"]
}
egress {
protocol = "0"
from_port = 53
to_port = 53
cidr_blocks = ["10.0.0.0/24"]
}
egress {
protocol = "0"
from_port = 80
to_port = 80
cidr_blocks = ["10.0.0.0/24"]
}
egress {
protocol = "0"
from_port = 443
to_port = 443
cidr_blocks = ["10.0.0.0/24"]
}
}