2022-08-08 15:19:46 +02:00
|
|
|
# Copyright (c) 2021, Alexei Znamensky
|
2022-08-05 13:17:19 +02:00
|
|
|
# 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
|
2021-07-11 16:34:59 +02:00
|
|
|
|
2021-04-05 15:19:13 +02:00
|
|
|
- name: test mstate 1
|
|
|
|
mstate:
|
|
|
|
a: 80
|
|
|
|
b: banana
|
|
|
|
c: cashew
|
|
|
|
state: nop
|
|
|
|
register: state1
|
|
|
|
|
|
|
|
- name: assert state1
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- state1.a == 80
|
|
|
|
- state1.b == "banana"
|
|
|
|
- state1.c == "cashew"
|
|
|
|
- state1.result == "abc"
|
2021-07-16 19:29:00 +02:00
|
|
|
- state1 is not changed
|
2021-04-05 15:19:13 +02:00
|
|
|
|
|
|
|
- name: test mstate 2
|
|
|
|
mstate:
|
|
|
|
a: 80
|
|
|
|
b: banana
|
|
|
|
c: cashew
|
|
|
|
register: state2
|
|
|
|
|
|
|
|
- name: assert state2
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- state2.a == 80
|
|
|
|
- state2.b == "banana"
|
|
|
|
- state2.c == "cashew"
|
|
|
|
- state2.result == "80bananacashew"
|
2021-07-16 19:29:00 +02:00
|
|
|
- state2 is changed
|
2021-04-05 15:19:13 +02:00
|
|
|
|
|
|
|
- name: test mstate 3
|
|
|
|
mstate:
|
|
|
|
a: 3
|
|
|
|
b: banana
|
|
|
|
state: b_x_a
|
|
|
|
register: state3
|
|
|
|
|
|
|
|
- name: assert state3
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- state3.a == 3
|
|
|
|
- state3.b == "banana"
|
|
|
|
- state3.result == "bananabananabanana"
|
2021-07-16 19:29:00 +02:00
|
|
|
- state3 is changed
|
2021-04-05 15:19:13 +02:00
|
|
|
|
|
|
|
- name: test mstate 4
|
|
|
|
mstate:
|
|
|
|
a: 4
|
|
|
|
c: cashew
|
|
|
|
state: c_x_a
|
|
|
|
register: state4
|
|
|
|
|
|
|
|
- name: assert state4
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- state4.a == 4
|
|
|
|
- state4.c == "cashew"
|
|
|
|
- state4.result == "cashewcashewcashewcashew"
|
2021-07-16 19:29:00 +02:00
|
|
|
- state4 is changed
|
2021-04-05 15:19:13 +02:00
|
|
|
|
|
|
|
- name: test mstate 5
|
|
|
|
mstate:
|
|
|
|
a: 5
|
|
|
|
b: foo
|
|
|
|
c: bar
|
2021-11-30 07:10:48 +01:00
|
|
|
trigger_depr_attr: true
|
2021-04-05 15:19:13 +02:00
|
|
|
state: both_x_a
|
|
|
|
register: state5
|
|
|
|
|
2021-11-30 07:10:48 +01:00
|
|
|
- ansible.builtin.set_fact:
|
|
|
|
vardict_gt29:
|
|
|
|
msg: >-
|
|
|
|
ModuleHelper.VarDict attribute is deprecated, use VarDict from the
|
|
|
|
ansible_collections.community.general.plugins.module_utils.mh.mixins.vars
|
|
|
|
module instead
|
|
|
|
version: 6.0.0
|
|
|
|
collection_name: community.general
|
|
|
|
vardict_29:
|
|
|
|
msg: >-
|
|
|
|
ModuleHelper.VarDict attribute is deprecated, use VarDict from the
|
|
|
|
ansible_collections.community.general.plugins.module_utils.mh.mixins.vars
|
|
|
|
module instead
|
|
|
|
version: 6.0.0
|
|
|
|
|
2021-04-05 15:19:13 +02:00
|
|
|
- name: assert state5
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- state5.a == 5
|
|
|
|
- state5.b == "foo"
|
|
|
|
- state5.c == "bar"
|
|
|
|
- state5.result == "foobarfoobarfoobarfoobarfoobar"
|
2021-07-16 19:29:00 +02:00
|
|
|
- state5 is changed
|
2021-11-30 07:10:48 +01:00
|
|
|
- vardict_depr in state5.deprecations
|
|
|
|
vars:
|
|
|
|
vardict_depr: '{{ (ansible_version.major == 2 and ansible_version.minor == 9) | ternary(vardict_29, vardict_gt29) }}'
|