Skip to content

Commit

Permalink
Merge pull request #753 from t-woerner/group_test_fix_services
Browse files Browse the repository at this point in the history
group test: Enable ansible_facts, fix service hostname
  • Loading branch information
rjeffman authored Jan 27, 2022
2 parents 680cd4c + 0c36194 commit 4aab159
Showing 1 changed file with 28 additions and 34 deletions.
62 changes: 28 additions & 34 deletions tests/group/test_group.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,17 @@
- name: Test group
hosts: "{{ ipa_test_host | default('ipaserver') }}"
become: true
gather_facts: false
gather_facts: true

tasks:
# setup
- include_tasks: ../env_freeipa_facts.yml

# GET DOMAIN AND REALM
# GET FQDN_AT_DOMAIN

- name: Get Domain from server name
- name: Get fqdn_at_domain
set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined

- name: Get Realm from server name
set_fact:
ipaserver_realm: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') | upper }}"
when: ipaserver_realm is not defined
fqdn_at_domain: "{{ ansible_facts['fqdn'] + '@' + ipaserver_realm }}"

# CLEANUP TEST ITEMS

Expand Down Expand Up @@ -144,93 +138,93 @@

- block:

- name: Ensure service "{{ 'HTTP/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}" is present in group group1
- name: Ensure service "{{ 'HTTP/' + fqdn_at_domain }}" is present in group group1
ipagroup:
ipaadmin_password: SomeADMINpassword
ipaapi_context: "{{ ipa_context | default(omit) }}"
name: group1
service:
- "{{ 'HTTP/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}"
- "{{ 'HTTP/' + fqdn_at_domain }}"
action: member
register: result
failed_when: not result.changed or result.failed

- name: Ensure service "{{ 'HTTP/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}" is present in group group1, again
- name: Ensure service "{{ 'HTTP/' + fqdn_at_domain }}" is present in group group1, again
ipagroup:
ipaadmin_password: SomeADMINpassword
ipaapi_context: "{{ ipa_context | default(omit) }}"
name: group1
service:
- "{{ 'HTTP/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}"
- "{{ 'HTTP/' + fqdn_at_domain }}"
action: member
register: result
failed_when: result.changed or result.failed

- name: Ensure service "{{ 'ldap/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}" is present in group group1
- name: Ensure service "{{ 'ldap/' + fqdn_at_domain }}" is present in group group1
ipagroup:
ipaadmin_password: SomeADMINpassword
ipaapi_context: "{{ ipa_context | default(omit) }}"
name: group1
service:
- "{{ 'ldap/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}"
- "{{ 'ldap/' + fqdn_at_domain }}"
action: member
register: result
failed_when: not result.changed or result.failed

- name: Ensure service "{{ 'ldap/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}" is present in group group1, again
- name: Ensure service "{{ 'ldap/' + fqdn_at_domain }}" is present in group group1, again
ipagroup:
ipaadmin_password: SomeADMINpassword
ipaapi_context: "{{ ipa_context | default(omit) }}"
name: group1
service:
- "{{ 'ldap/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}"
- "{{ 'ldap/' + fqdn_at_domain }}"
action: member
register: result
failed_when: result.changed or result.failed

- name: Ensure service "{{ 'HTTP/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}" is absent in group group1
- name: Ensure service "{{ 'HTTP/' + fqdn_at_domain }}" is absent in group group1
ipagroup:
ipaadmin_password: SomeADMINpassword
ipaapi_context: "{{ ipa_context | default(omit) }}"
name: group1
service:
- "{{ 'HTTP/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}"
- "{{ 'HTTP/' + fqdn_at_domain }}"
action: member
state: absent
register: result
failed_when: not result.changed or result.failed

- name: Ensure service "{{ 'HTTP/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}" is absent in group group1, again
- name: Ensure service "{{ 'HTTP/' + fqdn_at_domain }}" is absent in group group1, again
ipagroup:
ipaadmin_password: SomeADMINpassword
ipaapi_context: "{{ ipa_context | default(omit) }}"
name: group1
service:
- "{{ 'HTTP/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}"
- "{{ 'HTTP/' + fqdn_at_domain }}"
action: member
state: absent
register: result
failed_when: result.changed or result.failed

- name: Ensure service "{{ 'ldap/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}" is absent in group group1
- name: Ensure service "{{ 'ldap/' + fqdn_at_domain }}" is absent in group group1
ipagroup:
ipaadmin_password: SomeADMINpassword
ipaapi_context: "{{ ipa_context | default(omit) }}"
name: group1
service:
- "{{ 'ldap/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}"
- "{{ 'ldap/' + fqdn_at_domain }}"
action: member
state: absent
register: result
failed_when: not result.changed or result.failed

- name: Ensure service "{{ 'ldap/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}" is absent in group group1, again
- name: Ensure service "{{ 'ldap/' + fqdn_at_domain }}" is absent in group group1, again
ipagroup:
ipaadmin_password: SomeADMINpassword
ipaapi_context: "{{ ipa_context | default(omit) }}"
name: group1
service:
- "{{ 'ldap/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}"
- "{{ 'ldap/' + fqdn_at_domain }}"
action: member
state: absent
register: result
Expand All @@ -242,8 +236,8 @@
ipaapi_context: "{{ ipa_context | default(omit) }}"
name: group1
service:
- "{{ 'HTTP/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}"
- "{{ 'ldap/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}"
- "{{ 'HTTP/' + fqdn_at_domain }}"
- "{{ 'ldap/' + fqdn_at_domain }}"
action: member
register: result
failed_when: not result.changed or result.failed
Expand All @@ -254,8 +248,8 @@
ipaapi_context: "{{ ipa_context | default(omit) }}"
name: group1
service:
- "{{ 'http/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}"
- "{{ 'ldap/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}"
- "{{ 'http/' + fqdn_at_domain }}"
- "{{ 'ldap/' + fqdn_at_domain }}"
action: member
register: result
failed_when: result.changed or result.failed
Expand All @@ -266,8 +260,8 @@
ipaapi_context: "{{ ipa_context | default(omit) }}"
name: group1
service:
- "{{ 'HTTP/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}"
- "{{ 'LDAP/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}"
- "{{ 'HTTP/' + fqdn_at_domain }}"
- "{{ 'LDAP/' + fqdn_at_domain }}"
action: member
state: absent
register: result
Expand All @@ -279,8 +273,8 @@
ipaapi_context: "{{ ipa_context | default(omit) }}"
name: group1
service:
- "{{ 'HTTP/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}"
- "{{ 'ldap/ipaserver.' + ipaserver_domain + '@' + ipaserver_realm }}"
- "{{ 'HTTP/' + fqdn_at_domain }}"
- "{{ 'ldap/' + fqdn_at_domain }}"
action: member
state: absent
register: result
Expand Down

0 comments on commit 4aab159

Please sign in to comment.