ansible/test/integration/targets/rabbitmq_user/tasks/tests.yml

138 lines
3.7 KiB
YAML
Raw Normal View History

---
- name: Test add user in check mode
block:
- name: Add user
rabbitmq_user: user=joe password=changeme
check_mode: true
register: add_user
- name: Check that user adding succeeds with a change
assert:
that:
- add_user.changed == true
- name: Test add user
block:
- name: Add user
rabbitmq_user: user=joe password=changeme
register: add_user
- name: Check that user adding succeeds with a change
assert:
that:
- add_user.changed == true
- name: Test add user idempotence
block:
- name: Add user
rabbitmq_user: user=joe password=changeme
register: add_user
- name: Check that user adding succeeds without a change
assert:
that:
- add_user.changed == false
- name: Test change user permissions in check mode
block:
- name: Add user with permissions
rabbitmq_user: user=joe password=changeme vhost=/ configure_priv=.* read_priv=.* write_priv=.*
check_mode: true
register: add_user
- name: Check that changing permissions succeeds with a change
assert:
that:
- add_user.changed == true
- name: Test change user permissions
block:
- name: Add user with permissions
rabbitmq_user: user=joe password=changeme vhost=/ configure_priv=.* read_priv=.* write_priv=.*
register: add_user
- name: Check that changing permissions succeeds with a change
assert:
that:
- add_user.changed == true
- name: Test change user permissions idempotence
block:
- name: Add user with permissions
rabbitmq_user: user=joe password=changeme vhost=/ configure_priv=.* read_priv=.* write_priv=.*
register: add_user
- name: Check that changing permissions succeeds without a change
assert:
that:
- add_user.changed == false
- name: Test add user tags in check mode
block:
- name: Add user with tags
rabbitmq_user: user=joe password=changeme vhost=/ configure_priv=.* read_priv=.* write_priv=.* tags=management,administrator
check_mode: true
register: add_user
- name: Check that adding tags succeeds with a change
assert:
that:
- add_user.changed == true
- name: Test add user tags
block:
- name: Add user with tags
rabbitmq_user: user=joe password=changeme vhost=/ configure_priv=.* read_priv=.* write_priv=.* tags=management,administrator
register: add_user
- name: Check that adding tags succeeds with a change
assert:
that:
- add_user.changed == true
- name: Test add user tags idempotence
block:
- name: Add user with tags
rabbitmq_user: user=joe password=changeme vhost=/ configure_priv=.* read_priv=.* write_priv=.* tags=administrator,management
register: add_user
- name: Check that adding tags succeeds without a change
assert:
that:
- add_user.changed == false
- name: Test remove user in check mode
block:
- name: Remove user
rabbitmq_user: user=joe state=absent
check_mode: true
register: remove_user
- name: Check that user removing succeeds with a change
assert:
that:
- remove_user.changed == true
- name: Test remove user
block:
- name: Remove user
rabbitmq_user: user=joe state=absent
register: remove_user
- name: Check that user removing succeeds with a change
assert:
that:
- remove_user.changed == true
- name: Test remove user idempotence
block:
- name: Remove user
rabbitmq_user: user=joe state=absent
register: remove_user
- name: Check that user removing succeeds without a change
assert:
that:
- remove_user.changed == false