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/spectrum_model_attrs/tasks/main.yml
tgates81 1f001cafd9
spectrum_model_attrs: Initial commit (#1802)
* spectrum_model_attrs: Initial commit

* spectrum_model_attrs: sanity check fixes (1)

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

* Apply suggestions from code review:
 * Removed ANSIBLE_METADATA.
 * List all currently supported names in DOCUMENTATION block.
 * Don't escape declarations that are long enough to fit on one
 line.

* Apply suggestions from code review:
  * YAML bools in DOCUMENTATION block.
  * Various DOCUMENTATION block aesthetics.
  * RETURN block proper format.
  * 'yes' -> True declaration in argument spec.
  * import urlencode from python 2 and 3 changed to
    six.moves.urllib.quote.

* spectrum_model_attrs: integration test added.

* Update plugins/modules/monitoring/spectrum_model_attrs.py

Co-authored-by: Amin Vakil <info@aminvakil.com>

* Update plugins/modules/monitoring/spectrum_model_attrs.py

Co-authored-by: Amin Vakil <info@aminvakil.com>

* spectrum_model_attrs: lint error fixes.

Co-authored-by: Tyler Gates <tgates@citco.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Amin Vakil <info@aminvakil.com>
2021-04-12 22:26:43 +02:00

73 lines
2.3 KiB
YAML

- name: "Verify required variables: model_name, model_type, oneclick_username, oneclick_password, oneclick_url"
fail:
msg: "One or more of the following variables are not set: model_name, model_type, oneclick_username, oneclick_password, oneclick_url"
when: >
model_name is not defined
or model_type is not defined
or oneclick_username is not defined
or oneclick_password is not defined
or oneclick_url is not defined
- block:
- name: "001: Enforce maintenance mode for {{ model_name }} with a note about why [check_mode test]"
spectrum_model_attrs: &mm_enabled_args
url: "{{ oneclick_url }}"
username: "{{ oneclick_username }}"
password: "{{ oneclick_password }}"
name: "{{ model_name }}"
type: "{{ model_type }}"
validate_certs: false
attributes:
- name: "isManaged"
value: "false"
- name: "Notes"
value: "{{ note_mm_enabled }}"
check_mode: true
register: mm_enabled_check_mode
- name: "001: assert that changes were made"
assert:
that:
- mm_enabled_check_mode is changed
- name: "001: assert that changed_attrs is properly set"
assert:
that:
- mm_enabled_check_mode.changed_attrs.Notes == note_mm_enabled
- mm_enabled_check_mode.changed_attrs.isManaged == "false"
- name: "002: Enforce maintenance mode for {{ model_name }} with a note about why"
spectrum_model_attrs:
<<: *mm_enabled_args
register: mm_enabled
check_mode: false
- name: "002: assert that changes were made"
assert:
that:
- mm_enabled is changed
- name: "002: assert that changed_attrs is properly set"
assert:
that:
- mm_enabled.changed_attrs.Notes == note_mm_enabled
- mm_enabled.changed_attrs.isManaged == "false"
- name: "003: Enforce maintenance mode for {{ model_name }} with a note about why [idempontence test]"
spectrum_model_attrs:
<<: *mm_enabled_args
register: mm_enabled_idp
check_mode: false
- name: "003: assert that changes were not made"
assert:
that:
- mm_enabled_idp is not changed
- name: "003: assert that changed_attrs is not set"
assert:
that:
- mm_enabled_idp.changed_attrs == {}
vars:
note_mm_enabled: "MM set via CO #1234 by OJ Simpson"