add check mode to snmp module

This commit is contained in:
Valentin Gurmeza 2017-06-05 12:44:19 -07:00
parent 1326fad5c1
commit debe4f35d2
2 changed files with 84 additions and 64 deletions

View file

@ -71,7 +71,8 @@ def main():
choices = ['present', 'absent'],
type = 'str'
),
)
),
supports_check_mode=True
)
idempotent_parameter = None
@ -90,7 +91,7 @@ def main():
desired_params = params['settings'],
idempotent_param = idempotent_parameter,
api_path = '/' + str(params['parameter']),
check_mode = module.check_mode
)
mt_obj.sync_state()
@ -113,7 +114,6 @@ def main():
module.exit_json(
failed=False,
changed=False,
#msg='',
msg=params['settings'],
)

View file

@ -1632,7 +1632,11 @@
settings:
name: to_remove
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
mt_snmp:
@ -1645,7 +1649,11 @@
addresses: "10.0.0.0/8"
name: icghol
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
mt_snmp:
@ -1658,7 +1666,11 @@
addresses: "10.0.0.0/8"
name: icghol
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
mt_snmp:
@ -1682,7 +1694,11 @@
trap-community: icghol
trap-version: 2
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
mt_snmp:
@ -1695,7 +1711,11 @@
trap-community: icghol
trap-version: 3
register: snmp_edit
failed_when: not ( snmp_edit | changed )
failed_when: (
not ansible_check_mode
) and (
not ( snmp_edit | changed )
)
tags: snmp