From 7a6036f7cf322bf692f5588eaa0569895b477bb1 Mon Sep 17 00:00:00 2001
From: Sergio Oliveira Campos <seocam@seocam.com>
Date: Fri, 24 Jul 2020 11:09:23 -0300
Subject: [PATCH] Replaced groups.ipaserver[0] by ansible_fqdn.

Since we are using docker for running the tests we can no longer rely on
groups.ipaserver[0] as the managed host hostname.
---
 tests/ca-less/clean_up_certificates.yml        |  2 +-
 ...er-with-external-ca-with-automatic-copy.yml |  1 -
 ...erver-with-external-ca-with-manual-copy.yml |  1 -
 tests/hbacrule/test_hbacrule.yml               |  2 +-
 .../host/certificate/test_host_certificate.yml |  3 +--
 .../certificate/test_hosts_certificate.yml     |  3 +--
 tests/host/test_host.yml                       |  2 +-
 tests/host/test_host_allow_create_keytab.yml   |  4 ++--
 tests/host/test_host_allow_retrieve_keytab.yml |  4 ++--
 tests/host/test_host_bool_params.yml           |  2 +-
 tests/host/test_host_ipaddresses.yml           |  2 +-
 tests/host/test_host_managedby_host.yml        | 18 +++++++++---------
 tests/host/test_host_principal.yml             |  4 ++--
 tests/host/test_host_random.yml                |  8 ++++----
 tests/host/test_host_reverse.yml               |  3 +--
 tests/host/test_hosts.yml                      |  3 +--
 tests/host/test_hosts_managedby_host.yml       |  2 +-
 tests/host/test_hosts_principal.yml            |  4 ++--
 tests/hostgroup/test_hostgroup.yml             |  4 ++--
 .../certificate/test_service_certificate.yml   |  2 +-
 tests/service/test_service.yml                 |  2 +-
 .../test_service_without_skip_host_check.yml   |  2 +-
 tests/sudorule/test_sudorule.yml               | 13 ++++++-------
 tests/sudorule/test_sudorule_categories.yml    |  2 +-
 tests/vault/tasks_vault_members.yml            | 16 ++++++++--------
 25 files changed, 51 insertions(+), 58 deletions(-)

diff --git a/tests/ca-less/clean_up_certificates.yml b/tests/ca-less/clean_up_certificates.yml
index ea8a4e8e..23c025b3 100644
--- a/tests/ca-less/clean_up_certificates.yml
+++ b/tests/ca-less/clean_up_certificates.yml
@@ -12,4 +12,4 @@
       chdir: "{{ playbook_dir }}"
     with_items:
       - "{{ groups.ipaserver[0] }}"
-      - "{{ groups.ipareplicas[0] }}"
\ No newline at end of file
+      - "{{ groups.ipareplicas[0] }}"
diff --git a/tests/external-signed-ca-with-automatic-copy/install-server-with-external-ca-with-automatic-copy.yml b/tests/external-signed-ca-with-automatic-copy/install-server-with-external-ca-with-automatic-copy.yml
index e856fb40..02e20d95 100644
--- a/tests/external-signed-ca-with-automatic-copy/install-server-with-external-ca-with-automatic-copy.yml
+++ b/tests/external-signed-ca-with-automatic-copy/install-server-with-external-ca-with-automatic-copy.yml
@@ -12,7 +12,6 @@
 
 - name: Create CA, get /root/ipa.csr signed by your CA, ..
   hosts: localhost
-  gather_facts: false
 
   tasks:
   - name: Run external-ca.sh
diff --git a/tests/external-signed-ca-with-manual-copy/install-server-with-external-ca-with-manual-copy.yml b/tests/external-signed-ca-with-manual-copy/install-server-with-external-ca-with-manual-copy.yml
index 33b466ca..19cea6b8 100644
--- a/tests/external-signed-ca-with-manual-copy/install-server-with-external-ca-with-manual-copy.yml
+++ b/tests/external-signed-ca-with-manual-copy/install-server-with-external-ca-with-manual-copy.yml
@@ -18,7 +18,6 @@
 
 - name: Get /root/ipa.csr, create CA, sign with our CA and copy to node
   hosts: localhost
-  gather_facts: false
 
   tasks:
   - name: Run external-ca.sh
diff --git a/tests/hbacrule/test_hbacrule.yml b/tests/hbacrule/test_hbacrule.yml
index 4d0c2030..ce1f29c5 100644
--- a/tests/hbacrule/test_hbacrule.yml
+++ b/tests/hbacrule/test_hbacrule.yml
@@ -6,7 +6,7 @@
   tasks:
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   # CLEANUP TEST ITEMS
diff --git a/tests/host/certificate/test_host_certificate.yml b/tests/host/certificate/test_host_certificate.yml
index 7607006f..aa50eb27 100644
--- a/tests/host/certificate/test_host_certificate.yml
+++ b/tests/host/certificate/test_host_certificate.yml
@@ -21,12 +21,11 @@
 - name: Test host certificates
   hosts: ipaserver
   become: true
-  gather_facts: false
 
   tasks:
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   - name: Host test absent
diff --git a/tests/host/certificate/test_hosts_certificate.yml b/tests/host/certificate/test_hosts_certificate.yml
index 853762c6..44c63ef0 100644
--- a/tests/host/certificate/test_hosts_certificate.yml
+++ b/tests/host/certificate/test_hosts_certificate.yml
@@ -21,12 +21,11 @@
 - name: Test host certificates
   hosts: ipaserver
   become: true
-  gather_facts: false
 
   tasks:
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   - name: Host test absent
diff --git a/tests/host/test_host.yml b/tests/host/test_host.yml
index efb0524a..d4760c18 100644
--- a/tests/host/test_host.yml
+++ b/tests/host/test_host.yml
@@ -6,7 +6,7 @@
   tasks:
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   - name: Set host1_fqdn .. host6_fqdn
diff --git a/tests/host/test_host_allow_create_keytab.yml b/tests/host/test_host_allow_create_keytab.yml
index b9ad0a19..4be1305e 100644
--- a/tests/host/test_host_allow_create_keytab.yml
+++ b/tests/host/test_host_allow_create_keytab.yml
@@ -6,12 +6,12 @@
   tasks:
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   - name: Get Realm from server name
     set_fact:
-      ipaserver_realm: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') | upper }}"
+      ipaserver_realm: "{{ ansible_fqdn.split('.')[1:] | join ('.') | upper }}"
     when: ipaserver_realm is not defined
 
   - name: Set host1_fqdn .. host3_fqdn
diff --git a/tests/host/test_host_allow_retrieve_keytab.yml b/tests/host/test_host_allow_retrieve_keytab.yml
index 8f955407..9be0ef61 100644
--- a/tests/host/test_host_allow_retrieve_keytab.yml
+++ b/tests/host/test_host_allow_retrieve_keytab.yml
@@ -6,12 +6,12 @@
   tasks:
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   - name: Get Realm from server name
     set_fact:
-      ipaserver_realm: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') | upper }}"
+      ipaserver_realm: "{{ ansible_fqdn.split('.')[1:] | join ('.') | upper }}"
     when: ipaserver_realm is not defined
 
   - name: Set host1_fqdn .. host3_fqdn
diff --git a/tests/host/test_host_bool_params.yml b/tests/host/test_host_bool_params.yml
index efded1f1..bc35f97e 100644
--- a/tests/host/test_host_bool_params.yml
+++ b/tests/host/test_host_bool_params.yml
@@ -6,7 +6,7 @@
   tasks:
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   - name: Set host1_fqdn .. host6_fqdn
diff --git a/tests/host/test_host_ipaddresses.yml b/tests/host/test_host_ipaddresses.yml
index 45500707..bcca18fc 100644
--- a/tests/host/test_host_ipaddresses.yml
+++ b/tests/host/test_host_ipaddresses.yml
@@ -6,7 +6,7 @@
   tasks:
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   - name: Set host1_fqdn .. host6_fqdn
diff --git a/tests/host/test_host_managedby_host.yml b/tests/host/test_host_managedby_host.yml
index e6fb9dc6..d5d36780 100644
--- a/tests/host/test_host_managedby_host.yml
+++ b/tests/host/test_host_managedby_host.yml
@@ -6,7 +6,7 @@
   tasks:
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   - name: Set host1_fqdn .. host2_fqdn
@@ -55,39 +55,39 @@
     register: result
     failed_when: result.changed
 
-  - name: Host "{{ host1_fqdn }}" managed by "{{ groups.ipaserver[0] }}"
+  - name: Host "{{ host1_fqdn }}" managed by "{{ ansible_fqdn }}"
     ipahost:
       ipaadmin_password: SomeADMINpassword
       name: "{{ host1_fqdn }}"
-      managedby_host: "{{ groups.ipaserver[0] }}"
+      managedby_host: "{{ ansible_fqdn }}"
       action: member
     register: result
     failed_when: not result.changed
 
-  - name: Host "{{ host1_fqdn }}" managed by "{{ groups.ipaserver[0] }}" again
+  - name: Host "{{ host1_fqdn }}" managed by "{{ ansible_fqdn }}" again
     ipahost:
       ipaadmin_password: SomeADMINpassword
       name: "{{ host1_fqdn }}"
-      managedby_host: "{{ groups.ipaserver[0] }}"
+      managedby_host: "{{ ansible_fqdn }}"
       action: member
     register: result
     failed_when: result.changed
 
-  - name: Host "{{ host1_fqdn }}" not managed by "{{ groups.ipaserver[0] }}"
+  - name: Host "{{ host1_fqdn }}" not managed by "{{ ansible_fqdn }}"
     ipahost:
       ipaadmin_password: SomeADMINpassword
       name: "{{ host1_fqdn }}"
-      managedby_host: "{{ groups.ipaserver[0] }}"
+      managedby_host: "{{ ansible_fqdn }}"
       action: member
       state: absent
     register: result
     failed_when: not result.changed
 
-  - name: Host "{{ host1_fqdn }}" not managed by "{{ groups.ipaserver[0] }}" again
+  - name: Host "{{ host1_fqdn }}" not managed by "{{ ansible_fqdn }}" again
     ipahost:
       ipaadmin_password: SomeADMINpassword
       name: "{{ host1_fqdn }}"
-      managedby_host: "{{ groups.ipaserver[0] }}"
+      managedby_host: "{{ ansible_fqdn }}"
       action: member
       state: absent
     register: result
diff --git a/tests/host/test_host_principal.yml b/tests/host/test_host_principal.yml
index 6c7d0dc0..5bef0522 100644
--- a/tests/host/test_host_principal.yml
+++ b/tests/host/test_host_principal.yml
@@ -6,12 +6,12 @@
   tasks:
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   - name: Get Realm from server name
     set_fact:
-      ipaserver_realm: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') | upper }}"
+      ipaserver_realm: "{{ ansible_fqdn.split('.')[1:] | join ('.') | upper }}"
     when: ipaserver_realm is not defined
 
   - name: Set host1_fqdn
diff --git a/tests/host/test_host_random.yml b/tests/host/test_host_random.yml
index 376740c7..211d660c 100644
--- a/tests/host/test_host_random.yml
+++ b/tests/host/test_host_random.yml
@@ -6,7 +6,7 @@
   tasks:
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   - name: Set host1_fqdn and host2_fqdn
@@ -77,11 +77,11 @@
     debug:
       var: ipahost.host["{{host2_fqdn }}"].randompassword
 
-  - name: Enrolled host "{{ groups.ipaserver[0] }}" fails to set random password with update_password always
+  - name: Enrolled host "{{ ansible_fqdn }}" fails to set random password with update_password always
     ipahost:
       ipaadmin_password: SomeADMINpassword
       hosts:
-      - name: "{{ groups.ipaserver[0] }}"
+      - name: "{{ ansible_fqdn }}"
         random: yes
       update_password: always
     register: ipahost
@@ -89,7 +89,7 @@
 
   - assert:
       that:
-      - ipahost.host["{{ groups.ipaserver[0] }}"].randompassword is
+      - ipahost.host["{{ ansible_fqdn }}"].randompassword is
         not defined
       - "'Password cannot be set on enrolled host' in ipahost.msg"
 
diff --git a/tests/host/test_host_reverse.yml b/tests/host/test_host_reverse.yml
index 9031b70b..883d1635 100644
--- a/tests/host/test_host_reverse.yml
+++ b/tests/host/test_host_reverse.yml
@@ -2,12 +2,11 @@
 - name: Test host
   hosts: ipaserver
   become: true
-  gather_facts: true
 
   tasks:
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   - name: Set host1_fqdn
diff --git a/tests/host/test_hosts.yml b/tests/host/test_hosts.yml
index f82cc612..1159e078 100644
--- a/tests/host/test_hosts.yml
+++ b/tests/host/test_hosts.yml
@@ -2,12 +2,11 @@
 - name: Test hosts
   hosts: ipaserver
   become: true
-  gather_facts: false
 
   tasks:
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   - name: Set host1_fqdn .. host6_fqdn
diff --git a/tests/host/test_hosts_managedby_host.yml b/tests/host/test_hosts_managedby_host.yml
index bd6452c4..0fc6651f 100644
--- a/tests/host/test_hosts_managedby_host.yml
+++ b/tests/host/test_hosts_managedby_host.yml
@@ -6,7 +6,7 @@
   tasks:
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   - name: Set host1_fqdn .. host5_fqdn
diff --git a/tests/host/test_hosts_principal.yml b/tests/host/test_hosts_principal.yml
index 3c10966a..b53c0433 100644
--- a/tests/host/test_hosts_principal.yml
+++ b/tests/host/test_hosts_principal.yml
@@ -6,12 +6,12 @@
   tasks:
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   - name: Get Realm from server name
     set_fact:
-      ipaserver_realm: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') | upper }}"
+      ipaserver_realm: "{{ ansible_fqdn.split('.')[1:] | join ('.') | upper }}"
     when: ipaserver_realm is not defined
 
   - name: Set host1_fqdn .. host2_fqdn
diff --git a/tests/hostgroup/test_hostgroup.yml b/tests/hostgroup/test_hostgroup.yml
index ba449a06..f5af7bbe 100644
--- a/tests/hostgroup/test_hostgroup.yml
+++ b/tests/hostgroup/test_hostgroup.yml
@@ -2,12 +2,12 @@
 - name: Test hostgroup
   hosts: ipaserver
   become: true
-  gather_facts: false
+  gather_facts: true
 
   tasks:
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   - name: Ensure host-group databases, mysql-server and oracle-server are absent
diff --git a/tests/service/certificate/test_service_certificate.yml b/tests/service/certificate/test_service_certificate.yml
index 89c46f10..3dc24c5b 100644
--- a/tests/service/certificate/test_service_certificate.yml
+++ b/tests/service/certificate/test_service_certificate.yml
@@ -29,7 +29,7 @@
   # setup
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   - name: Get IPv4 address prefix from server node
diff --git a/tests/service/test_service.yml b/tests/service/test_service.yml
index 25d66c69..39ddfbbc 100644
--- a/tests/service/test_service.yml
+++ b/tests/service/test_service.yml
@@ -19,7 +19,7 @@
   # setup
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   - name: Set host1, host2 and svc hosts fqdn
diff --git a/tests/service/test_service_without_skip_host_check.yml b/tests/service/test_service_without_skip_host_check.yml
index 147da0c9..6bfa314c 100644
--- a/tests/service/test_service_without_skip_host_check.yml
+++ b/tests/service/test_service_without_skip_host_check.yml
@@ -7,7 +7,7 @@
   # setup
   - name: Get Domain from server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
     when: ipaserver_domain is not defined
 
   - name: Set host1, host2 and svc hosts fqdn
diff --git a/tests/sudorule/test_sudorule.yml b/tests/sudorule/test_sudorule.yml
index 81ceca03..15ba7f46 100644
--- a/tests/sudorule/test_sudorule.yml
+++ b/tests/sudorule/test_sudorule.yml
@@ -3,7 +3,7 @@
 - name: Test sudorule
   hosts: ipaserver
   become: true
-  gather_facts: false
+  gather_facts: true
 
   tasks:
 
@@ -43,8 +43,7 @@
     ipahostgroup:
       ipaadmin_password: SomeADMINpassword
       name: cluster
-      host:
-      - "{{ groups.ipaserver[0] }}"
+      host: "{{ ansible_fqdn }}"
 
   - name: Ensure some sudocmds are available
     ipasudocmd:
@@ -501,20 +500,20 @@
     register: result
     failed_when: result.changed
 
-  - name: Ensure host "{{ groups.ipaserver[0] }}" is present in sudorule.
+  - name: Ensure host "{{ ansible_fqdn }}" is present in sudorule.
     ipasudorule:
       ipaadmin_password: SomeADMINpassword
       name: testrule1
-      host: "{{ groups.ipaserver[0] }}"
+      host: "{{ ansible_fqdn }}"
       action: member
     register: result
     failed_when: not result.changed
 
-  - name: Ensure host "{{ groups.ipaserver[0] }}" is present in sudorule, again.
+  - name: Ensure host "{{ ansible_fqdn }}" is present in sudorule, again.
     ipasudorule:
       ipaadmin_password: SomeADMINpassword
       name: testrule1
-      host: "{{ groups.ipaserver[0] }}"
+      host: "{{ ansible_fqdn }}"
       action: member
     register: result
     failed_when: result.changed
diff --git a/tests/sudorule/test_sudorule_categories.yml b/tests/sudorule/test_sudorule_categories.yml
index e28ca63c..a7740c57 100644
--- a/tests/sudorule/test_sudorule_categories.yml
+++ b/tests/sudorule/test_sudorule_categories.yml
@@ -7,7 +7,7 @@
   tasks:
   - name: Get Domain from the server name
     set_fact:
-      ipaserver_domain: "{{ groups.ipaserver[0].split('.')[1:] | join ('.') }}"
+      ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
 
   - name: Ensure sudorules are absent
     ipasudorule:
diff --git a/tests/vault/tasks_vault_members.yml b/tests/vault/tasks_vault_members.yml
index 12332ff1..1cbf0473 100644
--- a/tests/vault/tasks_vault_members.yml
+++ b/tests/vault/tasks_vault_members.yml
@@ -151,7 +151,7 @@
       ipaadmin_password: SomeADMINpassword
       name: "{{vault.name}}"
       action: member
-      services: "HTTP/{{ groups.ipaserver[0] }}"
+      services: "HTTP/{{ ansible_fqdn }}"
     register: result
     failed_when: not result.changed
 
@@ -160,7 +160,7 @@
       ipaadmin_password: SomeADMINpassword
       name: "{{vault.name}}"
       action: member
-      services: "HTTP/{{ groups.ipaserver[0] }}"
+      services: "HTTP/{{ ansible_fqdn }}"
     register: result
     failed_when: result.changed
 
@@ -169,7 +169,7 @@
       ipaadmin_password: SomeADMINpassword
       name: "{{vault.name}}"
       action: member
-      services: "HTTP/{{ groups.ipaserver[0] }}"
+      services: "HTTP/{{ ansible_fqdn }}"
       state: absent
     register: result
     failed_when: not result.changed
@@ -179,7 +179,7 @@
       ipaadmin_password: SomeADMINpassword
       name: "{{vault.name}}"
       action: member
-      services: "HTTP/{{ groups.ipaserver[0] }}"
+      services: "HTTP/{{ ansible_fqdn }}"
       state: absent
     register: result
     failed_when: result.changed
@@ -264,7 +264,7 @@
     ipavault:
       ipaadmin_password: SomeADMINpassword
       name: "{{vault.name}}"
-      ownerservices: "HTTP/{{ groups.ipaserver[0] }}"
+      ownerservices: "HTTP/{{ ansible_fqdn }}"
       action: member
     register: result
     failed_when: not result.changed
@@ -273,7 +273,7 @@
     ipavault:
       ipaadmin_password: SomeADMINpassword
       name: "{{vault.name}}"
-      ownerservices: "HTTP/{{ groups.ipaserver[0] }}"
+      ownerservices: "HTTP/{{ ansible_fqdn }}"
       action: member
     register: result
     failed_when: result.changed
@@ -282,7 +282,7 @@
     ipavault:
       ipaadmin_password: SomeADMINpassword
       name: "{{vault.name}}"
-      ownerservices: "HTTP/{{ groups.ipaserver[0] }}"
+      ownerservices: "HTTP/{{ ansible_fqdn }}"
       state: absent
       action: member
     register: result
@@ -292,7 +292,7 @@
     ipavault:
       ipaadmin_password: SomeADMINpassword
       name: "{{vault.name}}"
-      ownerservices: "HTTP/{{ groups.ipaserver[0] }}"
+      ownerservices: "HTTP/{{ ansible_fqdn }}"
       state: absent
       action: member
     register: result
-- 
GitLab