|
1 | 1 | --- |
| 2 | +- name: Retrieve all kubelet-serving certificates |
| 3 | + kubernetes.core.k8s_info: |
| 4 | + api_version: certificates.k8s.io/v1 |
| 5 | + kind: CertificateSigningRequest |
| 6 | + kubeconfig: "{{ tools_cluster.kubeconfig }}" |
| 7 | + field_selectors: |
| 8 | + - spec.signerName=kubernetes.io/kubelet-serving |
| 9 | + wait: true |
| 10 | + register: csr_info |
| 11 | + when: |
| 12 | + - tools_cluster.cloud_provider == 'kind' |
| 13 | + |
| 14 | +- name: Approve pending certificates |
| 15 | + ansible.builtin.command: |
| 16 | + cmd: kubectl certificate approve {{ item.metadata.name }} |
| 17 | + environment: |
| 18 | + KUBECONFIG: "{{ tools_cluster.kubeconfig | ansible.builtin.expanduser }}" |
| 19 | + register: cert_approve_output |
| 20 | + changed_when: cert_approve_output.rc == 0 |
| 21 | + loop: "{{ csr_info.resources }}" |
| 22 | + when: |
| 23 | + - tools_cluster.cloud_provider == 'kind' |
| 24 | + - item.status.conditions is not defined |
| 25 | + |
| 26 | +- name: Wait for approvals to clear |
| 27 | + kubernetes.core.k8s_info: |
| 28 | + api_version: certificates.k8s.io/v1 |
| 29 | + kind: CertificateSigningRequest |
| 30 | + kubeconfig: "{{ tools_cluster.kubeconfig }}" |
| 31 | + name: "{{ item.metadata.name }}" |
| 32 | + wait: true |
| 33 | + wait_condition: |
| 34 | + type: Approved |
| 35 | + status: "True" |
| 36 | + loop: "{{ csr_info.resources }}" |
| 37 | + when: |
| 38 | + - tools_cluster.cloud_provider == 'kind' |
| 39 | + - item.status.conditions is not defined |
| 40 | + |
2 | 41 | - name: Import Prometheus installation tasks |
3 | 42 | ansible.builtin.import_tasks: |
4 | 43 | file: install_prometheus.yaml |
|
0 commit comments