prole/infrastructure/roles/k3s/tasks/import_images.yml
chrisfu 125da5669b Fix k3s CNPG image registry resolution and import flows
- In k3s mode, resolve CNPG images to a cluster-reachable internal registry and ignore k3d/localhost-ish registry values.

- Avoid any k3d cluster/containerd interactions when PROLE_MODE=k3s; add a preflight-image action.

- Extend init scripts and Ansible k3s/mariadb import tasks/playbooks for the updated k3s flow.

- Add/extend installer UI + tests around services and action/milestone helpers.

- Add merlin MariaDB provisioning playbook, services init-script test, and a k3s datastore SQL snapshot.

Co-authored-by: Junie <junie@jetbrains.com>
2026-03-07 00:23:00 -08:00

35 lines
1.1 KiB
YAML

---
- name: Wait for k3s containerd socket to be present
ansible.builtin.wait_for:
path: /run/k3s/containerd/containerd.sock
state: present
timeout: "{{ k3s_containerd_socket_wait_timeout | default(120) }}"
changed_when: false
- name: Verify k3s container runtime is available
ansible.builtin.command: k3s ctr -n k8s.io version
register: _k3s_ctr_version
changed_when: false
failed_when: false
retries: 12
delay: 5
until: _k3s_ctr_version.rc == 0
- name: Fail if k3s container runtime is not available
ansible.builtin.fail:
msg: >-
k3s/containerd is not ready on {{ inventory_hostname }}.
Expected /run/k3s/containerd/containerd.sock and a working `k3s ctr`.
Check the k3s service status and node networking, then retry the import.
when: _k3s_ctr_version.rc != 0
- name: Import image tarballs into k3s containerd
ansible.builtin.include_tasks: import_image.yml
loop: "{{ k3s_import_images }}"
loop_control:
loop_var: k3s_import_image
label: "{{ k3s_import_image.path | basename }}"
when:
- (k3s_import_images | length) > 0