Files
HetznerTerra/ansible/roles/bootstrap-image-prepull/tasks/main.yml
T

28 lines
764 B
YAML
Raw Normal View History

---
2026-05-02 00:41:25 +00:00
- name: Pull bootstrap images into containerd
shell: |
2026-05-03 01:50:22 +00:00
if /usr/local/bin/k3s crictl inspecti "{{ item }}" >/dev/null 2>&1; then
echo "already present"
exit 0
fi
2026-05-02 02:42:58 +00:00
echo "mtu=$(cat /sys/class/net/{{ ansible_default_ipv4.interface | default('eth0') }}/mtu 2>/dev/null || true)"
ip route get 1.1.1.1 || true
for attempt in 1 2 3 4 5 6 7 8 9 10; do
echo "pull attempt ${attempt}: {{ item }}"
2026-05-03 01:50:22 +00:00
if timeout 240s /usr/local/bin/k3s crictl pull "{{ item }}"; then
echo "pulled image"
exit 0
fi
2026-05-02 02:42:58 +00:00
sleep 15
done
exit 1
args:
executable: /bin/bash
register: bootstrap_image_pull
loop: "{{ bootstrap_prepull_images }}"
2026-05-02 00:41:25 +00:00
changed_when: "'pulled image' in bootstrap_image_pull.stdout"