k3s (D6): Dienst-VM k3s per tofu, Rollen k3s-server/k3s-agent/k3s-apps, Manifeste, NEX-Sprachdienste als k3s-Umzugstest
ci / test (push) Failing after 22s
ci / test (push) Failing after 22s
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
6cccc01d14
commit
2c1d43e9c7
@@ -103,6 +103,20 @@
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
|
||||
- name: VMs auf diesem Knoten lesen
|
||||
ansible.builtin.command: ls /etc/pve/qemu-server/
|
||||
register: local_vms
|
||||
check_mode: false
|
||||
changed_when: false
|
||||
|
||||
# Infra-Gäste = Container (ct:) plus Dienst-VMs ohne GPU (vm:, D6); beide liegen auf tank mit HA
|
||||
- name: Infra-Gäste zusammenstellen
|
||||
ansible.builtin.set_fact:
|
||||
pve_infra_guests: >-
|
||||
{{ (knaster_pve.containers | dict2items | map('combine', {'kind': 'ct'}) | list)
|
||||
+ (knaster_pve.service_vms | default({}) | dict2items | map('combine', {'kind': 'vm'}) | list) }}
|
||||
pve_local_guest_confs: "{{ local_cts.stdout_lines + local_vms.stdout_lines }}"
|
||||
|
||||
- name: Bestehende Replikationsjobs lesen
|
||||
ansible.builtin.command: pvesr list
|
||||
register: pvesr_jobs
|
||||
@@ -113,12 +127,12 @@
|
||||
ansible.builtin.command: >
|
||||
pvesr create-local-job {{ item.0.value.vmid }}-{{ idx }} {{ item.1 }}
|
||||
--schedule '{{ knaster_pve.replication_schedule }}' --comment 'knaster {{ item.0.key }}'
|
||||
loop: "{{ knaster_pve.containers | dict2items | subelements('value.replicate_to', skip_missing=True) }}"
|
||||
loop: "{{ pve_infra_guests | subelements('value.replicate_to', skip_missing=True) }}"
|
||||
vars:
|
||||
idx: "{{ item.0.value.replicate_to.index(item.1) }}"
|
||||
when:
|
||||
- item.0.value.node == inventory_hostname
|
||||
- (item.0.value.vmid | string) + '.conf' in local_cts.stdout_lines
|
||||
- (item.0.value.vmid | string) + '.conf' in pve_local_guest_confs
|
||||
- (item.0.value.vmid | string) + '-' + (idx | string) not in pvesr_jobs.stdout
|
||||
changed_when: true
|
||||
|
||||
@@ -130,14 +144,14 @@
|
||||
|
||||
- name: Infra-Gäste unter HA stellen (erst wenn der Container auf diesem Knoten existiert)
|
||||
ansible.builtin.command: >
|
||||
ha-manager add ct:{{ item.value.vmid }} --state started --max_restart 1 --max_relocate 1
|
||||
ha-manager add {{ item.kind }}:{{ item.value.vmid }} --state started --max_restart 1 --max_relocate 1
|
||||
--comment 'knaster {{ item.key }}'
|
||||
loop: "{{ knaster_pve.containers | dict2items }}"
|
||||
loop: "{{ pve_infra_guests }}"
|
||||
when:
|
||||
- item.value.ha | default(false)
|
||||
- item.value.node == inventory_hostname
|
||||
- (item.value.vmid | string) + '.conf' in local_cts.stdout_lines
|
||||
- ('ct:' + (item.value.vmid | string)) not in ha_config.stdout
|
||||
- (item.value.vmid | string) + '.conf' in pve_local_guest_confs
|
||||
- (item.kind + ':' + (item.value.vmid | string)) not in ha_config.stdout
|
||||
changed_when: true
|
||||
|
||||
- name: HA-Regeln lesen
|
||||
@@ -149,13 +163,13 @@
|
||||
# Strikt: Die Gäste liegen auf tank, den gibt es nur auf dem Heimatknoten und den Replikationszielen
|
||||
- name: Node-Affinity für Infra-Gäste (Heimatknoten bevorzugt, sonst Replikationsziele)
|
||||
ansible.builtin.command: >
|
||||
ha-manager rules add node-affinity knaster-{{ item.key }} --resources ct:{{ item.value.vmid }}
|
||||
ha-manager rules add node-affinity knaster-{{ item.key }} --resources {{ item.kind }}:{{ item.value.vmid }}
|
||||
--nodes {{ ([item.value.node ~ ':2'] + (item.value.replicate_to | map('regex_replace', '$', ':1') | list)) | join(',') }}
|
||||
--strict 1 --comment 'knaster {{ item.key }}'
|
||||
loop: "{{ knaster_pve.containers | dict2items }}"
|
||||
loop: "{{ pve_infra_guests }}"
|
||||
when:
|
||||
- item.value.ha | default(false)
|
||||
- item.value.node == inventory_hostname
|
||||
- (item.value.vmid | string) + '.conf' in local_cts.stdout_lines
|
||||
- (item.value.vmid | string) + '.conf' in pve_local_guest_confs
|
||||
- ('knaster-' + item.key) not in ha_rules.stdout
|
||||
changed_when: true
|
||||
|
||||
Reference in New Issue
Block a user