Files

28 lines
785 B
YAML
Raw Permalink Normal View History

---
2026-05-02 00:41:25 +00:00
- name: Pull Rancher images into containerd
shell: |
if /usr/local/bin/ctr -n k8s.io images ls -q | grep -Fx -- "{{ item }}" >/dev/null; 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 }}"
if timeout 240s /usr/local/bin/ctr -n k8s.io images 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: rancher_image_pull
loop: "{{ rancher_images_to_prepull }}"
2026-05-02 00:41:25 +00:00
changed_when: "'pulled image' in rancher_image_pull.stdout"