Skip to content
Snippets Groups Projects
Unverified Commit 77cd20bc authored by Thomas Woerner's avatar Thomas Woerner Committed by GitHub
Browse files

Merge pull request #1046 from rjeffman/fix_ansible_lint_tests

Fix ansible-lint on tests
parents b30ae1c9 16ce5f21
Branches
Tags
No related merge requests found
Showing
with 31 additions and 43 deletions
...@@ -13,8 +13,8 @@ homepage: "https://github.com/freeipa/ansible-freeipa" ...@@ -13,8 +13,8 @@ homepage: "https://github.com/freeipa/ansible-freeipa"
issues: "https://github.com/freeipa/ansible-freeipa/issues" issues: "https://github.com/freeipa/ansible-freeipa/issues"
readme: "README.md" readme: "README.md"
license: "GPL-3.0-or-later" license:
- "GPL-3.0-or-later"
tags: tags:
- "linux" - "linux"
- "system" - "system"
......
...@@ -59,13 +59,13 @@ ...@@ -59,13 +59,13 @@
pac_type: "" pac_type: ""
- name: Execute tests if ipa_version >= 4.8.0 - name: Execute tests if ipa_version >= 4.8.0
when: ipa_version is version('4.8.0', '>=')
block: block:
- name: Set maxhostname to 255 - name: Set maxhostname to 255
ipaconfig: ipaconfig:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
ipaapi_context: "{{ ipa_context | default(omit) }}" ipaapi_context: "{{ ipa_context | default(omit) }}"
maxhostname: 255 maxhostname: 255
when: ipa_version is version('4.8.0', '>=')
- name: Set maxusername to 45 - name: Set maxusername to 45
ipaconfig: ipaconfig:
...@@ -225,6 +225,7 @@ ...@@ -225,6 +225,7 @@
failed_when: result.changed or result.failed failed_when: result.changed or result.failed
- name: Execute tests if ipa_version >= 4.8.0 - name: Execute tests if ipa_version >= 4.8.0
when: ipa_version is version('4.8.0', '>=')
block: block:
- name: Set maxhostname to 77 - name: Set maxhostname to 77
ipaconfig: ipaconfig:
...@@ -241,7 +242,6 @@ ...@@ -241,7 +242,6 @@
maxhostname: 77 maxhostname: 77
register: result register: result
failed_when: result.changed or result.failed failed_when: result.changed or result.failed
when: ipa_version is version('4.8.0', '>=')
- name: Set pwdexpnotify to 17 - name: Set pwdexpnotify to 17
ipaconfig: ipaconfig:
...@@ -415,13 +415,13 @@ ...@@ -415,13 +415,13 @@
failed_when: not result.changed or result.failed failed_when: not result.changed or result.failed
- name: Execute tests if ipa_version >= 4.8.0 - name: Execute tests if ipa_version >= 4.8.0
when: ipa_version is version('4.8.0', '>=')
block: block:
- name: Reset maxhostname - name: Reset maxhostname
ipaconfig: ipaconfig:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
ipaapi_context: "{{ ipa_context | default(omit) }}" ipaapi_context: "{{ ipa_context | default(omit) }}"
maxhostname: '{{ previousconfig.config.maxhostname | default(omit) }}' maxhostname: '{{ previousconfig.config.maxhostname | default(omit) }}'
when: ipa_version is version('4.8.0', '>=')
- name: Reset changed fields, again - name: Reset changed fields, again
ipaconfig: ipaconfig:
...@@ -451,13 +451,13 @@ ...@@ -451,13 +451,13 @@
failed_when: result.changed or result.failed failed_when: result.changed or result.failed
- name: Execute tests if ipa_version >= 4.8.0 - name: Execute tests if ipa_version >= 4.8.0
when: ipa_version is version('4.8.0', '>=')
block: block:
- name: Reset maxhostname - name: Reset maxhostname
ipaconfig: ipaconfig:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
ipaapi_context: "{{ ipa_context | default(omit) }}" ipaapi_context: "{{ ipa_context | default(omit) }}"
maxhostname: '{{ previousconfig.config.maxhostname | default(omit) }}' maxhostname: '{{ previousconfig.config.maxhostname | default(omit) }}'
when: ipa_version is version('4.8.0', '>=')
rescue: rescue:
- name: Set fields to IPA default, due to error - name: Set fields to IPA default, due to error
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
# TESTS # TESTS
- name: Test config sid - name: Test config sid
# only run tests if version supports enable-sid
when: ipa_version is version("4.9.8", ">=")
block: block:
- name: Check if SID is enabled. - name: Check if SID is enabled.
ipaconfig: ipaconfig:
...@@ -115,8 +117,6 @@ ...@@ -115,8 +117,6 @@
ipaapi_context: "{{ ipa_context | default(omit) }}" ipaapi_context: "{{ ipa_context | default(omit) }}"
add_sids: yes add_sids: yes
# only run tests if version supports enable-sid
when: ipa_version is version("4.9.8", ">=")
# REVERT TO PREVIOUS CONFIG # REVERT TO PREVIOUS CONFIG
always: always:
# Once SID is enabled, it cannot be reverted. # Once SID is enabled, it cannot be reverted.
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
trust_test_is_supported: no trust_test_is_supported: no
- name: Ensure ipaserver_domain is set - name: Ensure ipaserver_domain is set
when: ipaserver_domain is not defined
block: block:
- name: Get Domain from server name - name: Get Domain from server name
ansible.builtin.set_fact: ansible.builtin.set_fact:
...@@ -41,4 +42,3 @@ ...@@ -41,4 +42,3 @@
ansible.builtin.set_fact: ansible.builtin.set_fact:
ipaserver_domain: "ipa.test" ipaserver_domain: "ipa.test"
when: "'fqdn' not in ansible_facts" when: "'fqdn' not in ansible_facts"
when: ipaserver_domain is not defined
...@@ -138,6 +138,7 @@ ...@@ -138,6 +138,7 @@
# service # service
- name: Execute tests if ipa_verison >= 4.7.0 - name: Execute tests if ipa_verison >= 4.7.0
when: ipa_version is version('4.7.0', '>=')
block: block:
- name: Ensure service "{{ 'HTTP/' + fqdn_at_domain }}" is present in group group1 - name: Ensure service "{{ 'HTTP/' + fqdn_at_domain }}" is present in group group1
...@@ -282,8 +283,6 @@ ...@@ -282,8 +283,6 @@
register: result register: result
failed_when: result.changed or result.failed failed_when: result.changed or result.failed
when: ipa_version is version('4.7.0', '>=')
# user # user
- name: Ensure users user1, user2 and user3 are present in group group1 - name: Ensure users user1, user2 and user3 are present in group group1
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
ansible.builtin.include_tasks: ../env_freeipa_facts.yml ansible.builtin.include_tasks: ../env_freeipa_facts.yml
- name: Execute group tests if trust test environment is supported - name: Execute group tests if trust test environment is supported
when: trust_test_is_supported | default(false)
block: block:
- name: Add nonposix group. - name: Add nonposix group.
...@@ -111,5 +112,3 @@ ...@@ -111,5 +112,3 @@
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
name: extgroup name: extgroup
state: absent state: absent
when: trust_test_is_supported | default(false)
...@@ -205,6 +205,7 @@ ...@@ -205,6 +205,7 @@
# EXTERNAL MEMBER TEST (REQUIRES AD) # EXTERNAL MEMBER TEST (REQUIRES AD)
- name: Execute group tests if trust test environment is supported - name: Execute group tests if trust test environment is supported
when: trust_test_is_supported | default(false)
block: block:
- name: Ensure users testuser1, testuser2 and testuser3 are present in group externalgroup - name: Ensure users testuser1, testuser2 and testuser3 are present in group externalgroup
...@@ -231,8 +232,6 @@ ...@@ -231,8 +232,6 @@
register: result register: result
failed_when: result.changed or result.failed failed_when: result.changed or result.failed
when: trust_test_is_supported | default(false)
# CONVERT NONPOSIX TO POSIX GROUP WITH USERS # CONVERT NONPOSIX TO POSIX GROUP WITH USERS
- name: Ensure nonposix group nonposixgroup as posix - name: Ensure nonposix group nonposixgroup as posix
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
ansible.builtin.include_tasks: ../env_freeipa_facts.yml ansible.builtin.include_tasks: ../env_freeipa_facts.yml
- name: Execute tests if ipa_verison >= 4.8.7 and trust test environment is supported - name: Execute tests if ipa_verison >= 4.8.7 and trust test environment is supported
when: ipa_version is version("4.8.7", ">=") and trust_test_is_supported | default(false)
block: block:
- name: Create idoverrideuser. - name: Create idoverrideuser.
ansible.builtin.shell: | ansible.builtin.shell: |
...@@ -97,10 +98,8 @@ ...@@ -97,10 +98,8 @@
always: always:
- name: Remove idoverrideuser. - name: Remove idoverrideuser.
ansible.builtin.shell: | ansible.builtin.shell:
cmd: |
kinit -c idoverride_cache admin <<< SomeADMINpassword kinit -c idoverride_cache admin <<< SomeADMINpassword
ipa idoverrideuser-del "Default Trust View" {{ ad_user }} ipa idoverrideuser-del "Default Trust View" {{ ad_user }}
kdestroy -A -q -c idoverride_cache kdestroy -A -q -c idoverride_cache
when:
when: ipa_version is version("4.8.7", ">=") and trust_test_is_supported | default(false)
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
ansible.builtin.include_tasks: ../env_freeipa_facts.yml ansible.builtin.include_tasks: ../env_freeipa_facts.yml
- name: Execute tests if ipa_verison >= 4.8.4 - name: Execute tests if ipa_verison >= 4.8.4
when: ipa_version is version('4.8.4', '>=')
block: block:
- name: Ensure user manangeruser1 and manageruser2 is absent - name: Ensure user manangeruser1 and manageruser2 is absent
ipauser: ipauser:
...@@ -206,5 +207,3 @@ ...@@ -206,5 +207,3 @@
state: absent state: absent
register: result register: result
failed_when: not result.changed or result.failed failed_when: not result.changed or result.failed
when: ipa_version is version('4.8.4', '>=')
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
ansible.builtin.include_tasks: ../env_freeipa_facts.yml ansible.builtin.include_tasks: ../env_freeipa_facts.yml
- name: Tests requiring IPA version 4.8.4+ - name: Tests requiring IPA version 4.8.4+
when: ipa_version is version('4.8.4', '>=')
block: block:
- name: Ensure host-group testhostgroup is absent - name: Ensure host-group testhostgroup is absent
ipahostgroup: ipahostgroup:
...@@ -224,4 +225,3 @@ ...@@ -224,4 +225,3 @@
state: absent state: absent
register: result register: result
failed_when: not result.changed or result.failed failed_when: not result.changed or result.failed
when: ipa_version is version('4.8.4', '>=')
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
ansible.builtin.include_tasks: ../env_freeipa_facts.yml ansible.builtin.include_tasks: ../env_freeipa_facts.yml
- name: Tests requiring IPA version 4.8.7+ - name: Tests requiring IPA version 4.8.7+
when: ipa_version is version('4.8.7', '>=')
block: block:
- name: Ensure testing host-group are absent - name: Ensure testing host-group are absent
ipahostgroup: ipahostgroup:
...@@ -108,5 +109,3 @@ ...@@ -108,5 +109,3 @@
- databases - databases
- datalake - datalake
state: absent state: absent
when: ipa_version is version('4.8.7', '>=')
...@@ -120,6 +120,7 @@ ...@@ -120,6 +120,7 @@
name: local_id_range name: local_id_range
- name: Execute idrange tests if trust test environment is supported - name: Execute idrange tests if trust test environment is supported
when: trust_test_is_supported | default(false)
block: block:
# Create trust with range_type: ipa-ad-trust # Create trust with range_type: ipa-ad-trust
- name: Create trust with range_type 'ipa-ad-trust' - name: Create trust with range_type 'ipa-ad-trust'
...@@ -367,5 +368,3 @@ ...@@ -367,5 +368,3 @@
- ad_posix_id_range - ad_posix_id_range
continue: yes continue: yes
state: absent state: absent
when: trust_test_is_supported | default(false)
--- ---
- name: Ensure ipaserver_domain is set - name: Ensure ipaserver_domain is set
when: ipaserver_domain is not defined
block: block:
- name: Get Domain from server name - name: Get Domain from server name
ansible.builtin.set_fact: ansible.builtin.set_fact:
...@@ -9,7 +10,6 @@ ...@@ -9,7 +10,6 @@
ansible.builtin.set_fact: ansible.builtin.set_fact:
ipaserver_domain: "ipa.test" ipaserver_domain: "ipa.test"
when: "'fqdn' not in ansible_facts" when: "'fqdn' not in ansible_facts"
when: ipaserver_domain is not defined
- name: Set ipaserver_realm. - name: Set ipaserver_realm.
ansible.builtin.set_fact: ansible.builtin.set_fact:
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
# CLEANUP TEST ITEMS # CLEANUP TEST ITEMS
- name: Ensure ipa_server_name is set - name: Ensure ipa_server_name is set
when: ipa_server_name is not defined
block: block:
- name: Get server name from hostname - name: Get server name from hostname
ansible.builtin.set_fact: ansible.builtin.set_fact:
...@@ -16,9 +17,9 @@ ...@@ -16,9 +17,9 @@
- name: Fallback to 'ipaserver' - name: Fallback to 'ipaserver'
ansible.builtin.set_fact: ansible.builtin.set_fact:
ipa_server_name: ipaserver ipa_server_name: ipaserver
when: ipa_server_name is not defined
- name: Ensure ipaserver_domain is set - name: Ensure ipaserver_domain is set
when: ipaserver_domain is not defined
block: block:
- name: Get domain name from hostname. - name: Get domain name from hostname.
ansible.builtin.set_fact: ansible.builtin.set_fact:
...@@ -27,7 +28,6 @@ ...@@ -27,7 +28,6 @@
- name: Fallback to 'ipa.test' - name: Fallback to 'ipa.test'
ansible.builtin.set_fact: ansible.builtin.set_fact:
ipaserver_domain: "ipa.test" ipaserver_domain: "ipa.test"
when: ipaserver_domain is not defined
- name: Ensure server "{{ ipa_server_name + '.' + ipaserver_domain }}" without location - name: Ensure server "{{ ipa_server_name + '.' + ipaserver_domain }}" without location
ipaserver: ipaserver:
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
# tests # tests
- name: Tests with skip_host_check, require IPA version 4.8.0+. - name: Tests with skip_host_check, require IPA version 4.8.0+.
when: ipa_version is version('4.7.0', '>=')
block: block:
- name: Setup test environment - name: Setup test environment
ansible.builtin.include_tasks: env_setup.yml ansible.builtin.include_tasks: env_setup.yml
...@@ -577,4 +578,3 @@ ...@@ -577,4 +578,3 @@
# cleanup # cleanup
- name: Cleanup test environment - name: Cleanup test environment
ansible.builtin.include_tasks: env_cleanup.yml ansible.builtin.include_tasks: env_cleanup.yml
when: ipa_version is version('4.7.0', '>=')
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
ansible.builtin.include_tasks: ../env_freeipa_facts.yml ansible.builtin.include_tasks: ../env_freeipa_facts.yml
- name: Host principals are only possible with IPA 4.9.0+ - name: Host principals are only possible with IPA 4.9.0+
when: ipa_version is version('4.9.0', '>=')
block: block:
# SET FACTS # SET FACTS
...@@ -145,5 +146,3 @@ ...@@ -145,5 +146,3 @@
state: absent state: absent
register: result register: result
failed_when: not result.changed or result.failed failed_when: not result.changed or result.failed
when: ipa_version is version('4.9.0', '>=')
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
ansible.builtin.include_tasks: ../env_freeipa_facts.yml ansible.builtin.include_tasks: ../env_freeipa_facts.yml
- name: Host principals are only possible with IPA 4.9.0+ - name: Host principals are only possible with IPA 4.9.0+
when: ipa_version is version('4.9.0', '>=')
block: block:
# SET FACTS # SET FACTS
...@@ -145,5 +146,3 @@ ...@@ -145,5 +146,3 @@
state: absent state: absent
register: result register: result
failed_when: not result.changed or result.failed failed_when: not result.changed or result.failed
when: ipa_version is version('4.9.0', '>=')
...@@ -17,10 +17,9 @@ ...@@ -17,10 +17,9 @@
ipa_range_exists: 'Range name: {{ ipaserver.realm }}_subid_range' ipa_range_exists: 'Range name: {{ ipaserver.realm }}_subid_range'
tasks: tasks:
- name: Run tust tests, if supported by environment - name: Run tust tests, if supported by environment
when: trust_test_is_supported | default(false)
block: block:
- name: Delete test trust - name: Delete test trust
ipatrust: ipatrust:
ipaadmin_password: SomeADMINpassword ipaadmin_password: SomeADMINpassword
...@@ -165,5 +164,3 @@ ...@@ -165,5 +164,3 @@
ipa idrange-del {{ adserver.realm }}_id_range || true ipa idrange-del {{ adserver.realm }}_id_range || true
ipa idrange-del {{ ipaserver.realm }}_subid_range || true ipa idrange-del {{ ipaserver.realm }}_subid_range || true
kdestroy -c test_krb5_cache -q -A kdestroy -c test_krb5_cache -q -A
when: trust_test_is_supported | default(false)
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
tasks: tasks:
- name: Include users.json - name: Include users.json
ansible.builtin.include_vars: ansible.builtin.include_vars:
file: users.json # noqa 505 file: users.json # noqa missing-import
- name: Create dict with user names - name: Create dict with user names
ansible.builtin.set_fact: ansible.builtin.set_fact:
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
tasks: tasks:
- name: Include users.json - name: Include users.json
ansible.builtin.include_vars: ansible.builtin.include_vars:
file: users.json # noqa 505 file: users.json # noqa missing-import
- name: Users present len:{{ users | length }} - name: Users present len:{{ users | length }}
ipauser: ipauser:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment