fix: remove runner image archive path
This commit is contained in:
@@ -1,47 +1,11 @@
|
||||
---
|
||||
- name: Check for runner-provided bootstrap image archives
|
||||
stat:
|
||||
path: "{{ playbook_dir }}/../outputs/bootstrap-image-archives/{{ item | regex_replace('[/:]', '_') }}.tar"
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
register: bootstrap_image_archive_stats
|
||||
loop: "{{ bootstrap_prepull_images }}"
|
||||
|
||||
- name: Ensure remote bootstrap image archive directory exists
|
||||
file:
|
||||
path: /tmp/bootstrap-image-archives
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: Copy runner-provided bootstrap image archives
|
||||
copy:
|
||||
src: "{{ item.stat.path }}"
|
||||
dest: "/tmp/bootstrap-image-archives/{{ item.item | regex_replace('[/:]', '_') }}.tar"
|
||||
mode: "0644"
|
||||
loop: "{{ bootstrap_image_archive_stats.results }}"
|
||||
loop_control:
|
||||
label: "{{ item.item }}"
|
||||
when: item.stat.exists
|
||||
|
||||
- name: Import or pull bootstrap images into containerd
|
||||
- name: Pull bootstrap 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
|
||||
|
||||
archive="/tmp/bootstrap-image-archives/{{ item | regex_replace('[/:]', '_') }}.tar"
|
||||
if [ -s "${archive}" ]; then
|
||||
for attempt in 1 2 3; do
|
||||
if /usr/local/bin/ctr -n k8s.io images import "${archive}" && /usr/local/bin/ctr -n k8s.io images ls -q | grep -Fx -- "{{ item }}" >/dev/null; then
|
||||
echo "imported image"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
sleep 10
|
||||
done
|
||||
fi
|
||||
|
||||
for attempt in 1 2 3 4 5; do
|
||||
if timeout 180s /usr/local/bin/ctr -n k8s.io images pull "{{ item }}"; then
|
||||
echo "pulled image"
|
||||
@@ -56,4 +20,4 @@
|
||||
executable: /bin/bash
|
||||
register: bootstrap_image_pull
|
||||
loop: "{{ bootstrap_prepull_images }}"
|
||||
changed_when: "'imported image' in bootstrap_image_pull.stdout or 'pulled image' in bootstrap_image_pull.stdout"
|
||||
changed_when: "'pulled image' in bootstrap_image_pull.stdout"
|
||||
|
||||
@@ -1,23 +1,4 @@
|
||||
---
|
||||
- name: Check for runner-provided kube-vip image archive
|
||||
stat:
|
||||
path: "{{ playbook_dir }}/../outputs/kube-vip-bootstrap.tar"
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
register: kube_vip_bootstrap_archive
|
||||
|
||||
- name: Copy runner-provided kube-vip image archive
|
||||
copy:
|
||||
src: "{{ playbook_dir }}/../outputs/kube-vip-bootstrap.tar"
|
||||
dest: /tmp/kube-vip-bootstrap.tar
|
||||
mode: "0644"
|
||||
when: kube_vip_bootstrap_archive.stat.exists
|
||||
|
||||
- name: Import runner-provided kube-vip image archive
|
||||
command: /usr/local/bin/ctr -n k8s.io images import /tmp/kube-vip-bootstrap.tar
|
||||
changed_when: false
|
||||
when: kube_vip_bootstrap_archive.stat.exists
|
||||
|
||||
- name: Pre-pull kube-vip bootstrap images into containerd
|
||||
shell: |
|
||||
if /usr/local/bin/ctr -n k8s.io images ls -q | grep -Fx -- "{{ item }}" >/dev/null; then
|
||||
|
||||
@@ -1,47 +1,11 @@
|
||||
---
|
||||
- name: Check for runner-provided Rancher image archives
|
||||
stat:
|
||||
path: "{{ playbook_dir }}/../outputs/bootstrap-image-archives/{{ item | regex_replace('[/:]', '_') }}.tar"
|
||||
delegate_to: localhost
|
||||
become: false
|
||||
register: rancher_image_archive_stats
|
||||
loop: "{{ rancher_images_to_prepull }}"
|
||||
|
||||
- name: Ensure remote Rancher image archive directory exists
|
||||
file:
|
||||
path: /tmp/bootstrap-image-archives
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: Copy runner-provided Rancher image archives
|
||||
copy:
|
||||
src: "{{ item.stat.path }}"
|
||||
dest: "/tmp/bootstrap-image-archives/{{ item.item | regex_replace('[/:]', '_') }}.tar"
|
||||
mode: "0644"
|
||||
loop: "{{ rancher_image_archive_stats.results }}"
|
||||
loop_control:
|
||||
label: "{{ item.item }}"
|
||||
when: item.stat.exists
|
||||
|
||||
- name: Import or pull Rancher images into containerd
|
||||
- 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
|
||||
|
||||
archive="/tmp/bootstrap-image-archives/{{ item | regex_replace('[/:]', '_') }}.tar"
|
||||
if [ -s "${archive}" ]; then
|
||||
for attempt in 1 2 3; do
|
||||
if /usr/local/bin/ctr -n k8s.io images import "${archive}" && /usr/local/bin/ctr -n k8s.io images ls -q | grep -Fx -- "{{ item }}" >/dev/null; then
|
||||
echo "imported image"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
sleep 10
|
||||
done
|
||||
fi
|
||||
|
||||
for attempt in 1 2 3 4 5; do
|
||||
if timeout 180s /usr/local/bin/ctr -n k8s.io images pull "{{ item }}"; then
|
||||
echo "pulled image"
|
||||
@@ -56,4 +20,4 @@
|
||||
executable: /bin/bash
|
||||
register: rancher_image_pull
|
||||
loop: "{{ rancher_images_to_prepull }}"
|
||||
changed_when: "'imported image' in rancher_image_pull.stdout or 'pulled image' in rancher_image_pull.stdout"
|
||||
changed_when: "'pulled image' in rancher_image_pull.stdout"
|
||||
|
||||
@@ -104,43 +104,6 @@
|
||||
roles:
|
||||
- k3s-server
|
||||
|
||||
- name: Export kube-vip image from primary control plane
|
||||
hosts: control_plane[0]
|
||||
become: true
|
||||
|
||||
tasks:
|
||||
- name: Export kube-vip image for secondary control planes
|
||||
command: >-
|
||||
/usr/local/bin/ctr -n k8s.io images export
|
||||
/tmp/kube-vip-bootstrap.tar
|
||||
ghcr.io/kube-vip/kube-vip:v1.1.2
|
||||
changed_when: false
|
||||
|
||||
- name: Fetch kube-vip image archive
|
||||
fetch:
|
||||
src: /tmp/kube-vip-bootstrap.tar
|
||||
dest: ../outputs/kube-vip-bootstrap.tar
|
||||
flat: true
|
||||
|
||||
- name: Seed kube-vip image on secondary control planes
|
||||
hosts: control_plane[1:]
|
||||
become: true
|
||||
|
||||
tasks:
|
||||
- name: Copy kube-vip image archive
|
||||
copy:
|
||||
src: ../outputs/kube-vip-bootstrap.tar
|
||||
dest: /tmp/kube-vip-bootstrap.tar
|
||||
mode: "0644"
|
||||
|
||||
- name: Import kube-vip image into containerd
|
||||
command: /usr/local/bin/ctr -n k8s.io images import /tmp/kube-vip-bootstrap.tar
|
||||
register: kube_vip_secondary_import
|
||||
until: kube_vip_secondary_import.rc == 0
|
||||
retries: 3
|
||||
delay: 10
|
||||
changed_when: false
|
||||
|
||||
- name: Wait for all control plane nodes to be Ready
|
||||
hosts: control_plane[0]
|
||||
become: true
|
||||
|
||||
Reference in New Issue
Block a user