mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-02-04 08:48:42 +03:00
Replace deprecated 'with_dict' with 'loop' (#7442)
This commit is contained in:
@@ -10,34 +10,29 @@
|
||||
url: "{{ item.value.url }}"
|
||||
dest: "{{ images_dir }}/{{ item.value.filename }}"
|
||||
checksum: "{{ item.value.checksum }}"
|
||||
with_dict:
|
||||
- "{{ images }}"
|
||||
loop: "{{ images|dict2items }}"
|
||||
|
||||
- name: Unxz compressed images
|
||||
command: unxz --force {{ images_dir }}/{{ item.value.filename }}
|
||||
with_dict:
|
||||
- "{{ images }}"
|
||||
loop: "{{ images|dict2items }}"
|
||||
when:
|
||||
- item.value.filename.endswith('.xz')
|
||||
|
||||
- name: Convert images which is not in qcow2 format
|
||||
command: qemu-img convert -O qcow2 {{ images_dir }}/{{ item.value.filename.rstrip('.xz') }} {{ images_dir }}/{{ item.key }}.qcow2
|
||||
with_dict:
|
||||
- "{{ images }}"
|
||||
loop: "{{ images|dict2items }}"
|
||||
when:
|
||||
- not (item.value.converted|bool)
|
||||
|
||||
- name: Make sure all images are ending with qcow2
|
||||
command: cp {{ images_dir }}/{{ item.value.filename.rstrip('.xz') }} {{ images_dir }}/{{ item.key }}.qcow2
|
||||
with_dict:
|
||||
- "{{ images }}"
|
||||
loop: "{{ images|dict2items }}"
|
||||
when:
|
||||
- item.value.converted|bool
|
||||
|
||||
- name: Resize images # noqa 301
|
||||
command: qemu-img resize {{ images_dir }}/{{ item.key }}.qcow2 +8G
|
||||
with_dict:
|
||||
- "{{ images }}"
|
||||
loop: "{{ images|dict2items }}"
|
||||
|
||||
# STEP 2: Include the images inside a container
|
||||
- name: Template default Dockerfile
|
||||
@@ -47,16 +42,14 @@
|
||||
|
||||
- name: Create docker images for each OS # noqa 301
|
||||
command: docker build -t {{ registry }}/vm-{{ item.key }}:{{ item.value.tag }} --build-arg cloud_image="{{ item.key }}.qcow2" {{ images_dir }}
|
||||
with_dict:
|
||||
- "{{ images }}"
|
||||
loop: "{{ images|dict2items }}"
|
||||
|
||||
- name: docker login # noqa 301
|
||||
command: docker login -u="{{ docker_user }}" -p="{{ docker_password }}" "{{ docker_host }}"
|
||||
|
||||
- name: docker push image # noqa 301
|
||||
command: docker push {{ registry }}/vm-{{ item.key }}:{{ item.value.tag }}
|
||||
with_dict:
|
||||
- "{{ images }}"
|
||||
loop: "{{ images|dict2items }}"
|
||||
|
||||
- name: docker logout # noqa 301
|
||||
command: docker logout -u="{{ docker_user }}" "{{ docker_host }}"
|
||||
|
||||
Reference in New Issue
Block a user