mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-08 06:13:21 +00:00
Unless there's a real need to use privileged access or to gather Ansible facts upfront, we should always set "become: false" and "gather_facts: false". In the case that only a few Ansible facts are required, 'ansible.builtin.setup' with 'gather_subset' should be used. As the YAML 1.2 standard dictates, boolean values should only use 'true' or 'false' values. This patch fixes these issues in the 'sudorule' test suite.
52 lines
1.7 KiB
YAML
52 lines
1.7 KiB
YAML
---
|
|
- name: Test sudorule
|
|
hosts: ipaclients, ipaserver
|
|
become: false
|
|
gather_facts: false
|
|
|
|
tasks:
|
|
- name: Include FreeIPA facts.
|
|
ansible.builtin.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.
|
|
ipasudorule:
|
|
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 sudorule using client context, in client host.
|
|
ansible.builtin.import_playbook: test_sudorule.yml
|
|
when: groups['ipaclients']
|
|
vars:
|
|
ipa_test_host: ipaclients
|
|
|
|
- name: Test sudorule using client context, in server host.
|
|
ansible.builtin.import_playbook: test_sudorule.yml
|
|
when: groups['ipaclients'] is not defined or not groups['ipaclients']
|
|
vars:
|
|
ipa_context: client
|
|
|
|
- name: Test sudorule using client context, in client host.
|
|
ansible.builtin.import_playbook: test_sudorules.yml
|
|
when: groups['ipaclients']
|
|
vars:
|
|
ipa_test_host: ipaclients
|
|
|
|
- name: Test sudorule using client context, in server host.
|
|
ansible.builtin.import_playbook: test_sudorules.yml
|
|
when: groups['ipaclients'] is not defined or not groups['ipaclients']
|
|
vars:
|
|
ipa_context: client
|