From 3e15165438043b0c75a21e8150006812dcb46929 Mon Sep 17 00:00:00 2001 From: Roberto Alfieri Date: Thu, 21 Sep 2023 10:44:46 +0200 Subject: [PATCH] Enable `download-cache` support in `edpm_ovn` role Signed-off-by: Roberto Alfieri --- .../edpm_download_cache/tasks/container_images.yml | 8 ++++++++ roles/edpm_ovn/defaults/main.yml | 7 +++++++ roles/edpm_ovn/meta/argument_specs.yml | 8 ++++++++ roles/edpm_ovn/tasks/download_cache.yml | 13 +++++++++++++ 4 files changed, 36 insertions(+) create mode 100644 roles/edpm_ovn/tasks/download_cache.yml diff --git a/roles/edpm_download_cache/tasks/container_images.yml b/roles/edpm_download_cache/tasks/container_images.yml index 5c4297691..f71f9fff4 100644 --- a/roles/edpm_download_cache/tasks/container_images.yml +++ b/roles/edpm_download_cache/tasks/container_images.yml @@ -15,3 +15,11 @@ tags: - edpm_podman - download_cache + +- name: Download images for edpm_ovn role + ansible.builtin.include_role: + name: osp.edpm.edpm_ovn + tasks_from: download_cache.yml + tags: + - edpm_ovn + - download_cache diff --git a/roles/edpm_ovn/defaults/main.yml b/roles/edpm_ovn/defaults/main.yml index 803255073..ca27a126e 100644 --- a/roles/edpm_ovn/defaults/main.yml +++ b/roles/edpm_ovn/defaults/main.yml @@ -1,5 +1,12 @@ --- # defaults file for edpm_ovn + +# seconds between retries for download tasks +edpm_ovn_images_download_delay: 5 + +# number of retries for download tasks +edpm_ovn_images_download_retries: 5 + edpm_ovn_config_src: /var/lib/openstack/configs/ovn edpm_ovn_neutron_metadata_agent_config_dir: /var/lib/config-data/ansible-generated/neutron-ovn-metadata-agent edpm_ovn_metadata_agent_log_dir: "/var/log/neutron" diff --git a/roles/edpm_ovn/meta/argument_specs.yml b/roles/edpm_ovn/meta/argument_specs.yml index 908f92ded..dbbc7edea 100644 --- a/roles/edpm_ovn/meta/argument_specs.yml +++ b/roles/edpm_ovn/meta/argument_specs.yml @@ -4,6 +4,14 @@ argument_specs: main: short_description: The main entry point for the edpm_ovn role. options: + edpm_ovn_images_download_delay: + type: int + default: 5 + description: The seconds between retries for failed download tasks + edpm_ovn_images_download_retries: + type: int + default: 5 + description: The number of retries for failed download tasks edpm_enable_chassis_gw: default: false description: '' diff --git a/roles/edpm_ovn/tasks/download_cache.yml b/roles/edpm_ovn/tasks/download_cache.yml new file mode 100644 index 000000000..b9869a6b3 --- /dev/null +++ b/roles/edpm_ovn/tasks/download_cache.yml @@ -0,0 +1,13 @@ +--- + +- name: Download needed container images + containers.podman.podman_image: + name: "{{ item }}" + loop: + - "{{ edpm_ovn_controller_agent_image }}" + - "{{ edpm_ovn_metadata_agent_image }}" + become: true + register: edpm_ovn_images_download + until: edpm_ovn_images_download.failed == false + retries: "{{ edpm_ovn_images_download_retries }}" + delay: "{{ edpm_ovn_images_download_delay }}"