diff --git a/roles/satellite-clone/tasks/interface_check.yml b/roles/satellite-clone/tasks/interface_check.yml index b7293ad..fcc77c1 100644 --- a/roles/satellite-clone/tasks/interface_check.yml +++ b/roles/satellite-clone/tasks/interface_check.yml @@ -1,52 +1,11 @@ --- -- name: get answers file path from yaml - get_value_from_yaml_in_tarball: - tarball: "{{ config_files_path }}" - target_file: "etc/foreman-installer/scenarios.d/{{ satellite_scenario }}.yaml" - keys: [":answer_file"] - register: answer_file - -- name: set answers file path - set_fact: - satellite_answers_path: "{{ answer_file.value | relpath('/') }}" - -- name: Check if DNS is enabled - get_value_from_yaml_in_tarball: - tarball: "{{ config_files_path }}" - target_file: "{{ satellite_answers_path }}" - keys: ["foreman_proxy", "dns"] - register: dns_enabled - -- name: Check if DHCP is enabled - get_value_from_yaml_in_tarball: - tarball: "{{ config_files_path }}" - target_file: "{{ satellite_answers_path }}" - keys: ["foreman_proxy", "dhcp"] - register: dhcp_enabled - -- name: Grab DNS interface from Satellite answer file - get_value_from_yaml_in_tarball: - tarball: "{{ config_files_path }}" - target_file: "{{ satellite_answers_path }}" - keys: ["foreman_proxy", "dns_interface"] - register: dns_interface - when: dns_enabled.value - -- name: Grab DHCP interface from Satellite answer file - get_value_from_yaml_in_tarball: - tarball: "{{ config_files_path }}" - target_file: "{{ satellite_answers_path }}" - keys: ["foreman_proxy", "dhcp_interface"] - register: dhcp_interface - when: dhcp_enabled.value - -- name: Fail if interfaces on machine do not match answer file interfaces +- name: Fail if interfaces on machine do not match backup metadata interfaces fail: - msg: "The network interface {{ dns_interface.value }} setup for DNS and {{ dhcp_interface.value }} setup for DHCP do not match the network interfaces on the current machine" + msg: "The network interface {{ proxy_config.dns_interface }} setup for DNS and {{ proxy_config.dhcp_interface }} setup for DHCP do not match the network interfaces on the current machine" when: - - dns_enabled.value - - dhcp_enabled.value - - dns_interface.value not in network_interfaces - - dhcp_interface.value not in network_interfaces + - proxy_config.dns + - proxy_config.dhcp + - proxy_config.dns_interface not in network_interfaces + - proxy_config.dhcp_interface not in network_interfaces vars: network_interfaces: "{{ ansible_interfaces | reject('match', 'lo') | list }}" diff --git a/roles/satellite-clone/tasks/main.yml b/roles/satellite-clone/tasks/main.yml index abc5538..de128cc 100644 --- a/roles/satellite-clone/tasks/main.yml +++ b/roles/satellite-clone/tasks/main.yml @@ -3,13 +3,13 @@ include_tasks: pre_install_check.yml when: run_pre_install_check +- name: Run backup version check + include_tasks: backup_satellite_version_check.yml + - name: Run interface check include_tasks: interface_check.yml when: run_pre_install_check and check_networking_interfaces -- name: Run backup version check - include_tasks: backup_satellite_version_check.yml - - name: Run backup check include_tasks: backup_check.yml