12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- ---
- - name: Check to see if PVC already exists in actual namespace
- oc_obj:
- state: list
- kind: pvc
- name: "{{ openshift_metrics_cassandra_pvc_prefix }}-{{ metrics_pvc_index }}"
- namespace: "{{openshift_metrics_project}}"
- register: metrics_pvc
- # Migration process for PV to another namespace.
- - name: Check if we need to move cassandra PV to another namespace.
- include_tasks: migrate_cassandra_pvcs.yaml
- # _metrics_pvc.results.results | length > 0 returns a false positive
- # so we check for the presence of 'stderr' to determine if the obj exists or not
- # the RC for existing and not existing is both 0
- # No PVC exist (either new or old namespace), so it's a new installation
- - when:
- - metrics_pvc.results.stderr is defined and not openshift_metrics_migrate_namespace
- block:
- - name: generate hawkular-cassandra persistent volume claims
- template:
- src: pvc.j2
- dest: "{{ mktemp.stdout }}/templates/hawkular-cassandra-pvc{{ metrics_pvc_index }}.yaml"
- vars:
- obj_name: "{{ openshift_metrics_cassandra_pvc_prefix }}-{{ metrics_pvc_index }}"
- labels:
- metrics-infra: hawkular-cassandra
- access_modes: "{{ openshift_metrics_cassandra_pvc_access | list }}"
- size: "{{ openshift_metrics_cassandra_pvc_size }}"
- pv_selector: "{{ openshift_metrics_cassandra_pv_selector }}"
- storage_class_name: "{{ openshift_metrics_cassandra_pvc_storage_class_name | default('', true) }}"
- when:
- - openshift_metrics_cassandra_storage_type != 'emptydir'
- - openshift_metrics_cassandra_storage_type != 'dynamic'
- changed_when: false
- - name: generate hawkular-cassandra persistent volume claims (dynamic)
- template:
- src: pvc.j2
- dest: "{{ mktemp.stdout }}/templates/hawkular-cassandra-pvc{{ metrics_pvc_index }}.yaml"
- vars:
- obj_name: "{{ openshift_metrics_cassandra_pvc_prefix }}-{{ metrics_pvc_index }}"
- labels:
- metrics-infra: hawkular-cassandra
- access_modes: "{{ openshift_metrics_cassandra_pvc_access | list }}"
- size: "{{ openshift_metrics_cassandra_pvc_size }}"
- pv_selector: "{{ openshift_metrics_cassandra_pv_selector }}"
- storage_class_name: "{{ openshift_metrics_cassandra_pvc_storage_class_name | default('', true) }}"
- when: openshift_metrics_cassandra_storage_type == 'dynamic'
- changed_when: false
|