diff --git a/tests/playbooks/tests_network_state.yml b/tests/playbooks/tests_network_state.yml index 69df631..4625b08 100644 --- a/tests/playbooks/tests_network_state.yml +++ b/tests/playbooks/tests_network_state.yml @@ -130,31 +130,6 @@ - route.stdout is search("table-id:(\s+)254") msg: the route configuration does not contain the specified route - - name: Set the DNS processing mode and the resolv.conf management mode - lineinfile: - path: /etc/NetworkManager/NetworkManager.conf - line: "rc-manager=unmanaged\ndns=systemd-resolved" - insertafter: \[main\] - - - name: Restart the NetworkManager - service: - name: NetworkManager - state: restarted - - - name: Install the systemd-resolved - package: - name: systemd-resolved - state: present - use: "{{ (__network_is_ostree | d(false)) | - ternary('ansible.posix.rhel_rpm_ostree', omit) }}" - when: - - ansible_distribution_major_version | int > 8 - - - name: Enable the systemd-resolved service - service: - name: systemd-resolved - enabled: true - - name: Configure the DNS import_role: name: linux-system-roles.network @@ -174,16 +149,10 @@ ignore_errors: true # noqa ignore-errors changed_when: false - - name: Get the DNS configuration from the file `/etc/resolv.conf` - command: cat /etc/resolv.conf - register: resolvconf - ignore_errors: true # noqa ignore-errors - changed_when: false - - - name: Check if `/etc/resolv.conf` is generated by NM - command: grep "Generated by NetworkManager" /etc/resolv.conf - register: generate_by_nm - ignore_errors: true # noqa ignore-errors + - name: Get the DNS configuration from the file + `/run/NetworkManager/no-stub-resolv.conf` + command: cat /run/NetworkManager/no-stub-resolv.conf + register: no_stub_resolvconf changed_when: false - name: Assert that the nmstatectl contains the specified DNS configuration @@ -194,24 +163,15 @@ - nmstatectl.stdout is search("2001:4860:4860::8888") msg: the nmstatectl does not contain the specified DNS configuration - - name: Assert that the file `/etc/resolv.conf` does not contain the - specified DNS configuration + - name: Assert that the file `/run/NetworkManager/no-stub-resolv.conf` + contains the specified DNS configuration assert: that: - - resolvconf.stdout is not search("example.com") and - resolvconf.stdout is not search("example.org") and - resolvconf.stdout is not search("2001:4860:4860::8888") or - generate_by_nm.stdout | length == 0 - msg: the file `/etc/resolv.conf` contains the specified DNS - configuration - - - name: "** TEST check resolvectl" - command: resolvectl - register: result - until: "'example.com' in result.stdout" - retries: 20 - delay: 2 - changed_when: false + - no_stub_resolvconf.stdout is search("example.com") + - no_stub_resolvconf.stdout is search("example.org") + - no_stub_resolvconf.stdout is search("2001:4860:4860::8888") + msg: the file `/run/NetworkManager/no-stub-resolv.conf` does not + contain the specified DNS configuration - name: Include the task 'delete_interface.yml' include_tasks: tasks/delete_interface.yml