Skip to content

Commit

Permalink
Create systemd-resolved config files for DNS
Browse files Browse the repository at this point in the history
We were writing the server IP directly to resolv.conf in
APITest and EnrollmentTest, use systemd-resolved config file instead, as
we already do in AuthenticationTest.

Signed-off-by: Antonio Torres <[email protected]>
  • Loading branch information
antoniotorresm committed Jul 22, 2022
1 parent 68b224a commit 7a6df2a
Showing 1 changed file with 26 additions and 14 deletions.
40 changes: 26 additions & 14 deletions src/ipaperftest/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,19 @@ def getLevelName(level):
hosts: ipaclients
become: yes
tasks:
- lineinfile:
path: /etc/resolv.conf
regexp: ".*"
state: absent
- lineinfile:
path: /etc/resolv.conf
line: nameserver {server_ip}
- file:
path: /etc/systemd/resolved.conf.d
state: directory
- copy:
dest: /etc/systemd/resolved.conf.d/dns.conf
content: |
[Resolve]
DNS={server_ip}
Domains=~.
- systemd:
name: systemd-resolved
state: restarted
daemon-reload: yes
- lineinfile:
path: /etc/hosts
line: {server_ip} server.{domain} server
Expand Down Expand Up @@ -307,13 +313,19 @@ def getLevelName(level):
hosts: ipaclients
become: yes
tasks:
- lineinfile:
path: /etc/resolv.conf
regexp: ".*"
state: absent
- lineinfile:
path: /etc/resolv.conf
line: nameserver {server_ip}
- file:
path: /etc/systemd/resolved.conf.d
state: directory
- copy:
dest: /etc/systemd/resolved.conf.d/dns.conf
content: |
[Resolve]
DNS={server_ip}
Domains=~.
- systemd:
name: systemd-resolved
state: restarted
daemon-reload: yes
- lineinfile:
path: /etc/hosts
line: {server_ip} server.{domain} server
Expand Down

0 comments on commit 7a6df2a

Please sign in to comment.