|
|
|
@ -46,7 +46,7 @@ options:
|
|
|
|
state:
|
|
|
|
state:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- States that a policy should be created or modified.
|
|
|
|
- States that a policy should be created or modified.
|
|
|
|
choices: [present]
|
|
|
|
choices: [present, query]
|
|
|
|
default: present
|
|
|
|
default: present
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
allowed_urls:
|
|
|
|
allowed_urls:
|
|
|
|
@ -67,7 +67,12 @@ options:
|
|
|
|
- Determines whether a network filters fo rall URLs in a category or only the list of top blocked sites.
|
|
|
|
- Determines whether a network filters fo rall URLs in a category or only the list of top blocked sites.
|
|
|
|
choices: [ top sites, full list ]
|
|
|
|
choices: [ top sites, full list ]
|
|
|
|
type: str
|
|
|
|
type: str
|
|
|
|
|
|
|
|
subset:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Display only certain facts.
|
|
|
|
|
|
|
|
choices: [categories, policy]
|
|
|
|
|
|
|
|
type: str
|
|
|
|
|
|
|
|
version_added: '2.9'
|
|
|
|
author:
|
|
|
|
author:
|
|
|
|
- Kevin Breit (@kbreit)
|
|
|
|
- Kevin Breit (@kbreit)
|
|
|
|
extends_documentation_fragment: meraki
|
|
|
|
extends_documentation_fragment: meraki
|
|
|
|
@ -140,11 +145,12 @@ def main():
|
|
|
|
argument_spec.update(
|
|
|
|
argument_spec.update(
|
|
|
|
net_id=dict(type='str'),
|
|
|
|
net_id=dict(type='str'),
|
|
|
|
net_name=dict(type='str', aliases=['network']),
|
|
|
|
net_name=dict(type='str', aliases=['network']),
|
|
|
|
state=dict(type='str', default='present', choices=['present']),
|
|
|
|
state=dict(type='str', default='present', choices=['present', 'query']),
|
|
|
|
allowed_urls=dict(type='list'),
|
|
|
|
allowed_urls=dict(type='list'),
|
|
|
|
blocked_urls=dict(type='list'),
|
|
|
|
blocked_urls=dict(type='list'),
|
|
|
|
blocked_categories=dict(type='list'),
|
|
|
|
blocked_categories=dict(type='list'),
|
|
|
|
category_list_size=dict(type='str', choices=['top sites', 'full list']),
|
|
|
|
category_list_size=dict(type='str', choices=['top sites', 'full list']),
|
|
|
|
|
|
|
|
subset=dict(type='str', choices=['categories', 'policy']),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# the AnsibleModule object will be our abstraction working with Ansible
|
|
|
|
# the AnsibleModule object will be our abstraction working with Ansible
|
|
|
|
@ -178,6 +184,22 @@ def main():
|
|
|
|
nets = meraki.get_nets(org_id=org_id)
|
|
|
|
nets = meraki.get_nets(org_id=org_id)
|
|
|
|
net_id = meraki.get_net_id(org_id, meraki.params['net_name'], data=nets)
|
|
|
|
net_id = meraki.get_net_id(org_id, meraki.params['net_name'], data=nets)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if meraki.params['state'] == 'query':
|
|
|
|
|
|
|
|
if meraki.params['subset']:
|
|
|
|
|
|
|
|
if meraki.params['subset'] == 'categories':
|
|
|
|
|
|
|
|
path = meraki.construct_path('categories', net_id=net_id)
|
|
|
|
|
|
|
|
elif meraki.params['subset'] == 'policy':
|
|
|
|
|
|
|
|
path = meraki.construct_path('policy', net_id=net_id)
|
|
|
|
|
|
|
|
meraki.result['data'] = meraki.request(path, method='GET')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
response_data = {'categories': None,
|
|
|
|
|
|
|
|
'policy': None,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
path = meraki.construct_path('categories', net_id=net_id)
|
|
|
|
|
|
|
|
response_data['categories'] = meraki.request(path, method='GET')
|
|
|
|
|
|
|
|
path = meraki.construct_path('policy', net_id=net_id)
|
|
|
|
|
|
|
|
response_data['policy'] = meraki.request(path, method='GET')
|
|
|
|
|
|
|
|
meraki.result['data'] = response_data
|
|
|
|
if module.params['state'] == 'present':
|
|
|
|
if module.params['state'] == 'present':
|
|
|
|
payload = dict()
|
|
|
|
payload = dict()
|
|
|
|
if meraki.params['allowed_urls']:
|
|
|
|
if meraki.params['allowed_urls']:
|
|
|
|
|