Velero issue
[ealt-edge.git] / ocd / infra / playbooks / roles / velero / tasks / install.yml
1 #
2 # Copyright 2020 Huawei Technologies Co., Ltd.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16
17 ---
18
19 - name: check if velero is already installed
20   shell:
21     cmd: kubectl get pods -n velero
22   register: result
23   ignore_errors: yes
24   no_log: True
25
26 - debug:
27     msg: velero already installed
28   when: result.stdout != ""
29
30 - debug:
31 # yamllint disable rule:line-length
32     msg: Ignore Uninstall Log , velero not installed continue with Installation
33 # yamllint disable rule:line-length
34   when: result.stdout == ""
35
36 - name: Adding helm repo for velero
37   command: helm repo add vmware-tanzu https://vmware-tanzu.github.io/helm-charts
38   ignore_errors: yes
39   no_log: True
40   when: result.stdout == ""
41
42 - name: Create name space for velero
43   command: kubectl create ns velero
44   ignore_errors: yes
45   no_log: True
46   when: result.stdout == ""
47
48 - name: Install velero
49   # yamllint disable rule:line-length
50   command: helm install vmware-tanzu/velero --namespace velero --set-file credentials.secretContents.cloud=./credentials-velero --set configuration.provider=aws --set configuration.backupStorageLocation.name= default --set configuration.backupStorageLocation.bucket=newbucket --set configuration.backupStorageLocation.config.region=minio --set configuration.volumeSnapshotLocation.name=default --set configuration.volumeSnapshotLocation.config.region=minio --set image.repository=velero/velero --set image.tag=v1.5.1 --set image.pullPolicy=IfNotPresent --set initContainers[0].name=velero-plugin-for-aws --set initContainers[0].image=velero/velero-plugin-for-aws:v1.1.0 --set initContainers[0].volumeMounts[0].mountPath=/target --set initContainers[0].volumeMounts[0].name=plugins --generate-name =velero
51   ignore_errors: yes
52   no_log: True
53   when: result.stdout == ""