Merge "mecm-mepm uninstall playbook added"
[ealt-edge.git] / ocd / infra / playbooks / roles / applcm / tasks / install-ssl.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: modifying configuration to support https
22   shell:
23     cmd: cp applcm-broker-deployment.yaml applcm-broker-deployment-ssl.yaml
24     chdir: /tmp/applcm/deploy/
25
26 - name: modify configuraiton to support https
27   shell:
28     cmd: chmod +x applcmScript.sh && ./applcmScript.sh
29     chdir: /tmp/applcm/deploy/
30
31 - name: Generate Certificates
32   shell:
33 # yamllint disable rule:line-length
34     cmd: openssl genrsa -out ca.key 2048
35     chdir: /tmp/applcm/deploy/
36
37 - name: Generate Certificate - Step 2
38   shell:
39     cmd: openssl req -new -key ca.key -subj /C=CN/ST=Peking/L=Beijing/O=ealtedge/CN=www.ealtedge.org -out ca.csr
40     chdir: /tmp/applcm/deploy/
41
42 - name: Generate Root Certificate
43   shell:
44     cmd: openssl x509 -req -days 365 -in ca.csr -extensions v3_req -signkey ca.key -out trust.cer
45     chdir: /tmp/applcm/deploy/
46
47 - name: Generate Server Key
48   shell:
49     cmd: openssl genrsa -out server_key.pem 2048
50     chdir: /tmp/applcm/deploy/
51
52
53 - name: Generate Server CSR
54   shell:
55     cmd: openssl req -new -key server_key.pem -subj /C=CN/ST=Beijing/L=Beijing/O=ealtedge/CN=www.ealtedge.org -out tls.csr
56     chdir: /tmp/applcm/deploy/
57
58 - name: Generate Server Certificate
59   shell:
60     cmd: openssl x509 -req -in tls.csr -extensions v3_req -CA trust.cer -CAkey ca.key -CAcreateserial -out server.cer
61     chdir: /tmp/applcm/deploy/
62
63 - name: Create applcm-secret
64   shell:
65 # yamllint disable rule:line-length
66     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
67
68 - name: Install applcm postgres-configmap
69   shell:
70     cmd: kubectl apply -f /tmp/applcm/deploy/postgres-config.yaml
71
72 - name: Install applcm - pvc
73   shell:
74     cmd: kubectl apply -f /tmp/applcm/deploy/postgres-storage.yaml
75
76 - name: Install applcm - db
77   shell:
78     cmd: kubectl apply -f /tmp/applcm/deploy/postgres-k8s.yaml
79
80 - name: Install applcm - postgres-service
81   shell:
82     cmd: kubectl apply -f /tmp/applcm/deploy/postgres-service.yaml
83
84 - name: Install applcm - db-init-config
85   shell:
86 # yamllint disable rule:line-length
87     cmd: sleep 10;
88   ignore_errors: yes
89   failed_when: false
90   no_log: True
91
92 - name: Install applcm - helmplugin
93   shell:
94     cmd: sleep 10
95
96 - name: Install applcm - helmplugin
97   shell:
98     cmd: kubectl apply -f /tmp/applcm/deploy/helm-plugin-deployment.yaml
99
100
101 - name: Install applcm - helmplugin
102   shell:
103     cmd: sleep 10
104
105 - name: Install applcm - helmplugin
106   shell:
107     cmd: kubectl apply -f /tmp/applcm/deploy/helm-plugin-service.yaml
108
109
110 - name: Install applcm - helmplugin
111   shell:
112     cmd: sleep 10
113
114 - name: Install applcm - broker
115   shell:
116     cmd: kubectl apply -f /tmp/applcm/deploy/applcm-broker-deployment-ssl.yaml
117
118 - name: Install applcm - broker
119   shell:
120     cmd: kubectl apply -f /tmp/applcm/deploy/applcm-broker-service.yaml