-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure_network.yml
39 lines (34 loc) · 1.49 KB
/
configure_network.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
---
- name: Playbook to configure Meraki Networks
connection: local
hosts: localhost
vars:
auth_key: "{{ lookup('ansible.builtin.env', 'MERAKI_API_KEY', default=undef()) }}"
pre_tasks:
- name: Validate Webhook Contents
ansible.builtin.assert:
that:
- "{{ tower_webhook_event_type == 'push' }}"
- "{{ tower_webhook_payload.ref == 'refs/heads/main' }}"
fail_msg: "Push Event is not for 'main' branch."
success_msg: "Push branch is 'main'."
register: assert_result
ignore_errors: true
when: tower_webhook_event_type is defined and tower_webhook_payload is defined
- name: Webhook Assert Failed - End the Play
ansible.builtin.meta: end_play
when: assert_result.failed is defined and assert_result.failed
- 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
roles:
- {role: wwt.meraki.manage_meraki_network, when: meraki_networks is defined}
- {role: wwt.meraki.configure_meraki_mx, when: meraki_mx_configuration is defined}
- {role: wwt.meraki.configure_meraki_mr, when: meraki_mr_configuration is defined}
- {role: wwt.meraki.configure_meraki_mt, when: meraki_mt_configuration is defined}
- {role: wwt.meraki.configure_meraki_mv, when: meraki_mt_configuration is defined}