diff --git a/roles/edpm_download_cache/tasks/main.yml b/roles/edpm_download_cache/tasks/main.yml index e79a5ff2c..dd82cf6e6 100644 --- a/roles/edpm_download_cache/tasks/main.yml +++ b/roles/edpm_download_cache/tasks/main.yml @@ -19,3 +19,8 @@ ansible.builtin.include_role: name: osp.edpm.edpm_bootstrap tasks_from: download_cache.yml + +- name: Download packages for edpm_network_config role + ansible.builtin.include_role: + name: osp.edpm.edpm_network_config + tasks_from: download_cache.yml diff --git a/roles/edpm_network_config/defaults/main.yml b/roles/edpm_network_config/defaults/main.yml index 6c5216459..1f8b55b60 100644 --- a/roles/edpm_network_config/defaults/main.yml +++ b/roles/edpm_network_config/defaults/main.yml @@ -27,6 +27,16 @@ # supported scenario. Refer to nmstate.io for configuration snippets. edpm_network_config_tool: os-net-config +# Packages needed by nmstate (via system-role) +edpm_network_config_systemrole_nmstate_dependencies: + - NetworkManager-ovs + +# seconds between retries for download tasks +edpm_network_config_download_delay: 5 + +# number of retries for download tasks +edpm_network_config_download_retries: 5 + edpm_network_config_update: false edpm_network_config_async_poll: 3 edpm_network_config_async_timeout: 300 diff --git a/roles/edpm_network_config/meta/argument_specs.yml b/roles/edpm_network_config/meta/argument_specs.yml index de3141e9c..99ed53d2c 100644 --- a/roles/edpm_network_config/meta/argument_specs.yml +++ b/roles/edpm_network_config/meta/argument_specs.yml @@ -4,6 +4,19 @@ argument_specs: main: short_description: The main entry point for the edpm_network_config role. options: + edpm_network_config_systemrole_nmstate_dependencies: + type: list + default: + - NetworkManager-ovs + description: Packages needed by nmstate (via system-role) + edpm_network_config_download_delay: + type: int + default: 5 + description: The seconds between retries for failed download tasks + edpm_network_config_download_retries: + type: int + default: 5 + description: The number of retries for failed download tasks edpm_network_config_tool: type: str description: Which network config tool should be used diff --git a/roles/edpm_network_config/tasks/download_cache.yml b/roles/edpm_network_config/tasks/download_cache.yml new file mode 100644 index 000000000..216cd5b3f --- /dev/null +++ b/roles/edpm_network_config/tasks/download_cache.yml @@ -0,0 +1,23 @@ +--- + +- name: Download packages needed by linux-system-role - nmstate + when: edpm_network_config_tool == 'nmstate' + ansible.builtin.dnf: + name: "{{ edpm_network_config_systemrole_nmstate_dependencies }}" + download_only: true + become: true + register: edpm_network_config_systemrole_nmstate_dependencies_download + until: edpm_network_config_systemrole_nmstate_dependencies_download.rc == 0 + retries: "{{ edpm_network_config_download_retries }}" + delay: "{{ edpm_network_config_download_delay }}" + +- name: Download os-net-config package + when: edpm_network_config_tool == 'os-net-config' + ansible.builtin.dnf: + name: "os-net-config" + download_only: true + become: true + register: edpm_network_config_onc_download + until: edpm_network_config_onc_download.rc == 0 + retries: "{{ edpm_network_config_download_retries }}" + delay: "{{ edpm_network_config_download_delay }}" diff --git a/roles/edpm_network_config/tasks/main.yml b/roles/edpm_network_config/tasks/main.yml index 7849c4f1d..dc0e5ef33 100644 --- a/roles/edpm_network_config/tasks/main.yml +++ b/roles/edpm_network_config/tasks/main.yml @@ -15,6 +15,7 @@ # under the License. - name: Configure network with network role from system roles [nmstate] + when: edpm_network_config_tool == 'nmstate' block: - name: Retrieve role name [nmstate] ansible.builtin.set_fact: @@ -28,9 +29,12 @@ delegate_to: localhost - name: Install OVS NetworkManager plugin [nmstate] ansible.builtin.dnf: - name: NetworkManager-ovs - state: latest + name: "{{ edpm_network_config_systemrole_nmstate_dependencies }}" + state: present register: nm_ovs_status + until: nm_ovs_status.rc == 0 + retries: "{{ edpm_network_config_download_retries }}" + delay: "{{ edpm_network_config_download_delay }}" - name: Restart NetworkManager after plugin installation [nmstate] ansible.builtin.systemd: name: NetworkManager @@ -39,7 +43,6 @@ - name: Load system-roles.network tasks [nmstate] ansible.builtin.include_role: name: "{{ systemrolename }}" - when: edpm_network_config_tool == 'nmstate' - name: Load edpm_network_config tasks [os-net-config] ansible.builtin.include_tasks: diff --git a/roles/edpm_network_config/tasks/network_config.yml b/roles/edpm_network_config/tasks/network_config.yml index 9c06e3aa1..6cc1cda68 100644 --- a/roles/edpm_network_config/tasks/network_config.yml +++ b/roles/edpm_network_config/tasks/network_config.yml @@ -37,14 +37,16 @@ ansible.builtin.include_role: name: osp.edpm.edpm_bootstrap tasks_from: "packages.yml" - vars: - edpm_bootstrap_dnf_use_cacheonly: false - name: Install os-net-config package become: true ansible.builtin.dnf: name: os-net-config - state: latest + state: present + register: edpm_network_config_onc_download + until: edpm_network_config_onc_download.rc == 0 + retries: "{{ edpm_network_config_download_retries }}" + delay: "{{ edpm_network_config_download_delay }}" - name: Ensure /var/lib/edpm-config directory exists become: true