-
Notifications
You must be signed in to change notification settings - Fork 0
/
unconfigure_demo.yml
40 lines (34 loc) · 1.23 KB
/
unconfigure_demo.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
- name: Playbook to tear down the demo environment
connection: local
hosts: localhost
vars:
auth_key: "{{ lookup('ansible.builtin.env', 'MERAKI_API_KEY', default=undef()) }}"
pre_tasks:
- name: Include vars from meraki_configs directory
ansible.builtin.include_vars:
dir: ./meraki_configs
extensions: ["yml"]
- name: Check for Meraki API Key
ansible.builtin.fail:
msg: "auth_key is undefined"
when: not auth_key is defined
tasks:
- name: Look Up Meraki MX Appliance Network ID
ansible.builtin.set_fact:
network_id: "{{ lookup('wwt.meraki.fetch',
'network_id',
org_name=meraki_mt_configuration.network.organization,
meraki_api_key=auth_key,
network_name=meraki_mt_configuration.network.name) }}"
- name: Failure - Network DOES NOT exist
ansible.builtin.fail:
msg: Meraki Network is not provisioned
when: network_id is not defined
- name: Disable MQTT on MT Network
ansible.builtin.include_tasks: remove_mqtt.yml
- name: Remove Meraki Network and Devices
ansible.builtin.include_tasks: remove_network.yml
loop: "{{ meraki_networks }}"
loop_control:
loop_var: network