mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
New module alerta_customer (#4554)
* first draft of alerta_customer * Update BOTMETA.yml * update after review * fix pagination and state description * remove whitespace
This commit is contained in:
parent
346bfba9c5
commit
d7e5e85f3e
7 changed files with 607 additions and 0 deletions
2
tests/integration/targets/alerta_customer/aliases
Normal file
2
tests/integration/targets/alerta_customer/aliases
Normal file
|
@ -0,0 +1,2 @@
|
|||
shippable/posix/group1
|
||||
disabled
|
|
@ -0,0 +1,4 @@
|
|||
alerta_url: http://localhost:8080/
|
||||
alerta_user: admin@example.com
|
||||
alerta_password: password
|
||||
alerta_key: demo-key
|
151
tests/integration/targets/alerta_customer/tasks/main.yml
Normal file
151
tests/integration/targets/alerta_customer/tasks/main.yml
Normal file
|
@ -0,0 +1,151 @@
|
|||
####################################################################
|
||||
# WARNING: These are designed specifically for Ansible tests #
|
||||
# and should not be used as examples of how to write Ansible roles #
|
||||
####################################################################
|
||||
|
||||
- name: Create customer (check mode)
|
||||
alerta_customer:
|
||||
alerta_url: "{{ alerta_url }}"
|
||||
api_username: "{{ alerta_user }}"
|
||||
api_password: "{{ alerta_password }}"
|
||||
customer: customer1
|
||||
match: admin@admin.admin
|
||||
check_mode: true
|
||||
register: result
|
||||
|
||||
- name: Check result (check mode)
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Create customer
|
||||
alerta_customer:
|
||||
alerta_url: "{{ alerta_url }}"
|
||||
api_username: "{{ alerta_user }}"
|
||||
api_password: "{{ alerta_password }}"
|
||||
customer: customer1
|
||||
match: admin@admin.admin
|
||||
register: result
|
||||
|
||||
- name: Check customer creation
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Test customer creation idempotency
|
||||
alerta_customer:
|
||||
alerta_url: "{{ alerta_url }}"
|
||||
api_username: "{{ alerta_user }}"
|
||||
api_password: "{{ alerta_password }}"
|
||||
customer: customer1
|
||||
match: admin@admin.admin
|
||||
register: result
|
||||
|
||||
- name: Check customer creation idempotency
|
||||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
|
||||
- name: Delete customer (check mode)
|
||||
alerta_customer:
|
||||
alerta_url: "{{ alerta_url }}"
|
||||
api_username: "{{ alerta_user }}"
|
||||
api_password: "{{ alerta_password }}"
|
||||
customer: customer1
|
||||
match: admin@admin.admin
|
||||
state: absent
|
||||
check_mode: true
|
||||
register: result
|
||||
|
||||
- name: Check customer deletion (check mode)
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Delete customer
|
||||
alerta_customer:
|
||||
alerta_url: "{{ alerta_url }}"
|
||||
api_username: "{{ alerta_user }}"
|
||||
api_password: "{{ alerta_password }}"
|
||||
customer: customer1
|
||||
match: admin@admin.admin
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: Check customer deletion
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Test customer deletion idempotency
|
||||
alerta_customer:
|
||||
alerta_url: "{{ alerta_url }}"
|
||||
api_username: "{{ alerta_user }}"
|
||||
api_password: "{{ alerta_password }}"
|
||||
customer: customer1
|
||||
match: admin@admin.admin
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: Check customer deletion idempotency
|
||||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
|
||||
- name: Delete non-existing customer (check mode)
|
||||
alerta_customer:
|
||||
alerta_url: "{{ alerta_url }}"
|
||||
api_username: "{{ alerta_user }}"
|
||||
api_password: "{{ alerta_password }}"
|
||||
customer: customer1
|
||||
match: admin@admin.admin
|
||||
state: absent
|
||||
check_mode: true
|
||||
register: result
|
||||
|
||||
- name: Check non-existing customer deletion (check mode)
|
||||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
|
||||
- name: Create customer with api key
|
||||
alerta_customer:
|
||||
alerta_url: "{{ alerta_url }}"
|
||||
api_key: "{{ alerta_key }}"
|
||||
customer: customer1
|
||||
match: admin@admin.admin
|
||||
register: result
|
||||
|
||||
- name: Check customer creation with api key
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Delete customer with api key
|
||||
alerta_customer:
|
||||
alerta_url: "{{ alerta_url }}"
|
||||
api_key: "{{ alerta_key }}"
|
||||
customer: customer1
|
||||
match: admin@admin.admin
|
||||
state: absent
|
||||
register: result
|
||||
|
||||
- name: Check customer deletion with api key
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
|
||||
- name: Use wrong api key
|
||||
alerta_customer:
|
||||
alerta_url: "{{ alerta_url }}"
|
||||
api_key: wrong_key
|
||||
customer: customer1
|
||||
match: admin@admin.admin
|
||||
register: result
|
||||
ignore_errors: true
|
||||
|
||||
- name: Check customer creation with api key
|
||||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
- result is failed
|
Loading…
Add table
Add a link
Reference in a new issue