add check mode to tests.yml

This commit is contained in:
Valentin Gurmeza 2017-06-05 12:22:26 -07:00
parent 8ddf2e67d9
commit fcd02f6384
2 changed files with 75 additions and 59 deletions

View file

@ -53,7 +53,6 @@ from mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.basic import AnsibleModule
def main():
module = AnsibleModule(
argument_spec = dict(
@ -71,7 +70,8 @@ def main():
choices = ['present', 'absent'],
type = 'str'
),
)
),
supports_check_mode=True
)
idempotent_parameter = None
@ -90,6 +90,7 @@ def main():
desired_params = params['settings'],
idempotent_param = idempotent_parameter,
api_path = '/tool/' + str(params['parameter']),
check_mode = module.check_mode
)
@ -113,7 +114,6 @@ def main():
module.exit_json(
failed=False,
changed=False,
#msg='',
msg=params['settings'],
)

View file

@ -1515,7 +1515,11 @@
address: 192.168.1.3
from: email@localhost.com
register: email_edit
failed_when: not ( email_edit | changed )
failed_when: (
not ansible_check_mode
) and (
not ( email_edit | changed )
)
- name: add netwatch item
mt_tool:
@ -1539,7 +1543,11 @@
host: '192.168.10.1'
up-script: test
register: netwatch_idem
failed_when: ( netwatch_idem | changed )
failed_when: (
not ansible_check_mode
) and (
( netwatch_idem | changed )
)
- name: ALWAYS_CHANGES edit netwatch item, change up-script
mt_tool:
@ -1552,7 +1560,11 @@
host: '192.168.10.1'
up-script: test2
register: netwatch_edit
failed_when: not ( netwatch_edit | changed )
failed_when: (
not ansible_check_mode
) and (
not ( netwatch_edit | changed )
)
- name: ALWAYS_CHANGES remove netwatch item
mt_tool:
@ -1564,7 +1576,11 @@
settings:
host: '192.168.10.1'
register: netwatch_rem
failed_when: not ( netwatch_rem | changed )
failed_when: (
not ansible_check_mode
) and (
not ( netwatch_rem | changed )
)
tags: tool