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 Aug 27, 2022
1 parent 68b224a commit 21f1c7d
Showing 1 changed file with 46 additions and 3 deletions.
49 changes: 46 additions & 3 deletions src/ipaperftest/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,19 @@ def getLevelName(level):
- lineinfile:
path: /etc/hosts
line: '{server_ip} server.{domain} server'
- 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
regexp: '127.*.*.*\\s*replica*'
Expand All @@ -271,6 +281,19 @@ def getLevelName(level):
hosts: ipaclients
become: yes
tasks:
- 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/resolv.conf
regexp: ".*"
Expand Down Expand Up @@ -307,6 +330,19 @@ def getLevelName(level):
hosts: ipaclients
become: yes
tasks:
- 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/resolv.conf
regexp: ".*"
Expand Down Expand Up @@ -406,6 +442,13 @@ def getLevelName(level):
name: systemd-resolved
state: restarted
daemon-reload: yes
- lineinfile:
path: /etc/resolv.conf
regexp: ".*"
state: absent
- lineinfile:
path: /etc/resolv.conf
line: nameserver {server_ip}
- lineinfile:
path: /etc/hosts
line: {server_ip} server.{domain} server
Expand Down

0 comments on commit 21f1c7d

Please sign in to comment.