1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests/integration/targets/ejabberd_user/tasks/main.yml
patchback[bot] 9ea55a81b3
[PR #7033/c1f2f126 backport][stable-6] ejabberd_user: bug fixes + tests (#7069)
ejabberd_user: bug fixes + tests (#7033)

* ejabberd_user: bug fixes + tests

* fix changed property

* add license to handler file

* adjustments to test

* add needs/target/setup_epel to aliases

* further adjustments to integration tests

* add target to integration tests

* add some skips to test

* skip centos as it has no ejabberd

* skip fedora as it has no ejabberd

* discard unused epel setup

* add changelog frag

* remove ejabberd before tests

* fix typo

(cherry picked from commit c1f2f126cf)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2023-08-08 13:45:14 +02:00

106 lines
2.7 KiB
YAML

---
####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: Bail out if not supported
ansible.builtin.meta: end_play
when: ansible_distribution in ('Alpine', 'openSUSE Leap', 'CentOS', 'Fedora')
- name: Remove ejabberd
ansible.builtin.package:
name: ejabberd
state: absent
- name: Create user without ejabberdctl installed
community.general.ejabberd_user:
host: localhost
username: alice
password: pa$$w0rd
state: present
register: user_no_ejabberdctl
ignore_errors: true
- name: Install ejabberd
ansible.builtin.package:
name: ejabberd
state: present
notify: Remove ejabberd
- ansible.builtin.service:
name: ejabberd
state: started
- name: Create user alice (check)
community.general.ejabberd_user:
host: localhost
username: alice
password: pa$$w0rd
state: present
check_mode: true
register: user_alice_check
- name: Create user alice
community.general.ejabberd_user:
host: localhost
username: alice
password: pa$$w0rd
state: present
register: user_alice
- name: Create user alice (idempotency)
community.general.ejabberd_user:
host: localhost
username: alice
password: pa$$w0rd
state: present
register: user_alice_idempot
- name: Create user alice (change password)
community.general.ejabberd_user:
host: localhost
username: alice
password: different_pa$$w0rd
state: present
register: user_alice_chgpw
- name: Remove user alice (check)
community.general.ejabberd_user:
host: localhost
username: alice
state: absent
register: remove_alice_check
check_mode: true
- name: Remove user alice
community.general.ejabberd_user:
host: localhost
username: alice
state: absent
register: remove_alice
- name: Remove user alice (idempotency)
community.general.ejabberd_user:
host: localhost
username: alice
state: absent
register: remove_alice_idempot
- name: Assertions
ansible.builtin.assert:
that:
- user_no_ejabberdctl is failed
- "'Failed to find required executable' in user_no_ejabberdctl.msg"
- user_alice_check is changed
- user_alice is changed
- user_alice_idempot is not changed
- user_alice_chgpw is changed
- remove_alice_check is changed
- remove_alice is changed
- remove_alice_idempot is not changed