-
Notifications
You must be signed in to change notification settings - Fork 1
/
ansible-semaphore.yaml
188 lines (172 loc) · 4.77 KB
/
ansible-semaphore.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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
---
apiVersion: v1
kind: Namespace
metadata:
name: ansible-semaphore
---
apiVersion: core/v1
kind: Secret
metadata:
name: semaphore-secret
namespace: ansible-semaphore
labels:
app: semaphore
type: Opaque
stringData:
SEMAPHORE_ADMIN: semaphore
SEMAPHORE_ADMIN_NAME: semaphore
SEMAPHORE_DB_USER: semaphore
MYSQL_USER: semaphore
data:
# use echo -n <base64-encoded-string> | base64 -d # to decode
SEMAPHORE_DB_PASS: c2VtYXBob3Jl
SEMAPHORE_ADMIN_PASSWORD: c2VtYXBob3Jl
MYSQL_PASSWORD: c2VtYXBob3Jl
MYSQL_ROOT_PASSWORD: c2VtYXBob3Jl
---
apiVersion: v1
kind: Service
metadata:
name: semaphore
namespace: ansible-semaphore
labels:
app: semaphore
spec:
ports:
- name: "semaphore"
port: 3000
targetPort: 3000
selector:
app: semaphore
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: semaphore
namespace: ansible-semaphore
labels:
app: semaphore
spec:
replicas: 1
selector:
matchLabels:
app: semaphore
template:
metadata:
labels:
app: semaphore
spec:
restartPolicy: Always
volumes:
# do not use hostPath, use volumeClaim in real world usecase
- name: semaphore-db-vol
hostPath:
path: /tmp/semaphore
containers:
- name: mysql
image: mysql
ports:
- containerPort: 3306
env:
- name: MYSQL_DATABASE
value: semaphore
- name: MYSQL_USER
valueFrom:
secretKeyRef:
name: semaphore-secret
key: MYSQL_USER
optional: false
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
name: semaphore-secret
key: MYSQL_PASSWORD
optional: false
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: semaphore-secret
key: MYSQL_ROOT_PASSWORD
optional: false
volumeMounts:
- name: semaphore-db-vol
mountPath: /var/lib/mysql
- name: semaphore
image: ansiblesemaphore/semaphore
ports:
- containerPort: 3000
resources: {}
env:
- name: SEMAPHORE_ADMIN
valueFrom:
secretKeyRef:
name: semaphore-secret
key: SEMAPHORE_ADMIN
optional: false
- name: SEMAPHORE_ADMIN_NAME
valueFrom:
secretKeyRef:
name: semaphore-secret
key: SEMAPHORE_ADMIN_NAME
optional: false
- name: SEMAPHORE_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: semaphore-secret
key: SEMAPHORE_ADMIN_PASSWORD
optional: false
- name: SEMAPHORE_DB_PASS
valueFrom:
secretKeyRef:
name: semaphore-secret
key: SEMAPHORE_DB_PASS
optional: false
- name: SEMAPHORE_DB_USER
valueFrom:
secretKeyRef:
name: semaphore-secret
key: SEMAPHORE_DB_USER
optional: false
#Configure this if your environment has mail sending capabilities
#- name: SEMAPHORE_ADMIN_EMAIL
# value: admin@localhost
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: SEMAPHORE_DB
value: semaphore
- name: SEMAPHORE_DB_DIALECT
value: mysql
#if the DB is moved to different pod, this need to updated to service FQDN of the DB
- name: SEMAPHORE_DB_HOST
value: 127.0.0.1
- name: SEMAPHORE_DB_PORT
value: "3306"
- name: SEMAPHORE_PLAYBOOK_PATH
value: /tmp/semaphore
#I am unable to make GUI work with this set, so commented this
#- name: SEMAPHORE_WEB_ROOT
# value: http://127.0.0.1:3000
# use head -c32 /dev/urandom | base64 to generate the below value
- name: SEMAPHORE_ACCESS_KEY_ENCRYPTION
value: Q3wYAzx89dRTZWiS11INE63Yi3hv53rJsW6raMdRdLo=
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: semaphore
namespace: ansible-semaphore
spec:
rules:
- host: yourdomain.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: semaphore
port:
name: semaphore