Modified to support certificate generation
[ealt-edge.git] / ocd / infra / playbooks / roles / applcm / tasks / install.yml
1 # Copyright 2020 Huawei Technologies Co., Ltd.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 ---
16 - name: copy deploy folder to mecm host for installing APPLCM
17   copy:
18     src: deploy
19     dest: /tmp/applcm/
20
21 - name: Generate Certificates
22   shell:
23 # yamllint disable rule:line-length
24     cmd: openssl genrsa -out ca.key 2048
25     chdir: /tmp/applcm/deploy/
26
27 - name: Generate Certificate - Step 2
28   shell:
29     cmd: openssl req -new -key ca.key -subj /C=CN/ST=Peking/L=Beijing/O=ealtedge/CN=www.ealtedge.org -out ca.csr
30     chdir: /tmp/applcm/deploy/
31
32 - name: Generate Root Certificate
33   shell:
34     cmd: openssl x509 -req -days 365 -in ca.csr -extensions v3_req -signkey ca.key -out trust.cer
35     chdir: /tmp/applcm/deploy/
36
37 - name: Generate Server Key
38   shell:
39     cmd: openssl genrsa -out server_key.pem 2048
40     chdir: /tmp/applcm/deploy/
41
42
43 - name: Generate Server CSR
44   shell:
45     cmd: openssl req -new -key server_key.pem -subj /C=CN/ST=Beijing/L=Beijing/O=ealtedge/CN=www.ealtedge.org -out tls.csr
46     chdir: /tmp/applcm/deploy/
47
48 - name: Generate Server Certificate
49   shell:
50     cmd: openssl x509 -req -in tls.csr -extensions v3_req -CA trust.cer -CAkey ca.key -CAcreateserial -out server.cer
51     chdir: /tmp/applcm/deploy/
52
53 - name: Create applcm-secret
54   shell:
55 # yamllint disable rule:line-length
56     cmd: kubectl create secret --namespace default generic applcm-secret --from-file=/tmp/applcm/deploy/server.cer --from-file=/tmp/applcm/deploy/server_key.pem --from-file=/tmp/applcm/deploy/trust.cer
57
58 - name: Install applcm postgres-configmap
59   shell:
60     cmd: kubectl apply -f /tmp/applcm/deploy/postgres-config.yaml
61
62 - name: Install applcm - pvc
63   shell:
64     cmd: kubectl apply -f /tmp/applcm/deploy/postgres-storage.yaml
65
66 - name: Install applcm - db
67   shell:
68     cmd: kubectl apply -f /tmp/applcm/deploy/postgres-k8s.yaml
69
70 - name: Install applcm - postgres-service
71   shell:
72     cmd: kubectl apply -f /tmp/applcm/deploy/postgres-service.yaml
73
74 - name: Install applcm - db-init-config
75   shell:
76 # yamllint disable rule:line-length
77     cmd: sleep 10;
78   ignore_errors: yes
79   failed_when: false
80   no_log: True
81
82 - name: Install applcm - helmplugin
83   shell:
84     cmd: sleep 10
85
86 - name: Install applcm - helmplugin
87   shell:
88     cmd: kubectl apply -f /tmp/applcm/deploy/helm-plugin-deployment.yaml
89
90
91 - name: Install applcm - helmplugin
92   shell:
93     cmd: sleep 10
94
95 - name: Install applcm - helmplugin
96   shell:
97     cmd: kubectl apply -f /tmp/applcm/deploy/helm-plugin-service.yaml
98
99
100 - name: Install applcm - helmplugin
101   shell:
102     cmd: sleep 10
103
104 - name: Install applcm - broker
105   shell:
106     cmd: kubectl apply -f /tmp/applcm/deploy/applcm-broker-deployment.yaml
107
108 - name: Install applcm - broker
109   shell:
110     cmd: kubectl apply -f /tmp/applcm/deploy/applcm-broker-service.yaml