diff --git a/README-dnsrecord.md b/README-dnsrecord.md
index 6f88f4322cebfbc893b75dde71b31c8c959e1c71..35c3614c2d6470c40255dfddd0f30bb758023b18 100644
--- a/README-dnsrecord.md
+++ b/README-dnsrecord.md
@@ -249,6 +249,7 @@ Variable | Description | Required
 -------- | ----------- | --------
 `ipaadmin_principal` | The admin principal is a string and defaults to `admin` | no
 `ipaadmin_password` | The admin password is a string and is required if there is no admin ticket available on the node | no
+`ipaapi_context` | The context in which the module will execute. Executing in a server context is preferred. If not provided context will be determined by the execution environment. Valid values are `server` and `client`. | no
 `zone_name` \| `dnszone` | The DNS zone name to which DNS record needs to be managed. You can use one global zone name for multiple records. | no
   required: true
 `records` | The list of dns records dicts. Each `records` dict entry can contain **record variables**. | no
diff --git a/tests/dnsrecord/env_cleanup.yml b/tests/dnsrecord/env_cleanup.yml
index c5890fa0ba33db6a6ed280e366f9bf09c01d8564..b74aca35090bc07ddf5b0b0ae7b91a3f3f556554 100644
--- a/tests/dnsrecord/env_cleanup.yml
+++ b/tests/dnsrecord/env_cleanup.yml
@@ -1,135 +1,144 @@
 ---
   # Cleanup tasks.
-   - name: Ensure that dns records are absent
-     ipadnsrecord:
-       ipaadmin_password: SomeADMINpassword
-       zone_name: "{{ testzone }}"
-       del_all: yes
-       name:
-       - host01
-       - host02
-       - host03
-       - host04
-       - _ftp._tcp
-       - _sip._udp
-       state: absent
+  - name: Ensure that dns records are absent
+    ipadnsrecord:
+      ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
+      zone_name: "{{ testzone }}"
+      del_all: yes
+      name:
+      - host01
+      - host02
+      - host03
+      - host04
+      - _ftp._tcp
+      - _sip._udp
+      state: absent
 
-   - name: Ensure that dns reverse ipv6 records are absent
-     ipadnsrecord:
-       ipaadmin_password: SomeADMINpassword
-       zone_name: ip6.arpa.
-       del_all: yes
-       name:
-       - 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.f
-       - 1.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.f
-       - 1.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.f
-       - 4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.f
-       - 4.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.f
-       - 4.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.f
-       state: absent
+  - name: Ensure that dns reverse ipv6 records are absent
+    ipadnsrecord:
+      ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
+      zone_name: ip6.arpa.
+      del_all: yes
+      name:
+      - 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.f
+      - 1.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.f
+      - 1.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.f
+      - 4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.f
+      - 4.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.f
+      - 4.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.f
+      state: absent
 
-   - name: Ensure that dns reverse ipv6 records are absent (workaround)
-     ipadnsrecord:
-       ipaadmin_password: SomeADMINpassword
-       zone_name: "{{ zone_ipv6_reverse_workaround }}"
-       del_all: yes
-       name:
-       - 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
-       - 1.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
-       - 1.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
-       - 4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
-       - 4.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
-       - 4.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
-       state: absent
+  - name: Ensure that dns reverse ipv6 records are absent (workaround)
+    ipadnsrecord:
+      ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
+      zone_name: "{{ zone_ipv6_reverse_workaround }}"
+      del_all: yes
+      name:
+      - 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
+      - 1.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
+      - 1.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
+      - 4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
+      - 4.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
+      - 4.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0
+      state: absent
 
-   - name: Ensure that dns reverse records are absent
-     ipadnsrecord:
-       ipaadmin_password: SomeADMINpassword
-       zone_name: "{{ zone_prefix_reverse_24 }}"
-       name:
-       - "101"
-       - "102"
-       - "103"
-       - "104"
-       - "111"
-       - "112"
-       - "113"
-       - "114"
-       - "121"
-       - "122"
-       - "123"
-       - "124"
-       del_all: yes
-       state: absent
+  - name: Ensure that dns reverse records are absent
+    ipadnsrecord:
+      ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
+      zone_name: "{{ zone_prefix_reverse_24 }}"
+      name:
+      - "101"
+      - "102"
+      - "103"
+      - "104"
+      - "111"
+      - "112"
+      - "113"
+      - "114"
+      - "121"
+      - "122"
+      - "123"
+      - "124"
+      del_all: yes
+      state: absent
 
-   - name: Ensure that dns reverse records are absent (workaround 1)
-     ipadnsrecord:
-       ipaadmin_password: SomeADMINpassword
-       zone_name: "{{ zone_prefix_reverse_16 }}"
-       name:
-       - "101.122"
-       - "102.122"
-       - "103.122"
-       - "104.122"
-       - "111.122"
-       - "112.122"
-       - "113.122"
-       - "114.122"
-       - "121.122"
-       - "122.122"
-       - "123.122"
-       - "124.122"
-       del_all: yes
-       state: absent
+  - name: Ensure that dns reverse records are absent (workaround 1)
+    ipadnsrecord:
+      ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
+      zone_name: "{{ zone_prefix_reverse_16 }}"
+      name:
+      - "101.122"
+      - "102.122"
+      - "103.122"
+      - "104.122"
+      - "111.122"
+      - "112.122"
+      - "113.122"
+      - "114.122"
+      - "121.122"
+      - "122.122"
+      - "123.122"
+      - "124.122"
+      del_all: yes
+      state: absent
 
-   - name: Ensure that dns reverse records are absent (workaround 2)
-     ipadnsrecord:
-       ipaadmin_password: SomeADMINpassword
-       zone_name: "{{ zone_prefix_reverse_8 }}"
-       name:
-       - "168.101.122"
-       - "168.102.122"
-       - "168.103.122"
-       - "168.104.122"
-       - "168.111.122"
-       - "168.112.122"
-       - "168.113.122"
-       - "168.114.122"
-       - "168.121.122"
-       - "168.122.122"
-       - "168.123.122"
-       - "168.124.122"
-       del_all: yes
-       state: absent
+  - name: Ensure that dns reverse records are absent (workaround 2)
+    ipadnsrecord:
+      ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
+      zone_name: "{{ zone_prefix_reverse_8 }}"
+      name:
+      - "168.101.122"
+      - "168.102.122"
+      - "168.103.122"
+      - "168.104.122"
+      - "168.111.122"
+      - "168.112.122"
+      - "168.113.122"
+      - "168.114.122"
+      - "168.121.122"
+      - "168.122.122"
+      - "168.123.122"
+      - "168.124.122"
+      del_all: yes
+      state: absent
 
-   - name: Ensure that "{{ safezone }}" dns records are absent
-     ipadnsrecord:
-       ipaadmin_password: SomeADMINpassword
-       zone_name: "{{ safezone }}"
-       records:
-       - name: iron01
-         del_all: yes
-       state: absent
+  - name: Ensure that "{{ safezone }}" dns records are absent
+    ipadnsrecord:
+      ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
+      zone_name: "{{ safezone }}"
+      records:
+      - name: iron01
+        del_all: yes
+      state: absent
 
-   - name: Ensure that NS record for "{{ safezone }}" is absent
-     ipadnsrecord:
-       ipaadmin_password: SomeADMINpassword
-       name: iron01
-       zone_name: "{{ safezone }}"
-       ns_rec: iron01
-       state: absent
+  - name: Ensure that NS record for "{{ safezone }}" is absent
+    ipadnsrecord:
+      ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
+      name: iron01
+      zone_name: "{{ safezone }}"
+      ns_rec: iron01
+      state: absent
 
-   - name: Ensure DNS testing zones are absent.
-     ipadnszone:
-       ipaadmin_password: SomeADMINpassword
-       name: "{{ item }}"
-       state: absent
-     with_items:
-       - "{{ zone_prefix_reverse }}"
-       - "{{ zone_prefix_reverse_24 }}"
-       - "{{ zone_prefix_reverse_16 }}"
-       - "{{ zone_prefix_reverse_8 }}"
-       - "{{ zone_ipv6_reverse }}"
-       - "{{ zone_ipv6_reverse_workaround }}"
-       - "{{ testzone }}"
-       - "{{ safezone }}"
+  - name: Ensure DNS testing zones are absent.
+    ipadnszone:
+      ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
+      name: "{{ item }}"
+      state: absent
+    with_items:
+      - "{{ zone_prefix_reverse }}"
+      - "{{ zone_prefix_reverse_24 }}"
+      - "{{ zone_prefix_reverse_16 }}"
+      - "{{ zone_prefix_reverse_8 }}"
+      - "{{ zone_ipv6_reverse }}"
+      - "{{ zone_ipv6_reverse_workaround }}"
+      - "{{ testzone }}"
+      - "{{ safezone }}"
diff --git a/tests/dnsrecord/env_setup.yml b/tests/dnsrecord/env_setup.yml
index ebdb7570fd08081b977c8ea1da3fa1fb901e1304..0c2cfdfffcefd7dadb5624106ad1725d42f4db96 100644
--- a/tests/dnsrecord/env_setup.yml
+++ b/tests/dnsrecord/env_setup.yml
@@ -10,6 +10,7 @@
   - name: Ensure DNS testing zones are present.
     ipadnszone:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       name: "{{ item }}"
       skip_nameserver_check: yes
       skip_overlap_check: yes
@@ -25,6 +26,7 @@
   - name: Ensure DNSSEC zone '"{{ safezone }}"' is present.
     ipadnszone:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       name: "{{ safezone }}"
       dnssec: yes
       skip_nameserver_check: yes
diff --git a/tests/dnsrecord/test_dnsrecord.yml b/tests/dnsrecord/test_dnsrecord.yml
index 5b5d48a9cb45e5cf0d8e5f2b57dcb15e6bbe5177..176e5492516834a16718e1c0e9a78d2d6ed66b60 100644
--- a/tests/dnsrecord/test_dnsrecord.yml
+++ b/tests/dnsrecord/test_dnsrecord.yml
@@ -1,6 +1,6 @@
 ---
 - name: Test dnsrecord
-  hosts: ipaserver
+  hosts: "{{ ipa_test_host | default('ipaserver') }}"
   become: yes
   gather_facts: yes
 
@@ -23,6 +23,7 @@
   - name: Ensure that dns record 'host01' is present
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       name: host01
       zone_name: "{{ testzone }}"
       record_type: AAAA
@@ -33,6 +34,7 @@
   - name: Ensure that dns record 'host01' is present, again
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       name: host01
       zone_name: "{{ testzone }}"
       record_type: AAAA
@@ -43,6 +45,7 @@
   - name: Ensure that dns record 'host02' is present
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       name: host02
       zone_name: "{{ testzone }}"
       record_type: A
@@ -53,6 +56,7 @@
   - name: Ensure that dns record 'host02' is present, again
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       name: host02
       zone_name: "{{ testzone }}"
       record_type: A
@@ -63,6 +67,7 @@
   - name: Modify record 'host02' with multiple A and AAAA record.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       records:
         - name: host02
           zone_name: "{{ testzone }}"
@@ -80,6 +85,7 @@
   - name: Modify record 'host02' with multiple A and AAAA record, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       records:
         - name: host02
           zone_name: "{{ testzone }}"
@@ -97,6 +103,7 @@
   - name: Ensure 'host02' A6 record is present.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host02
       a6_data: ::1
@@ -106,6 +113,7 @@
   - name: Ensure 'host02' A6 record is present, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host02
       a6_rec: ::1
@@ -115,6 +123,7 @@
   - name: Ensure 'host02' A6 record is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host02
       a6_rec: ::1
@@ -125,6 +134,7 @@
   - name: Ensure 'host02' A6 record is absent, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host02
       a6_rec: ::1
@@ -135,6 +145,7 @@
   - name: Ensure that dns record 'host03' is present, with reverse record.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       name: host03
       zone_name: "{{ testzone }}"
       a_ip_address: "{{ ipv4_prefix }}.103"
@@ -145,6 +156,7 @@
   - name: Ensure that dns record 'host03' is present, with reverse record, again
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       name: host03
       zone_name: "{{ testzone }}"
       record_type: A
@@ -156,6 +168,7 @@
   - name: Delete all entries associated with host03
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host03
       del_all: yes
@@ -166,6 +179,7 @@
   - name: Delete all entries associated with host03, again
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host03
       del_all: yes
@@ -176,6 +190,7 @@
   - name: Ensure that 'host04' has CNAME
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       record_type: CNAME
@@ -186,6 +201,7 @@
   - name: Ensure that 'host04' has CNAME, again
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       cname_hostname: "host04.{{ testzone }}"
@@ -195,6 +211,7 @@
   - name: Ensure that 'host04' CNAME is absent
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       cname_rec: "host04.{{ testzone }}"
@@ -205,6 +222,7 @@
   - name: Ensure that 'host04' CNAME is absent, again
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       record_type: CNAME
@@ -216,6 +234,7 @@
   - name: Ensure that 'host04' and 'host03' have CNAME, with cname_hostname
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       records:
         - name: host04
@@ -228,6 +247,7 @@
   - name: Ensure that 'host04' has CNAME, with cname_hostname, again
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       cname_hostname: "host04.{{ testzone }}"
@@ -237,6 +257,7 @@
   - name: Ensure that 'host04' CNAME is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       cname_rec: "host04.{{ testzone }}"
@@ -247,6 +268,7 @@
   - name: Ensure that 'host04' has A record.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       ip_address: "{{ ipv4_prefix }}.104"
@@ -256,6 +278,7 @@
   - name: Ensure that 'host04' has A record, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       ip_address: "{{ ipv4_prefix }}.104"
@@ -265,6 +288,7 @@
   - name: Ensure that 'host04' has the same A record with reverse.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       a_rec: "{{ ipv4_prefix }}.104"
@@ -275,6 +299,7 @@
   - name: Ensure that 'host04' has the same A record with reverse, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       a_rec: "{{ ipv4_prefix }}.104"
@@ -285,6 +310,7 @@
   - name: Ensure that 'host04' has another A record with reverse.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       ip_address: "{{ ipv4_prefix }}.114"
@@ -294,6 +320,7 @@
   - name: Ensure that 'host04' has another A record with reverse, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       ip_address: "{{ ipv4_prefix }}.114"
@@ -304,6 +331,7 @@
   - name: Ensure that 'host04' has AAAA record.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       aaaa_ip_address: fd00::0004
@@ -314,6 +342,7 @@
   - name: Ensure that 'host04' has AAAA record, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       ip_address: fd00::0004
@@ -324,6 +353,7 @@
   - name: Ensure that 'host04' has AAAA record, without reverse.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       ip_address: fd00::0014
@@ -333,6 +363,7 @@
   - name: Ensure that 'host04' previous AAAA record, now has a reverse record.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       aaaa_rec: fd00::0014
@@ -343,6 +374,7 @@
   - name: Ensure that 'host04' previous AAAA record, now has a reverse record, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       aaaa_rec: fd00::0014
@@ -353,6 +385,7 @@
   - name: Ensure that 'host04' has PTR record.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ zone_prefix_reverse_24 }}"
       name: "124"
       ptr_hostname: "host04.{{ testzone }}"
@@ -362,6 +395,7 @@
   - name: Ensure that 'host04' has PTR record, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ zone_prefix_reverse_24 }}"
       name: "124"
       ptr_hostname: "host04.{{ testzone }}"
@@ -371,6 +405,7 @@
   - name: Ensure that 'host04' has PTR record is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ zone_prefix_reverse_24 }}"
       name: "124"
       ptr_rec: "host04.{{ testzone }}"
@@ -381,6 +416,7 @@
   - name: Ensure that 'host04' has PTR record is absent, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ zone_prefix_reverse_24 }}"
       name: "124"
       ptr_rec: "host04.{{ testzone }}"
@@ -391,6 +427,7 @@
   - name: Ensure that 'host04' has DNAME record.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       dname_target: "ipa.{{ testzone }}"
@@ -400,6 +437,7 @@
   - name: Ensure that 'host04' has DNAME record, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       dname_target: "ipa.{{ testzone }}"
@@ -409,6 +447,7 @@
   - name: Ensure that 'host04' DNAME record is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       dname_rec: "ipa.{{ testzone }}"
@@ -419,6 +458,7 @@
   - name: Ensure that 'host04' DNAME record is absent, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       dname_rec: "ipa.{{ testzone }}"
@@ -431,6 +471,7 @@
   - name: Ensure that 'host04' has a A record with reverse, for NS record.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       ip_address: "{{ ipv4_prefix }}.114"
@@ -441,6 +482,7 @@
   - name: Ensure that 'host04' has NS record.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       ns_hostname: host04
@@ -450,6 +492,7 @@
   - name: Ensure that 'host04' has NS record, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       ns_hostname: host04
@@ -461,6 +504,7 @@
   - name: Ensure that 'host04' NS record is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       ns_rec: host04
@@ -471,6 +515,7 @@
   - name: Ensure that 'host04' NS record is absent, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       ns_rec: host04
@@ -481,6 +526,7 @@
   - name: Ensure that 'host04' DLV record is present.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       dlv_key_tag: 12345
@@ -494,6 +540,7 @@
   - name: Ensure that 'host04' DLV record is present, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       dlv_key_tag: 12345
@@ -506,6 +553,7 @@
   - name: Ensure that 'host04' DLV record is present, with a different key tag.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       dlv_key_tag: 4321
@@ -516,6 +564,7 @@
   - name: Ensure that 'host04' DLV second record is present.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       dlv_key_tag: 4321
@@ -529,6 +578,7 @@
   - name: Ensure that 'host04' DLV record is changed, in presence of multiple records.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       dlv_key_tag: 54321
@@ -539,6 +589,7 @@
   - name: Ensure that 'host04' DLV record is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       dlv_record: 54321 3 1 08ff468cb25ccd21642989294cc33570da5eb2ba
@@ -549,6 +600,7 @@
   - name: Ensure that 'host04' DLV record is absent, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       dlv_record: 54321 3 1 08ff468cb25ccd21642989294cc33570da5eb2ba
@@ -559,6 +611,7 @@
   - name: Ensure that 'host04' DLV record is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       dlv_record: 4321 2 2 da39a3ee5e6b4b0d3255bfef95601890afd80709
@@ -569,6 +622,7 @@
   - name: Ensure that dns record 'iron01' is present
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       name: iron01
       zone_name: "{{ safezone }}"
       ip_address: "{{ ansible_facts['default_ipv4'].address }}"
@@ -578,6 +632,7 @@
   - name: Ensure that NS record for "{{ safezone }}" is present
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       name: iron01
       zone_name: "{{ safezone }}"
       ns_hostname: iron01
@@ -587,6 +642,7 @@
   - name: Ensure that 'iron01' DS record is present.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ safezone }}"
       name: iron01
       ds_key_tag: 12345
@@ -600,6 +656,7 @@
   - name: Ensure that 'iron01' DS record is present, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ safezone }}"
       name: iron01
       ds_key_tag: 12345
@@ -612,6 +669,7 @@
   - name: Ensure that 'iron01' DS record is present, with a different key tag.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ safezone }}"
       name: iron01
       ds_key_tag: 54321
@@ -622,6 +680,7 @@
   - name: Ensure that 'iron01' DS record is present, with a different key tag, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ safezone }}"
       name: iron01
       ds_key_tag: 54321
@@ -632,6 +691,7 @@
   - name: Ensure that 'iron01' DS record is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ safezone }}"
       name: iron01
       ds_rec: 54321 3 1 84763786e4213cca9a6938dba5dacd64f87ec216
@@ -642,6 +702,7 @@
   - name: Ensure that 'iron01' DS record is absent, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ safezone }}"
       name: iron01
       ds_rec: 54321 3 1 84763786e4213cca9a6938dba5dacd64f87ec216
@@ -652,6 +713,7 @@
   - name: Ensure that 'host04' AFSDB record is present.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       afsdb_subtype: 1
@@ -662,6 +724,7 @@
   - name: Ensure that 'host04' AFSDB record is present, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       afsdb_subtype: 1
@@ -672,6 +735,7 @@
   - name: Ensure that 'host04' AFSDB record subtype is 2.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       afsdb_subtype: 2
@@ -682,6 +746,7 @@
   - name: Ensure that 'host04' AFSDB record subtype is 2, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       afsdb_subtype: 2
@@ -692,6 +757,7 @@
   - name: Ensure that 'host04' AFSDB record is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       afsdb_rec: "2 host04.{{ testzone }}"
@@ -702,6 +768,7 @@
   - name: Ensure that 'host04' AFSDB record is absent, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       afsdb_rec: "2 host04.{{ testzone }}"
@@ -712,6 +779,7 @@
   - name: Ensure that 'host04' CERT record is present.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       cert_type: 1
@@ -724,6 +792,7 @@
   - name: Ensure that 'host04' CERT record is present, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       cert_type: 1
@@ -736,6 +805,7 @@
   - name: Ensure that 'host04' CERT record is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       cert_rec: "1 1234 3 {{ lookup('file', 'cert1.b64') }}"
@@ -746,6 +816,7 @@
   - name: Ensure that 'host04' CERT record is absent, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       cert_rec: 1 1234 3 "{{ lookup('file', 'cert1.b64') }}"
@@ -756,6 +827,7 @@
   - name: Ensure that 'host04' KX record is present.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       kx_preference: 10
@@ -766,6 +838,7 @@
   - name: Ensure that 'host04' KX record is present, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       kx_preference: 10
@@ -776,6 +849,7 @@
   - name: Ensure that 'host04' KX record is present with preference set to 20.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       kx_preference: 20
@@ -786,6 +860,7 @@
   - name: Ensure that 'host04' KX record is present with preference set to 20, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       kx_preference: 20
@@ -796,6 +871,7 @@
   - name: Ensure that 'host04' KX record is present with preference set to 20, one more time.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       kx_preference: 20
@@ -806,6 +882,7 @@
   - name: Ensure that 'host04' KX record is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       kx_rec: "20 keyex.{{ testzone }}"
@@ -816,6 +893,7 @@
   - name: Ensure that 'host04' KX record is absent, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       kx_rec: "20 keyex.{{ testzone }}"
@@ -826,6 +904,7 @@
   - name: Ensure that 'host04' MX record is present.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       mx_preference: 10
@@ -836,6 +915,7 @@
   - name: Ensure that 'host04' MX record is present, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       mx_preference: 10
@@ -846,6 +926,7 @@
   - name: Ensure that 'host04' MX record is present with preference set to 20.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       mx_preference: 20
@@ -856,6 +937,7 @@
   - name: Ensure that 'host04' MX record is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       mx_rec: "20 mail.{{ testzone }}"
@@ -866,6 +948,7 @@
   - name: Ensure that 'host04' MX record is absent, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       mx_rec: "20 mail.{{ testzone }}"
@@ -876,6 +959,7 @@
   - name: Ensure that 'host04' LOC record is present.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       loc_lat_deg: 52
@@ -896,6 +980,7 @@
   - name: Ensure that 'host04' LOC record is present, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       loc_lat_deg: 52
@@ -916,6 +1001,7 @@
   - name: Ensure that 'host04' LOC record is present, with loc_size 1.00.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       loc_size: 1.00
@@ -926,6 +1012,7 @@
   - name: Ensure that 'host04' LOC record is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       loc_rec: 52 22 23.000 N 4 53 32.000 E -2.00 1.00 10000.00 10.00
@@ -936,6 +1023,7 @@
   - name: Ensure that 'host04' LOC record is absent, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       loc_rec: 52 22 23.000 N 4 53 32.000 E -2.00 1.00 10000.00 10.00
@@ -946,6 +1034,7 @@
   - name: Ensure that '_sip._udp' service has NAPTR record.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _sip._udp
       naptr_order: 100
@@ -960,6 +1049,7 @@
   - name: Ensure that '_sip._udp' service has NAPTR record, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _sip._udp
       naptr_order: 100
@@ -974,6 +1064,7 @@
   - name: Change '_sip._udp' service NAPTR record `preference` to 20.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _sip._udp
       naptr_preference: 20
@@ -984,6 +1075,7 @@
   - name: Ensure that '_sip._udp' service has NAPTR record.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _sip._udp
       naptr_order: 101
@@ -996,6 +1088,7 @@
   - name: Ensure that '_sip._udp' service has NAPTR record.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _sip._udp
       naptr_order: 102
@@ -1008,6 +1101,7 @@
   - name: Change '_sip._udp' service NAPTR record `preference` to 50, when multiple records are present. (BZ 1881436)
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _sip._udp
       naptr_preference: 50
@@ -1018,6 +1112,7 @@
   - name: Ensure that '_sip._udp' service has NAPTR record is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _sip._udp
       record_type: NAPTR
@@ -1029,6 +1124,7 @@
   - name: Ensure that '_sip._udp' service has NAPTR record is absent, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _sip._udp
       record_type: NAPTR
@@ -1040,6 +1136,7 @@
   - name: Clear NAPTR records.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _sip._udp
       del_all: yes
@@ -1049,6 +1146,7 @@
   - name: Ensure that '_sip._udp' service has SRV record.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _sip._udp
       srv_priority: 10
@@ -1061,6 +1159,7 @@
   - name: Ensure that '_sip._udp' service has SRV record, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _sip._udp
       srv_priority: 10
@@ -1073,6 +1172,7 @@
   - name: Ensure '_sip._udp' SRV record has priority equals to 4.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _sip._udp
       srv_priority: 4
@@ -1086,6 +1186,7 @@
   - name: Ensure '_sip._udp' SRV record has priority equals to 4, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _sip._udp
       srv_priority: 4
@@ -1099,6 +1200,7 @@
   - name: Ensurer '_sip._udp' SRV record has priority 2, weight 20
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _sip._udp
       srv_priority: 2
@@ -1111,6 +1213,7 @@
   - name: Ensurer '_sip._udp' SRV record has priority 2, weight 20, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _sip._udp
       srv_priority: 2
@@ -1123,6 +1226,7 @@
   - name: Ensure that '_sip._udp' SRV record is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _sip._udp
       srv_record: "2 20 5060 sip-server.{{ testzone }}"
@@ -1133,6 +1237,7 @@
   - name: Ensure that '_sip._udp' SRV record is absent, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _sip._udp
       srv_record: "2 20 5060 sip-server.{{ testzone }}"
@@ -1144,6 +1249,7 @@
   - name: Ensure that 'host04' has SSHFP record.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       sshfp_algorithm: 1
@@ -1155,6 +1261,7 @@
   - name: Ensure that 'host04' has SSHFP record, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       sshfp_algorithm: 1
@@ -1166,6 +1273,7 @@
   - name: Ensure that 'host04' SSHFP record is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       sshfp_rec: 1 1 d21802c61733e055b8d16296cbce300efb8a167a
@@ -1176,6 +1284,7 @@
   - name: Ensure that 'host04' SSHFP record is absent, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       sshfp_rec: 1 1 d21802c61733e055b8d16296cbce300efb8a167a
@@ -1188,6 +1297,7 @@
   - name: Ensure that 'host04' has TLSA record present.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       tlsa_cert_usage: 3
@@ -1200,6 +1310,7 @@
   - name: Ensure that 'host04' has TLSA record present, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       tlsa_cert_usage: 3
@@ -1212,6 +1323,7 @@
   - name: Modify 'host04' has TLSA record.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       tlsa_matching_type: 0
@@ -1222,6 +1334,7 @@
   - name: Modify 'host04' has TLSA record, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       tlsa_matching_type: 0
@@ -1232,6 +1345,7 @@
   - name: Ensure that 'host04' TLSA record is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       tlsa_rec: 3 1 0 9c0ad776dbeae8d9d55b0ad42899d30235c114d5f918fd69746e4279e47bdaa2
@@ -1242,6 +1356,7 @@
   - name: Ensure that 'host04' TLSA record is absent, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       tlsa_rec: 3 1 0 9c0ad776dbeae8d9d55b0ad42899d30235c114d5f918fd69746e4279e47bdaa2
@@ -1252,6 +1367,7 @@
   - name: Ensure that 'host04' has TXT record present.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       txt_data: Some Text
@@ -1261,6 +1377,7 @@
   # - name: Ensure that 'host04' has TXT record present, again.
   #   ipadnsrecord:
   #     ipaadmin_password: SomeADMINpassword
+  #     ipaapi_context: "{{ ipa_context | default(omit) }}"
   #     zone_name: "{{ testzone }}"
   #     name: host04
   #     txt_data: Some Text
@@ -1270,6 +1387,7 @@
   - name: Change value of  'host04' TXT record.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       txt_data: Some new Text
@@ -1280,6 +1398,7 @@
   - name: Add a second TXT record to 'host04'.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       txt_rec: Some Other Text
@@ -1289,6 +1408,7 @@
   - name: Add a second TXT record to 'host04', again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       txt_rec: Some Other Text
@@ -1298,6 +1418,7 @@
   - name: Ensure that one of 'host04' TXT record is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       txt_rec: Some new Text
@@ -1308,6 +1429,7 @@
   - name: Ensure that one of 'host04' TXT record is absent, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       txt_rec: Some new Text
@@ -1318,6 +1440,7 @@
   - name: Ensure that 'host04' TXT record are all absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       txt_rec:
@@ -1330,6 +1453,7 @@
   - name: Ensure that 'host04' TXT record are all absent, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: host04
       txt_rec:
@@ -1342,6 +1466,7 @@
   - name: Ensure that '_ftp._tcp' has URI record.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _ftp._tcp
       uri_priority: 10
@@ -1353,6 +1478,7 @@
   - name: Ensure that '_ftp._tcp' has URI record, again
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _ftp._tcp
       uri_priority: 10
@@ -1364,6 +1490,7 @@
   - name: Change '_ftp._tcp' URI record weight to 3 and priority to 5.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _ftp._tcp
       uri_priority: 5
@@ -1375,6 +1502,7 @@
   - name: Verify if modification worked.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _ftp._tcp
       uri_rec: 10 1 ftp://ftp.host04.{{ testzone }}/public
@@ -1386,6 +1514,7 @@
   - name: Change '_ftp._tcp' URI record weight to 3 and priority to 5, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _ftp._tcp
       uri_priority: 5
@@ -1397,6 +1526,7 @@
   - name: Ensure that '_ftp._tcp' URI record is absent.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _ftp._tcp
       uri_rec: 5 3 "ftp://ftp.host04.{{ testzone }}/public"
@@ -1407,6 +1537,7 @@
   - name: Ensure that '_ftp._tcp' URI record is absent, again.
     ipadnsrecord:
       ipaadmin_password: SomeADMINpassword
+      ipaapi_context: "{{ ipa_context | default(omit) }}"
       zone_name: "{{ testzone }}"
       name: _ftp._tcp
       uri_rec: 5 3 "ftp://ftp.host04.{{ testzone }}/public"
diff --git a/tests/dnsrecord/test_dnsrecord_client_context.yml b/tests/dnsrecord/test_dnsrecord_client_context.yml
new file mode 100644
index 0000000000000000000000000000000000000000..46378492d332adcd81701b0d41e8aed640c5b601
--- /dev/null
+++ b/tests/dnsrecord/test_dnsrecord_client_context.yml
@@ -0,0 +1,37 @@
+---
+- name: Test dnsrecord
+  hosts: ipaclients, ipaserver
+  become: no
+  gather_facts: no
+
+  tasks:
+  - name: Include FreeIPA facts.
+    include_tasks: ../env_freeipa_facts.yml
+
+  # Test will only be executed if host is not a server.
+  - name: Execute with server context in the client.
+    ipadnsrecord:
+      ipaadmin_password: SomeADMINpassword
+      ipaapi_context: server
+      name: ThisShouldNotWork
+    register: result
+    failed_when: not (result.failed and result.msg is regex("No module named '*ipaserver'*"))
+    when: ipa_host_is_client
+
+# Import basic module tests, and execute with ipa_context set to 'client'.
+# If ipaclients is set, it will be executed using the client, if not,
+# ipaserver will be used.
+#
+# With this setup, tests can be executed against an IPA client, against
+# an IPA server using "client" context, and ensure that tests are executed
+# in upstream CI.
+
+- name: Test dnsrecord using client context, in client host.
+  import_playbook: test_dnsrecord.yml
+  when: groups['ipaclients']
+  vars:
+    ipa_test_host: ipaclients
+
+- name: Test dnsrecord using client context, in server host.
+  import_playbook: test_dnsrecord.yml
+  when: groups['ipaclients'] is not defined or not groups['ipaclients']