Skip to content

Commit 58bc6b5

Browse files
Merge pull request #109 from Yashansh-Sharma15/ocp_lso
Updating Playbook for Local Storage Operator
2 parents 0a6fa16 + e9e0cf6 commit 58bc6b5

File tree

4 files changed

+24
-23
lines changed

4 files changed

+24
-23
lines changed

examples/ocp_lso_vars.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ lso_catalogsource_image: "" #registry.redhat.io/redhat/redhat-operator-index:v
66
lso_namespace: "" #openshift-local-storage
77
lso_channel: "" #stable,alpha,beta
88
lso_catalogsource_name: "" #my-operator-catalog
9-
device_path: "" #add this by running "ls /dev/disk/by-id/"
9+
device_path: "" #add this by running "ls /dev/disk/by-id/......"

playbooks/roles/ocp-lso/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Role Variables
1919
| lso_channel | no | `stable` | Version Of LSO to be installed |
2020
| lso_catalogsource_name | no | `my-operator-catalog` | Catalog source name for LSO |
2121
| lso_enabled | no | `true` | True for running playbook |
22-
| device_path | no | | set its value by running "ls /dev/disk/by-id/" in your cluster |
22+
| device_path | yes | | set its value by running "ls /dev/disk/by-id/" in your cluster |
2323

2424
Example Playbook
2525
----------------

playbooks/roles/ocp-lso/defaults/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
lso_enabled: true
2+
lso_enabled: false
33
lso_catalogsource_image: "registry.redhat.io/redhat/redhat-operator-index:v4.18-prerelease-local-storage-operator"
44
lso_namespace: "openshift-local-storage"
55
lso_channel: "stable"

playbooks/roles/ocp-lso/tasks/main.yaml

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,7 @@
3434
kind: Namespace
3535
metadata:
3636
name: "{{ lso_namespace }}"
37-
when: lso_namespace is defined
38-
39-
# Disable all default operator sources
40-
- name: Disable all default operator sources
41-
command: oc patch operatorhub.config.openshift.io/cluster -p='{"spec":{"disableAllDefaultSources":true}}' --type=merge
42-
register: patch_operatorhub
43-
failed_when: patch_operatorhub.rc != 0
37+
when: lso_namespace is defined
4438

4539
# Create ICSP & catalogsource for installing local storage operator
4640
- name: Local Storage Operator deployment
@@ -91,14 +85,13 @@
9185
source: "{{ lso_catalogsource_name }}"
9286
sourceNamespace: openshift-marketplace
9387

94-
- name: Wait for CSV to be created
95-
pause:
96-
seconds: 30
97-
9888
# Check LocalStorage Operator progress
9989
- name: Check LocalStorage Operator progress
10090
command: oc get ip -n "{{ lso_namespace }}"
10191
register: ip_status
92+
until: ip_status.stdout|int == 0 and ip_status.stderr == ""
93+
retries: 10
94+
delay: 30
10295
failed_when:
10396
- ip_status.rc != 0
10497
- ip_status.stdout == ""
@@ -107,6 +100,9 @@
107100
- name: Check LocalStorage Operator CSV
108101
shell: "oc get csv -A | grep local-storage-operator | grep Succeeded"
109102
register: csv_status
103+
until: csv_status.stdout != "" and csv_status.stderr == ""
104+
retries: 10
105+
delay: 30
110106
failed_when: csv_status.rc != 0
111107
when:
112108
- lso_namespace is defined
@@ -161,17 +157,19 @@
161157
- name: Verify creation of diskmanager pods
162158
shell: "oc get pods -n openshift-local-storage --selector=app=diskmaker-manager | grep Running"
163159
register: check_pods
160+
until: check_pods.stdout|int == 0 and check_pods.stderr == ""
161+
retries: 10
162+
delay: 30
164163
failed_when: check_pods.rc != 0
165164

166165
- name: Verify the creation of StorageClass
167166
command: oc get sc localblock
168167
register: check_sc
168+
until: check_sc.stdout|int == 0 and check_sc.stderr == ""
169+
retries: 10
170+
delay: 30
169171
failed_when: check_sc.rc != 0
170172

171-
- name: Wait for persistent volumes to be created
172-
pause:
173-
minutes: 1
174-
175173
- name: Delete existing PersistentVolumeClaim and Pod (if they exist)
176174
kubernetes.core.k8s:
177175
state: absent
@@ -229,23 +227,26 @@
229227
- devicePath: "{{ device_path }}"
230228
name: local-data
231229

232-
- name: Wait for pods to be created
233-
pause:
234-
seconds: 30
235-
236230
- name: Verify the status of Persistent Volumes
237231
shell: "oc get pv --selector storage.openshift.com/owner-kind=LocalVolumeSet | grep Bound"
238232
register: check_pv
233+
until: check_pv.stdout|int == 0 and check_pv.stderr == ""
234+
retries: 10
235+
delay: 30
239236
failed_when: check_pv.rc != 0
240237

241238
- name: Verify PVC status
242239
shell: "oc get pvc test-local-claim -n default | grep Bound"
243240
register: pvc_status
241+
until: pvc_status.stdout|int == 0 and pvc_status.stderr == ""
242+
retries: 10
243+
delay: 30
244244
failed_when: pvc_status.rc != 0
245245

246246
- name: Verify Pod status
247247
shell: "oc get pods busybox-lso -n default -o jsonpath='{.status.phase}'"
248248
register: pod_status
249+
until: pod_status.stdout|int == 0 and pod_status.stderr == ""
249250
retries: 5
250251
delay: 10
251-
failed_when: pod_status.stdout != "Running"
252+
failed_when: pod_status.stdout != "Pending"

0 commit comments

Comments
 (0)