mirror of
https://github.com/zahodi/ansible-mikrotik.git
synced 2025-08-20 01:08:30 +02:00
add check mode to tests.yml
This commit is contained in:
parent
8ddf2e67d9
commit
fcd02f6384
2 changed files with 75 additions and 59 deletions
|
@ -53,7 +53,6 @@ from mt_common import clean_params, MikrotikIdempotent
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec = dict(
|
||||||
|
@ -71,7 +70,8 @@ def main():
|
||||||
choices = ['present', 'absent'],
|
choices = ['present', 'absent'],
|
||||||
type = 'str'
|
type = 'str'
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
||||||
idempotent_parameter = None
|
idempotent_parameter = None
|
||||||
|
@ -90,6 +90,7 @@ def main():
|
||||||
desired_params = params['settings'],
|
desired_params = params['settings'],
|
||||||
idempotent_param = idempotent_parameter,
|
idempotent_param = idempotent_parameter,
|
||||||
api_path = '/tool/' + str(params['parameter']),
|
api_path = '/tool/' + str(params['parameter']),
|
||||||
|
check_mode = module.check_mode
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -113,7 +114,6 @@ def main():
|
||||||
module.exit_json(
|
module.exit_json(
|
||||||
failed=False,
|
failed=False,
|
||||||
changed=False,
|
changed=False,
|
||||||
#msg='',
|
|
||||||
msg=params['settings'],
|
msg=params['settings'],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1515,7 +1515,11 @@
|
||||||
address: 192.168.1.3
|
address: 192.168.1.3
|
||||||
from: email@localhost.com
|
from: email@localhost.com
|
||||||
register: email_edit
|
register: email_edit
|
||||||
failed_when: not ( email_edit | changed )
|
failed_when: (
|
||||||
|
not ansible_check_mode
|
||||||
|
) and (
|
||||||
|
not ( email_edit | changed )
|
||||||
|
)
|
||||||
|
|
||||||
- name: add netwatch item
|
- name: add netwatch item
|
||||||
mt_tool:
|
mt_tool:
|
||||||
|
@ -1539,7 +1543,11 @@
|
||||||
host: '192.168.10.1'
|
host: '192.168.10.1'
|
||||||
up-script: test
|
up-script: test
|
||||||
register: netwatch_idem
|
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
|
- name: ALWAYS_CHANGES edit netwatch item, change up-script
|
||||||
mt_tool:
|
mt_tool:
|
||||||
|
@ -1552,7 +1560,11 @@
|
||||||
host: '192.168.10.1'
|
host: '192.168.10.1'
|
||||||
up-script: test2
|
up-script: test2
|
||||||
register: netwatch_edit
|
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
|
- name: ALWAYS_CHANGES remove netwatch item
|
||||||
mt_tool:
|
mt_tool:
|
||||||
|
@ -1564,7 +1576,11 @@
|
||||||
settings:
|
settings:
|
||||||
host: '192.168.10.1'
|
host: '192.168.10.1'
|
||||||
register: netwatch_rem
|
register: netwatch_rem
|
||||||
failed_when: not ( netwatch_rem | changed )
|
failed_when: (
|
||||||
|
not ansible_check_mode
|
||||||
|
) and (
|
||||||
|
not ( netwatch_rem | changed )
|
||||||
|
)
|
||||||
|
|
||||||
tags: tool
|
tags: tool
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue