Fix IPA version evaluation to test ipaservice with skip_host_check.

Test to verify IPA version before testing ipaservice with attribute
skip_host_check was inverted, and tests failed. This change fixes it.
This commit is contained in:
Rafael Guterres Jeffman
2020-08-21 20:37:49 -03:00
parent 39d5558bd2
commit 609901eda6
2 changed files with 758 additions and 885 deletions

View File

@@ -17,480 +17,485 @@
tasks: tasks:
# setup # setup
- name: Setup test environment - include_tasks: ../env_freeipa_facts.yml
include_tasks: env_setup.yml
# tests # tests
- name: Ensure service is present - name: Tests with skip_host_check, require IPA version 4.8.0+.
ipaservice: block:
ipaadmin_password: SomeADMINpassword - name: Setup test environment
name: "HTTP/{{ svc_fqdn }}" include_tasks: env_setup.yml
pac_type:
- MS-PAC
- PAD
auth_ind: otp
skip_host_check: no
force: yes
requires_pre_auth: yes
ok_as_delegate: no
ok_to_auth_as_delegate: no
register: result
failed_when: not result.changed
- name: Ensure service is present, again - name: Ensure service is present
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
pac_type: pac_type:
- MS_PAC - MS-PAC
- PAD - PAD
auth_ind: otp auth_ind: otp
skip_host_check: no skip_host_check: no
force: no force: yes
requires_pre_auth: yes requires_pre_auth: yes
ok_as_delegate: no ok_as_delegate: no
ok_to_auth_as_delegate: no ok_to_auth_as_delegate: no
register: result register: result
failed_when: result.changed failed_when: not result.changed
- name: Modify service. - name: Ensure service is present, again
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
pac_type: NONE pac_type:
ok_as_delegate: yes - MS_PAC
ok_to_auth_as_delegate: yes - PAD
register: result auth_ind: otp
failed_when: not result.changed skip_host_check: no
force: no
requires_pre_auth: yes
ok_as_delegate: no
ok_to_auth_as_delegate: no
register: result
failed_when: result.changed
- name: Modify service, again. - name: Modify service.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
pac_type: NONE pac_type: NONE
ok_as_delegate: yes ok_as_delegate: yes
ok_to_auth_as_delegate: yes ok_to_auth_as_delegate: yes
register: result register: result
failed_when: result.changed failed_when: not result.changed
- name: Ensure service is present, without host object. - name: Modify service, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ nohost_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
skip_host_check: yes pac_type: NONE
register: result ok_as_delegate: yes
failed_when: not result.changed ok_to_auth_as_delegate: yes
register: result
failed_when: result.changed
- name: Ensure service is present, without host object, again. - name: Ensure service is present, without host object.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ nohost_fqdn }}" name: "HTTP/{{ nohost_fqdn }}"
skip_host_check: yes skip_host_check: yes
register: result register: result
failed_when: result.changed failed_when: not result.changed
- name: Ensure service is present, with host not in DNS. - name: Ensure service is present, without host object, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: HTTP/svc.ihavenodns.info name: "HTTP/{{ nohost_fqdn }}"
skip_host_check: no skip_host_check: yes
force: yes register: result
register: result failed_when: result.changed
failed_when: not result.changed
- name: Ensure service is present, with host not in DNS, again. - name: Ensure service is present, with host not in DNS.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: HTTP/svc.ihavenodns.info name: HTTP/svc.ihavenodns.info
skip_host_check: no skip_host_check: no
force: yes force: yes
register: result register: result
failed_when: result.changed failed_when: not result.changed
- name: Ensure service is present, whithout host object and with host not in DNS. - name: Ensure service is present, with host not in DNS, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: HTTP/no.idontexist.info name: HTTP/svc.ihavenodns.info
skip_host_check: yes skip_host_check: no
force: yes force: yes
register: result register: result
failed_when: not result.changed failed_when: result.changed
- name: Ensure service is present, whithout host object and with host not in DNS, again. - name: Ensure service is present, whithout host object and with host not in DNS.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: HTTP/no.idontexist.info name: HTTP/no.idontexist.info
skip_host_check: yes skip_host_check: yes
force: yes force: yes
register: result register: result
failed_when: result.changed failed_when: not result.changed
- name: Principal host/test.example.com present in service. - name: Ensure service is present, whithout host object and with host not in DNS, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: HTTP/no.idontexist.info
principal: skip_host_check: yes
- host/test.example.com force: yes
action: member register: result
register: result failed_when: result.changed
failed_when: not result.changed
- name: Principal host/test.example.com present in service, again. - name: Principal host/test.example.com present in service.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
principal: principal:
- host/test.example.com - host/test.example.com
action: member action: member
register: result register: result
failed_when: result.changed failed_when: not result.changed
- name: Principal host/test.example.com absent in service. - name: Principal host/test.example.com present in service, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
principal: principal:
- host/test.example.com - host/test.example.com
action: member action: member
state: absent register: result
register: result failed_when: result.changed
failed_when: not result.changed
- name: Principal host/test.example.com absent in service, again. - name: Principal host/test.example.com absent in service.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
principal: principal:
- host/test.example.com - host/test.example.com
action: member action: member
state: absent state: absent
register: result register: result
failed_when: result.changed failed_when: not result.changed
- name: Ensure host can manage service. - name: Principal host/test.example.com absent in service, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
host: principal:
- "{{ host1_fqdn }}" - host/test.example.com
- "{{ host2_fqdn }}" action: member
action: member state: absent
register: result register: result
failed_when: not result.changed failed_when: result.changed
- name: Ensure host can manage service, again. - name: Ensure host can manage service.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
host: "{{ host1_fqdn }}" host:
action: member - "{{ host1_fqdn }}"
register: result - "{{ host2_fqdn }}"
failed_when: result.changed action: member
register: result
failed_when: not result.changed
- name: Ensure host cannot manage service. - name: Ensure host can manage service, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
host: host: "{{ host1_fqdn }}"
- "{{ host1_fqdn }}" action: member
- "{{ host2_fqdn }}" register: result
action: member failed_when: result.changed
state: absent
register: result
failed_when: not result.changed
- name: Ensure host cannot manage service, again. - name: Ensure host cannot manage service.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
host: host:
- "{{ host1_fqdn }}" - "{{ host1_fqdn }}"
- "{{ host2_fqdn }}" - "{{ host2_fqdn }}"
action: member action: member
state: absent state: absent
register: result register: result
failed_when: result.changed failed_when: not result.changed
- name: Service "HTTP/{{ svc_fqdn }}" members allow_create_keytab present for users, groups, hosts and hostgroups. - name: Ensure host cannot manage service, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
allow_create_keytab_user: host:
- user01 - "{{ host1_fqdn }}"
- user02 - "{{ host2_fqdn }}"
allow_create_keytab_group: action: member
- group01 state: absent
- group02 register: result
allow_create_keytab_host: failed_when: result.changed
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
allow_create_keytab_hostgroup:
- hostgroup01
- hostgroup02
action: member
register: result
failed_when: not result.changed
- name: Service "HTTP/{{ svc_fqdn }}" members allow_create_keytab present for users, groups, hosts and hostgroups, again. - name: Service "HTTP/{{ svc_fqdn }}" members allow_create_keytab present for users, groups, hosts and hostgroups.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
allow_create_keytab_user: allow_create_keytab_user:
- user01 - user01
- user02 - user02
allow_create_keytab_group: allow_create_keytab_group:
- group01 - group01
- group02 - group02
allow_create_keytab_host: allow_create_keytab_host:
- "{{ host1_fqdn }}" - "{{ host1_fqdn }}"
- "{{ host2_fqdn }}" - "{{ host2_fqdn }}"
allow_create_keytab_hostgroup: allow_create_keytab_hostgroup:
- hostgroup01 - hostgroup01
- hostgroup02 - hostgroup02
action: member action: member
register: result register: result
failed_when: result.changed failed_when: not result.changed
- name: Service "HTTP/{{ svc_fqdn }}" members allow_create_keytab absent for users, groups, hosts and hostgroups. - name: Service "HTTP/{{ svc_fqdn }}" members allow_create_keytab present for users, groups, hosts and hostgroups, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
allow_create_keytab_user: allow_create_keytab_user:
- user01 - user01
- user02 - user02
allow_create_keytab_group: allow_create_keytab_group:
- group01 - group01
- group02 - group02
allow_create_keytab_host: allow_create_keytab_host:
- "{{ host1_fqdn }}" - "{{ host1_fqdn }}"
- "{{ host2_fqdn }}" - "{{ host2_fqdn }}"
allow_create_keytab_hostgroup: allow_create_keytab_hostgroup:
- hostgroup01 - hostgroup01
- hostgroup02 - hostgroup02
action: member action: member
state: absent register: result
register: result failed_when: result.changed
failed_when: not result.changed
- name: Service "HTTP/{{ svc_fqdn }}" members allow_create_keytab absent for users, groups, hosts and hostgroups, again. - name: Service "HTTP/{{ svc_fqdn }}" members allow_create_keytab absent for users, groups, hosts and hostgroups.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
allow_create_keytab_user: allow_create_keytab_user:
- user01 - user01
- user02 - user02
allow_create_keytab_group: allow_create_keytab_group:
- group01 - group01
- group02 - group02
allow_create_keytab_host: allow_create_keytab_host:
- "{{ host1_fqdn }}" - "{{ host1_fqdn }}"
- "{{ host2_fqdn }}" - "{{ host2_fqdn }}"
allow_create_keytab_hostgroup: allow_create_keytab_hostgroup:
- hostgroup01 - hostgroup01
- hostgroup02 - hostgroup02
action: member action: member
state: absent state: absent
register: result register: result
failed_when: result.changed failed_when: not result.changed
- name: Service "HTTP/{{ svc_fqdn }}" members allow_retrieve_keytab present for users, groups, hosts and hostgroups - name: Service "HTTP/{{ svc_fqdn }}" members allow_create_keytab absent for users, groups, hosts and hostgroups, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
allow_retrieve_keytab_user: allow_create_keytab_user:
- user01 - user01
- user02 - user02
allow_retrieve_keytab_group: allow_create_keytab_group:
- group01 - group01
- group02 - group02
allow_retrieve_keytab_host: allow_create_keytab_host:
- "{{ host1_fqdn }}" - "{{ host1_fqdn }}"
- "{{ host2_fqdn }}" - "{{ host2_fqdn }}"
allow_retrieve_keytab_hostgroup: allow_create_keytab_hostgroup:
- hostgroup01 - hostgroup01
- hostgroup02 - hostgroup02
action: member action: member
register: result state: absent
failed_when: not result.changed register: result
failed_when: result.changed
- name: Service "HTTP/{{ svc_fqdn }}" members allow_retrieve_keytab present for users, groups, hosts and hostgroups, again. - name: Service "HTTP/{{ svc_fqdn }}" members allow_retrieve_keytab present for users, groups, hosts and hostgroups
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
allow_retrieve_keytab_user: allow_retrieve_keytab_user:
- user01 - user01
- user02 - user02
allow_retrieve_keytab_group: allow_retrieve_keytab_group:
- group01 - group01
- group02 - group02
allow_retrieve_keytab_host: allow_retrieve_keytab_host:
- "{{ host1_fqdn }}" - "{{ host1_fqdn }}"
- "{{ host2_fqdn }}" - "{{ host2_fqdn }}"
allow_retrieve_keytab_hostgroup: allow_retrieve_keytab_hostgroup:
- hostgroup01 - hostgroup01
- hostgroup02 - hostgroup02
action: member action: member
register: result register: result
failed_when: result.changed failed_when: not result.changed
- name: Service "HTTP/{{ svc_fqdn }}" members allow_retrieve_keytab absent for users, groups, hosts and hostgroups. - name: Service "HTTP/{{ svc_fqdn }}" members allow_retrieve_keytab present for users, groups, hosts and hostgroups, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
allow_retrieve_keytab_user: allow_retrieve_keytab_user:
- user01 - user01
- user02 - user02
allow_retrieve_keytab_group: allow_retrieve_keytab_group:
- group01 - group01
- group02 - group02
allow_retrieve_keytab_host: allow_retrieve_keytab_host:
- "{{ host1_fqdn }}" - "{{ host1_fqdn }}"
- "{{ host2_fqdn }}" - "{{ host2_fqdn }}"
allow_retrieve_keytab_hostgroup: allow_retrieve_keytab_hostgroup:
- hostgroup01 - hostgroup01
- hostgroup02 - hostgroup02
action: member action: member
state: absent register: result
register: result failed_when: result.changed
failed_when: not result.changed
- name: Service "HTTP/{{ svc_fqdn }}" members allow_retrieve_keytab absent for users, groups, hosts and hostgroups, again. - name: Service "HTTP/{{ svc_fqdn }}" members allow_retrieve_keytab absent for users, groups, hosts and hostgroups.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
allow_retrieve_keytab_user: allow_retrieve_keytab_user:
- user01 - user01
- user02 - user02
allow_retrieve_keytab_group: allow_retrieve_keytab_group:
- group01 - group01
- group02 - group02
allow_retrieve_keytab_host: allow_retrieve_keytab_host:
- "{{ host1_fqdn }}" - "{{ host1_fqdn }}"
- "{{ host2_fqdn }}" - "{{ host2_fqdn }}"
allow_retrieve_keytab_hostgroup: allow_retrieve_keytab_hostgroup:
- hostgroup01 - hostgroup01
- hostgroup02 - hostgroup02
action: member action: member
state: absent state: absent
register: result register: result
failed_when: result.changed failed_when: not result.changed
- name: Ensure service is absent - name: Service "HTTP/{{ svc_fqdn }}" members allow_retrieve_keytab absent for users, groups, hosts and hostgroups, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
state: absent allow_retrieve_keytab_user:
register: result - user01
failed_when: not result.changed - user02
allow_retrieve_keytab_group:
- group01
- group02
allow_retrieve_keytab_host:
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
allow_retrieve_keytab_hostgroup:
- hostgroup01
- hostgroup02
action: member
state: absent
register: result
failed_when: result.changed
- name: Ensure service is absent, again - name: Ensure service is absent
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
state: absent state: absent
register: result register: result
failed_when: result.changed failed_when: not result.changed
- name: Ensure service is present, with multiple auth_ind values. - name: Ensure service is absent, again
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
auth_ind: otp,radius state: absent
skip_host_check: no register: result
force: yes failed_when: result.changed
register: result
failed_when: not result.changed
- name: Ensure service is present, with multiple auth_ind values, again. - name: Ensure service is present, with multiple auth_ind values.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
auth_ind: otp,radius auth_ind: otp,radius
skip_host_check: no skip_host_check: no
force: yes force: yes
register: result register: result
failed_when: result.changed failed_when: not result.changed
- name: Clear auth_ind. - name: Ensure service is present, with multiple auth_ind values, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
auth_ind: "" auth_ind: otp,radius
skip_host_check: no skip_host_check: no
force: yes force: yes
register: result register: result
failed_when: not result.changed failed_when: result.changed
- name: Clear auth_ind, again. - name: Clear auth_ind.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
auth_ind: "" auth_ind: ""
skip_host_check: no skip_host_check: no
force: yes force: yes
register: result register: result
failed_when: result.changed failed_when: not result.changed
- name: Ensure services are absent. - name: Clear auth_ind, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: name: "HTTP/{{ svc_fqdn }}"
- "HTTP/{{ svc_fqdn }}" auth_ind: ""
- "HTTP/{{ nohost_fqdn }}" skip_host_check: no
- HTTP/svc.ihavenodns.info force: yes
- HTTP/no.idontexist.local register: result
continue: yes failed_when: result.changed
state: absent
register: result
failed_when: not result.changed
- name: Ensure services are absent. - name: Ensure services are absent.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: name:
- "HTTP/{{ svc_fqdn }}" - "HTTP/{{ svc_fqdn }}"
- "HTTP/{{ nohost_fqdn }}" - "HTTP/{{ nohost_fqdn }}"
- HTTP/svc.ihavenodns.info - HTTP/svc.ihavenodns.info
- HTTP/no.idontexist.local - HTTP/no.idontexist.local
continue: yes continue: yes
state: absent state: absent
register: result register: result
failed_when: result.changed failed_when: not result.changed
- name: Ensure SMB service is present. - name: Ensure services are absent.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "{{ host1_fqdn }}" name:
smb: yes - "HTTP/{{ svc_fqdn }}"
netbiosname: SAMBASVC - "HTTP/{{ nohost_fqdn }}"
register: result - HTTP/svc.ihavenodns.info
failed_when: not result.changed - HTTP/no.idontexist.local
continue: yes
state: absent
register: result
failed_when: result.changed
- name: Ensure SMB service is again. - name: Ensure SMB service is present.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "{{ host1_fqdn }}" name: "{{ host1_fqdn }}"
smb: yes smb: yes
netbiosname: SAMBASVC netbiosname: SAMBASVC
register: result register: result
failed_when: result.changed failed_when: not result.changed
- name: Ensure SMB service is absent. - name: Ensure SMB service is again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "cifs/{{ host1_fqdn }}" name: "{{ host1_fqdn }}"
state: absent smb: yes
register: result netbiosname: SAMBASVC
failed_when: not result.changed register: result
failed_when: result.changed
- name: Ensure SMB service is absent, again. - name: Ensure SMB service is absent.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "cifs/{{ host1_fqdn }}" name: "cifs/{{ host1_fqdn }}"
state: absent state: absent
register: result register: result
failed_when: result.changed failed_when: not result.changed
# cleanup - name: Ensure SMB service is absent, again.
- name: Cleanup test environment ipaservice:
include_tasks: env_cleanup.yml ipaadmin_password: SomeADMINpassword
name: "cifs/{{ host1_fqdn }}"
state: absent
register: result
failed_when: result.changed
# cleanup
- name: Cleanup test environment
include_tasks: env_cleanup.yml
when: ipa_version is version('4.7.0', '>=')

View File

@@ -4,478 +4,346 @@
become: yes become: yes
tasks: tasks:
- include_tasks: ../env_freeipa_facts.yml
- name: Tests requiring IPA version 4.7.0+ # setup
block:
# setup
- name: Get Domain from server name
set_fact:
ipaserver_domain: "{{ ansible_fqdn.split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined
- name: Set host1, host2 and svc hosts fqdn - name: Setup test environment
set_fact: include_tasks: env_setup.yml
host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
host2_fqdn: "{{ 'host2.' + ipaserver_domain }}"
svc_fqdn: "{{ 'svc.' + ipaserver_domain }}"
- name: Host absent # tests
ipahost: - name: Ensure service is present
ipaadmin_password: SomeADMINpassword ipaservice:
name: ipaadmin_password: SomeADMINpassword
- svc.ihavenodns.info name: "HTTP/{{ svc_fqdn }}"
- "{{ host1_fqdn }}" pac_type:
- "{{ host2_fqdn }}" - MS-PAC
- "{{ svc_fqdn }}" - PAD
update_dns: yes auth_ind: otp
state: absent force: no
requires_pre_auth: yes
ok_as_delegate: no
ok_to_auth_as_delegate: no
register: result
failed_when: not result.changed
- name: Get IPv4 address prefix from server node - name: Ensure service is present, again
set_fact: ipaservice:
ipv4_prefix: "{{ ansible_default_ipv4.address.split('.')[:-1] | ipaadmin_password: SomeADMINpassword
join('.') }}" name: "HTTP/{{ svc_fqdn }}"
pac_type:
- MS_PAC
- PAD
auth_ind: otp
force: no
requires_pre_auth: yes
ok_as_delegate: no
ok_to_auth_as_delegate: no
register: result
failed_when: result.changed
- name: Add hosts for tests. - name: Modify service.
ipahost: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
hosts: name: "HTTP/{{ svc_fqdn }}"
- name: "{{ host1_fqdn }}" pac_type: NONE
ip_address: "{{ ipv4_prefix + '.201' }}" ok_as_delegate: yes
update_dns: yes ok_to_auth_as_delegate: yes
- name: "{{ host2_fqdn }}" register: result
ip_address: "{{ ipv4_prefix + '.202' }}" failed_when: not result.changed
update_dns: yes
- name: "{{ svc_fqdn }}"
ip_address: "{{ ipv4_prefix + '.203' }}"
update_dns: yes
- name: svc.ihavenodns.info
update_dns: no
force: yes
- name: Ensure testing user user01 is present. - name: Modify service, again.
ipauser: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: user01 name: "HTTP/{{ svc_fqdn }}"
first: user01 pac_type: NONE
last: last ok_as_delegate: yes
ok_to_auth_as_delegate: yes
register: result
failed_when: result.changed
- name: Ensure testing user user02 is present. - name: Ensure service is present, with host not in DNS.
ipauser: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: user02 name: HTTP/svc.ihavenodns.info
first: user02 force: yes
last: last register: result
failed_when: not result.changed
- name: Ensure testing group group01 is present. - name: Ensure service is present, with host not in DNS, again.
ipagroup: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: group01 name: HTTP/svc.ihavenodns.info
force: yes
register: result
failed_when: result.changed
- name: Ensure testing group group02 is present. - name: Principal host/test.example.com present in service.
ipagroup: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: group02 name: "HTTP/{{ svc_fqdn }}"
principal:
- host/test.example.com
action: member
register: result
failed_when: not result.changed
- name: Ensure testing hostgroup hostgroup01 is present. - name: Principal host/test.exabple.com present in service, again.
ipahostgroup: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: hostgroup01 name: "HTTP/{{ svc_fqdn }}"
principal:
- host/test.example.com
action: member
register: result
failed_when: result.changed
- name: Ensure testing hostgroup hostgroup02 is present. - name: Principal host/test.example.com absent in service.
ipahostgroup: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: hostgroup02 name: "HTTP/{{ svc_fqdn }}"
principal:
- host/test.example.com
action: member
state: absent
register: result
failed_when: not result.changed
- name: Ensure services are absent. - name: Principal host/test.example.com absent in service, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: name: "HTTP/{{ svc_fqdn }}"
- "HTTP/{{ svc_fqdn }}" principal:
- HTTP/svc.ihavenodns.info - host/test.example.com
state: absent action: member
state: absent
register: result
failed_when: result.changed
# tests - name: Ensure host can manage service.
- name: Ensure service is present ipaservice:
ipaservice: ipaadmin_password: SomeADMINpassword
ipaadmin_password: SomeADMINpassword name: "HTTP/{{ svc_fqdn }}"
name: "HTTP/{{ svc_fqdn }}" host:
pac_type: - "{{ host1_fqdn }}"
- MS-PAC - "{{ host2_fqdn }}"
- PAD action: member
auth_ind: otp register: result
force: no failed_when: not result.changed
requires_pre_auth: yes
ok_as_delegate: no
ok_to_auth_as_delegate: no
register: result
failed_when: not result.changed
- name: Ensure service is present, again - name: Ensure host can manage service, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
pac_type: host: "{{ host1_fqdn }}"
- MS_PAC action: member
- PAD register: result
auth_ind: otp failed_when: result.changed
force: no
requires_pre_auth: yes
ok_as_delegate: no
ok_to_auth_as_delegate: no
register: result
failed_when: result.changed
- name: Modify service. - name: Ensure host cannot manage service.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
pac_type: NONE host:
ok_as_delegate: yes - "{{ host1_fqdn }}"
ok_to_auth_as_delegate: yes - "{{ host2_fqdn }}"
register: result action: member
failed_when: not result.changed state: absent
register: result
failed_when: not result.changed
- name: Modify service, again. - name: Ensure host cannot manage service, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
pac_type: NONE host:
ok_as_delegate: yes - "{{ host1_fqdn }}"
ok_to_auth_as_delegate: yes - "{{ host2_fqdn }}"
register: result action: member
failed_when: result.changed state: absent
register: result
failed_when: result.changed
- name: Ensure service is present, with host not in DNS. - name: Service "HTTP/{{ svc_fqdn }}" members allow_create_keytab present for users, groups, hosts and hostgroups.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: HTTP/svc.ihavenodns.info name: "HTTP/{{ svc_fqdn }}"
force: yes allow_create_keytab_user:
register: result - user01
failed_when: not result.changed - user02
allow_create_keytab_group:
- group01
- group02
allow_create_keytab_host:
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
allow_create_keytab_hostgroup:
- hostgroup01
- hostgroup02
action: member
register: result
failed_when: not result.changed
- name: Ensure service is present, with host not in DNS, again. - name: Service "HTTP/{{ svc_fqdn }}" members allow_create_keytab present for users, groups, hosts and hostgroups, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: HTTP/svc.ihavenodns.info name: "HTTP/{{ svc_fqdn }}"
force: yes allow_create_keytab_user:
register: result - user01
failed_when: result.changed - user02
allow_create_keytab_group:
- group01
- group02
allow_create_keytab_host:
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
allow_create_keytab_hostgroup:
- hostgroup01
- hostgroup02
action: member
register: result
failed_when: result.changed
- name: Principal host/test.example.com present in service. - name: Service "HTTP/{{ svc_fqdn }}" members allow_create_keytab absent for users, groups, hosts and hostgroups.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
principal: allow_create_keytab_user:
- host/test.example.com - user01
action: member - user02
register: result allow_create_keytab_group:
failed_when: not result.changed - group01
- group02
allow_create_keytab_host:
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
allow_create_keytab_hostgroup:
- hostgroup01
- hostgroup02
action: member
state: absent
register: result
failed_when: not result.changed
- name: Principal host/test.exabple.com present in service, again. - name: Service "HTTP/{{ svc_fqdn }}" members allow_create_keytab absent for users, groups, hosts and hostgroups, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
principal: allow_create_keytab_user:
- host/test.example.com - user01
action: member - user02
register: result allow_create_keytab_group:
failed_when: result.changed - group01
- group02
allow_create_keytab_host:
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
allow_create_keytab_hostgroup:
- hostgroup01
- hostgroup02
action: member
state: absent
register: result
failed_when: result.changed
- name: Principal host/test.example.com absent in service. - name: Service "HTTP/{{ svc_fqdn }}" members allow_retrieve_keytab present for users, groups, hosts and hostgroups
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
principal: allow_retrieve_keytab_user:
- host/test.example.com - user01
action: member - user02
state: absent allow_retrieve_keytab_group:
register: result - group01
failed_when: not result.changed - group02
allow_retrieve_keytab_host:
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
allow_retrieve_keytab_hostgroup:
- hostgroup01
- hostgroup02
action: member
register: result
failed_when: not result.changed
- name: Principal host/test.example.com absent in service, again. - name: Service "HTTP/{{ svc_fqdn }}" members allow_retrieve_keytab present for users, groups, hosts and hostgroups, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
principal: allow_retrieve_keytab_user:
- host/test.example.com - user01
action: member - user02
state: absent allow_retrieve_keytab_group:
register: result - group01
failed_when: result.changed - group02
allow_retrieve_keytab_host:
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
allow_retrieve_keytab_hostgroup:
- hostgroup01
- hostgroup02
action: member
register: result
failed_when: result.changed
- name: Ensure host can manage service. - name: Service "HTTP/{{ svc_fqdn }}" members allow_retrieve_keytab absent for users, groups, hosts and hostgroups.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
host: allow_retrieve_keytab_user:
- "{{ host1_fqdn }}" - user01
- "{{ host2_fqdn }}" - user02
action: member allow_retrieve_keytab_group:
register: result - group01
failed_when: not result.changed - group02
allow_retrieve_keytab_host:
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
allow_retrieve_keytab_hostgroup:
- hostgroup01
- hostgroup02
action: member
state: absent
register: result
failed_when: not result.changed
- name: Ensure host can manage service, again. - name: Service "HTTP/{{ svc_fqdn }}" members allow_retrieve_keytab absent for users, groups, hosts and hostgroups, again.
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
host: "{{ host1_fqdn }}" allow_retrieve_keytab_user:
action: member - user01
register: result - user02
failed_when: result.changed allow_retrieve_keytab_group:
- group01
- group02
allow_retrieve_keytab_host:
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
allow_retrieve_keytab_hostgroup:
- hostgroup01
- hostgroup02
action: member
state: absent
register: result
failed_when: result.changed
- name: Ensure host cannot manage service. #
ipaservice: - name: Ensure service is absent
ipaadmin_password: SomeADMINpassword ipaservice:
name: "HTTP/{{ svc_fqdn }}" ipaadmin_password: SomeADMINpassword
host: name: "HTTP/{{ svc_fqdn }}"
- "{{ host1_fqdn }}" state: absent
- "{{ host2_fqdn }}" register: result
action: member failed_when: not result.changed
state: absent
register: result
failed_when: not result.changed
- name: Ensure host cannot manage service, again. - name: Ensure service is absent, again
ipaservice: ipaservice:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}" name: "HTTP/{{ svc_fqdn }}"
host: state: absent
- "{{ host1_fqdn }}" register: result
- "{{ host2_fqdn }}" failed_when: result.changed
action: member
state: absent
register: result
failed_when: result.changed
- name: Service "HTTP/{{ svc_fqdn }}" members allow_create_keytab present for users, groups, hosts and hostgroups. # cleanup
ipaservice: - name: Cleanup test environment
ipaadmin_password: SomeADMINpassword include_tasks: env_cleanup.yml
name: "HTTP/{{ svc_fqdn }}"
allow_create_keytab_user:
- user01
- user02
allow_create_keytab_group:
- group01
- group02
allow_create_keytab_host:
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
allow_create_keytab_hostgroup:
- hostgroup01
- hostgroup02
action: member
register: result
failed_when: not result.changed
- name: Service "HTTP/{{ svc_fqdn }}" members allow_create_keytab present for users, groups, hosts and hostgroups, again.
ipaservice:
ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}"
allow_create_keytab_user:
- user01
- user02
allow_create_keytab_group:
- group01
- group02
allow_create_keytab_host:
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
allow_create_keytab_hostgroup:
- hostgroup01
- hostgroup02
action: member
register: result
failed_when: result.changed
- name: Service "HTTP/{{ svc_fqdn }}" members allow_create_keytab absent for users, groups, hosts and hostgroups.
ipaservice:
ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}"
allow_create_keytab_user:
- user01
- user02
allow_create_keytab_group:
- group01
- group02
allow_create_keytab_host:
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
allow_create_keytab_hostgroup:
- hostgroup01
- hostgroup02
action: member
state: absent
register: result
failed_when: not result.changed
- name: Service "HTTP/{{ svc_fqdn }}" members allow_create_keytab absent for users, groups, hosts and hostgroups, again.
ipaservice:
ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}"
allow_create_keytab_user:
- user01
- user02
allow_create_keytab_group:
- group01
- group02
allow_create_keytab_host:
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
allow_create_keytab_hostgroup:
- hostgroup01
- hostgroup02
action: member
state: absent
register: result
failed_when: result.changed
- name: Service "HTTP/{{ svc_fqdn }}" members allow_retrieve_keytab present for users, groups, hosts and hostgroups
ipaservice:
ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}"
allow_retrieve_keytab_user:
- user01
- user02
allow_retrieve_keytab_group:
- group01
- group02
allow_retrieve_keytab_host:
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
allow_retrieve_keytab_hostgroup:
- hostgroup01
- hostgroup02
action: member
register: result
failed_when: not result.changed
- name: Service "HTTP/{{ svc_fqdn }}" members allow_retrieve_keytab present for users, groups, hosts and hostgroups, again.
ipaservice:
ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}"
allow_retrieve_keytab_user:
- user01
- user02
allow_retrieve_keytab_group:
- group01
- group02
allow_retrieve_keytab_host:
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
allow_retrieve_keytab_hostgroup:
- hostgroup01
- hostgroup02
action: member
register: result
failed_when: result.changed
- name: Service "HTTP/{{ svc_fqdn }}" members allow_retrieve_keytab absent for users, groups, hosts and hostgroups.
ipaservice:
ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}"
allow_retrieve_keytab_user:
- user01
- user02
allow_retrieve_keytab_group:
- group01
- group02
allow_retrieve_keytab_host:
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
allow_retrieve_keytab_hostgroup:
- hostgroup01
- hostgroup02
action: member
state: absent
register: result
failed_when: not result.changed
- name: Service "HTTP/{{ svc_fqdn }}" members allow_retrieve_keytab absent for users, groups, hosts and hostgroups, again.
ipaservice:
ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}"
allow_retrieve_keytab_user:
- user01
- user02
allow_retrieve_keytab_group:
- group01
- group02
allow_retrieve_keytab_host:
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
allow_retrieve_keytab_hostgroup:
- hostgroup01
- hostgroup02
action: member
state: absent
register: result
failed_when: result.changed
#
- name: Ensure service is absent
ipaservice:
ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}"
state: absent
register: result
failed_when: not result.changed
- name: Ensure service is absent, again
ipaservice:
ipaadmin_password: SomeADMINpassword
name: "HTTP/{{ svc_fqdn }}"
state: absent
register: result
failed_when: result.changed
# cleanup
- name: Ensure services are absent.
ipaservice:
ipaadmin_password: SomeADMINpassword
name:
- "HTTP/{{ svc_fqdn }}"
- HTTP/svc.ihavenodns.info
state: absent
- name: Ensure host is absent
ipahost:
ipaadmin_password: SomeADMINpassword
name:
- "{{ svc_fqdn }}"
- "{{ host1_fqdn }}"
- "{{ host2_fqdn }}"
- svc.ihavenodns.info
state: absent
- name: Ensure testing users are absent.
ipauser:
ipaadmin_password: SomeADMINpassword
name:
- user01
- user02
state: absent
- name: Ensure testing groups are absent.
ipagroup:
ipaadmin_password: SomeADMINpassword
name:
- group01
- group02
state: absent
- name: Ensure testing hostgroup hostgroup01 is absent.
ipagroup:
ipaadmin_password: SomeADMINpassword
name:
- hostgroup01
state: absent
- name: Ensure testing hostgroup hostgroup02 is absent.
ipagroup:
ipaadmin_password: SomeADMINpassword
name:
- hostgroup02
state: absent
when: ipa_version is version('4.7.0', '>=')