54 lines
2.0 KiB
YAML
54 lines
2.0 KiB
YAML
- block:
|
|
|
|
- name: Increase replicas for each volume
|
|
kubernetes.core.k8s:
|
|
api_version: longhorn.io/v1beta2
|
|
kind: volume
|
|
name: "{{ item.metadata.name }}"
|
|
namespace: longhorn-system
|
|
state: patched
|
|
definition: |
|
|
spec:
|
|
numberOfReplicas: {{ lookup('kubernetes.core.k8s', kind='node', kubeconfig=(kubeconfig.path)) | length | int }}
|
|
kubeconfig: "{{ kubeconfig.path }}"
|
|
loop: "{{ query('kubernetes.core.k8s', api_version='longhorn.io/v1beta2', kind='volume', namespace='longhorn-system', kubeconfig=(kubeconfig.path)) }}"
|
|
loop_control:
|
|
label: "{{ item.metadata.name }}"
|
|
|
|
- name: Wait for replica rebuilds to complete
|
|
ansible.builtin.uri:
|
|
url: https://storage.{{ vapp['metacluster.fqdn'] }}/v1/volumes
|
|
method: GET
|
|
register: volume_details
|
|
until:
|
|
- volume_details.json is defined
|
|
- (volume_details.json | json_query('data[? state==`attached`].robustness') | unique | length) == 1
|
|
- (volume_details.json | json_query('data[? state==`attached`].robustness') | first) == "healthy"
|
|
retries: "{{ ( playbook.retries * 2) | int }}"
|
|
delay: "{{ (storage_benchmark | int) * (playbook.delay.long | int) }}"
|
|
|
|
- name: Upgrade longhorn chart
|
|
kubernetes.core.helm:
|
|
name: longhorn
|
|
chart_ref: /opt/metacluster/helm-charts/longhorn
|
|
release_namespace: longhorn-system
|
|
wait: false
|
|
kubeconfig: "{{ kubeconfig.path }}"
|
|
values: "{{ components['longhorn'].chart_values }}"
|
|
|
|
- name: Ensure longhorn API availability
|
|
ansible.builtin.uri:
|
|
url: https://storage.{{ vapp['metacluster.fqdn'] }}/v1
|
|
method: GET
|
|
register: api_readycheck
|
|
until:
|
|
- api_readycheck is not failed
|
|
retries: "{{ playbook.retries }}"
|
|
delay: "{{ (storage_benchmark | int) * (playbook.delay.long | int) }}"
|
|
|
|
module_defaults:
|
|
ansible.builtin.uri:
|
|
validate_certs: no
|
|
status_code: [200, 201]
|
|
body_format: json
|