12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- ---
- - shell: >
- {{ openshift.common.client_binary }} -n {{ openshift_metrics_project | quote }}
- --config={{ mktemp.stdout }}/admin.kubeconfig
- get rc hawkular-cassandra-{{node}} -o jsonpath='{.spec.replicas}' || echo 0
- vars:
- node: "{{ item }}"
- register: cassandra_replica_count
- with_sequence: count={{ openshift_metrics_cassandra_replicas }}
- changed_when: false
- failed_when: false
- - name: generate hawkular-cassandra replication controllers
- template:
- src: hawkular_cassandra_rc.j2
- dest: "{{ mktemp.stdout }}/templates/hawkular-cassandra-rc{{ item }}.yaml"
- vars:
- node: "{{ item }}"
- master: "{{ (item == '1')|string|lower }}"
- replica_count: "{{cassandra_replica_count.results[item|int - 1].stdout}}"
- node_selector: "{{openshift_metrics_cassandra_nodeselector | default('') }}"
- with_sequence: count={{ openshift_metrics_cassandra_replicas }}
- changed_when: false
- - set_fact: openshift_metrics_cassandra_pvc_prefix="hawkular-metrics"
- when: not openshift_metrics_cassandra_pvc_prefix or openshift_metrics_cassandra_pvc_prefix == ''
- - name: generate hawkular-cassandra persistent volume claims
- template:
- src: pvc.j2
- dest: "{{ mktemp.stdout }}/templates/hawkular-cassandra-pvc{{ item }}.yaml"
- vars:
- obj_name: "{{ openshift_metrics_cassandra_pvc_prefix }}-{{ item }}"
- labels:
- metrics-infra: hawkular-cassandra
- access_modes: "{{ openshift_metrics_cassandra_pvc_access | list }}"
- size: "{{ openshift_metrics_cassandra_pvc_size }}"
- with_sequence: count={{ openshift_metrics_cassandra_replicas }}
- 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{{ item }}.yaml"
- vars:
- obj_name: "{{ openshift_metrics_cassandra_pvc_prefix }}-{{ item }}"
- labels:
- metrics-infra: hawkular-cassandra
- annotations:
- volume.alpha.kubernetes.io/storage-class: dynamic
- access_modes: "{{ openshift_metrics_cassandra_pvc_access | list }}"
- size: "{{ openshift_metrics_cassandra_pvc_size }}"
- with_sequence: count={{ openshift_metrics_cassandra_replicas }}
- when: openshift_metrics_cassandra_storage_type == 'dynamic'
- changed_when: false
|