mirror of
https://github.com/zahodi/ansible-mikrotik.git
synced 2025-08-18 16:28:20 +02:00
add check mode to snmp module
This commit is contained in:
parent
1326fad5c1
commit
debe4f35d2
2 changed files with 84 additions and 64 deletions
|
@ -71,7 +71,8 @@ def main():
|
||||||
choices = ['present', 'absent'],
|
choices = ['present', 'absent'],
|
||||||
type = 'str'
|
type = 'str'
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
||||||
idempotent_parameter = None
|
idempotent_parameter = None
|
||||||
|
@ -90,7 +91,7 @@ def main():
|
||||||
desired_params = params['settings'],
|
desired_params = params['settings'],
|
||||||
idempotent_param = idempotent_parameter,
|
idempotent_param = idempotent_parameter,
|
||||||
api_path = '/' + str(params['parameter']),
|
api_path = '/' + str(params['parameter']),
|
||||||
|
check_mode = module.check_mode
|
||||||
)
|
)
|
||||||
|
|
||||||
mt_obj.sync_state()
|
mt_obj.sync_state()
|
||||||
|
@ -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'],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1632,7 +1632,11 @@
|
||||||
settings:
|
settings:
|
||||||
name: to_remove
|
name: to_remove
|
||||||
register: snmp_community_rem
|
register: snmp_community_rem
|
||||||
failed_when: not ( snmp_community_rem | changed )
|
failed_when: (
|
||||||
|
not ansible_check_mode
|
||||||
|
) and (
|
||||||
|
not ( snmp_community_rem | changed )
|
||||||
|
)
|
||||||
|
|
||||||
- name: ALWAYS_CHANGES modify existing snmp community
|
- name: ALWAYS_CHANGES modify existing snmp community
|
||||||
mt_snmp:
|
mt_snmp:
|
||||||
|
@ -1645,7 +1649,11 @@
|
||||||
addresses: "10.0.0.0/8"
|
addresses: "10.0.0.0/8"
|
||||||
name: icghol
|
name: icghol
|
||||||
register: snmp_community
|
register: snmp_community
|
||||||
failed_when: not ( snmp_community | changed )
|
failed_when: (
|
||||||
|
not ansible_check_mode
|
||||||
|
) and (
|
||||||
|
not ( snmp_community | changed )
|
||||||
|
)
|
||||||
|
|
||||||
- name: NEVER_CHANGES check idempotency on snmp community
|
- name: NEVER_CHANGES check idempotency on snmp community
|
||||||
mt_snmp:
|
mt_snmp:
|
||||||
|
@ -1658,7 +1666,11 @@
|
||||||
addresses: "10.0.0.0/8"
|
addresses: "10.0.0.0/8"
|
||||||
name: icghol
|
name: icghol
|
||||||
register: snmp_community_idem
|
register: snmp_community_idem
|
||||||
failed_when: ( snmp_community_idem | changed )
|
failed_when: (
|
||||||
|
not ansible_check_mode
|
||||||
|
) and (
|
||||||
|
( snmp_community_idem | changed )
|
||||||
|
)
|
||||||
|
|
||||||
- name: edit snmp settings
|
- name: edit snmp settings
|
||||||
mt_snmp:
|
mt_snmp:
|
||||||
|
@ -1682,7 +1694,11 @@
|
||||||
trap-community: icghol
|
trap-community: icghol
|
||||||
trap-version: 2
|
trap-version: 2
|
||||||
register: snmp_idem
|
register: snmp_idem
|
||||||
failed_when: ( snmp_community_idem | changed )
|
failed_when: (
|
||||||
|
not ansible_check_mode
|
||||||
|
) and (
|
||||||
|
( snmp_idem | changed )
|
||||||
|
)
|
||||||
|
|
||||||
- name: ALWAYS_CHANGES check editing snmp
|
- name: ALWAYS_CHANGES check editing snmp
|
||||||
mt_snmp:
|
mt_snmp:
|
||||||
|
@ -1695,7 +1711,11 @@
|
||||||
trap-community: icghol
|
trap-community: icghol
|
||||||
trap-version: 3
|
trap-version: 3
|
||||||
register: snmp_edit
|
register: snmp_edit
|
||||||
failed_when: not ( snmp_edit | changed )
|
failed_when: (
|
||||||
|
not ansible_check_mode
|
||||||
|
) and (
|
||||||
|
not ( snmp_edit | changed )
|
||||||
|
)
|
||||||
|
|
||||||
tags: snmp
|
tags: snmp
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue