diff --git a/changelogs/fragments/meraki_static_route_api_calls.yml b/changelogs/fragments/meraki_static_route_api_calls.yml new file mode 100644 index 0000000000..b8f2996480 --- /dev/null +++ b/changelogs/fragments/meraki_static_route_api_calls.yml @@ -0,0 +1,3 @@ +--- +bugfixes: +- "meraki_static_route - Module would make unnecessary API calls to Meraki when ``net_id`` is specified in task." diff --git a/lib/ansible/modules/network/meraki/meraki_static_route.py b/lib/ansible/modules/network/meraki/meraki_static_route.py index 2a9c5af221..304eaa16d5 100644 --- a/lib/ansible/modules/network/meraki/meraki_static_route.py +++ b/lib/ansible/modules/network/meraki/meraki_static_route.py @@ -328,9 +328,9 @@ def main(): org_id = meraki.params['org_id'] if not org_id: org_id = meraki.get_org_id(meraki.params['org_name']) - nets = meraki.get_nets(org_id=org_id) net_id = meraki.params['net_id'] if net_id is None: + nets = meraki.get_nets(org_id=org_id) net_id = meraki.get_net_id(net_name=meraki.params['net_name'], data=nets) if meraki.params['state'] == 'query':