-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
verify interfaces based on backup metadata not answers
- Loading branch information
Showing
2 changed files
with
8 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
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 }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters