-
Notifications
You must be signed in to change notification settings - Fork 33
/
maps_rule_policy.yml
88 lines (78 loc) · 2.17 KB
/
maps_rule_policy.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
# Copyright 2019 Broadcom. All rights reserved.
# The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries.
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
- hosts: san_eng_zone_seed_san_a
gather_facts: False
vars:
credential:
fos_ip_addr: "{{fos_ip_addr}}"
fos_user_name: "{{fos_user_name}}"
fos_password: "{{fos_password}}"
https: "{{fos_https}}"
policyname: my_policy
rule1: my_rule1
rule2: my_rule2
myrule:
- name: "{{rule1}}"
actions:
action:
- "raslog"
event_severity: null
group_name: "ALL_E_PORTS"
is_rule_on_rule: False
logical_operator: "g"
monitoring_system: "C3TXTO"
quiet_time: 0
threshold_value: 1
time_base: "Min"
- name: "{{rule2}}"
actions:
action:
- "raslog"
event_severity: null
group_name: "ALL_E_PORTS"
is_rule_on_rule: False
logical_operator: "g"
monitoring_system: "C3TXTO"
quiet_time: 0
threshold_value: 1
time_base: "Min"
mypolicy:
- name: "{{policyname}}"
is_active_policy: True
rule_list:
rule:
- "{{rule1}}"
- "{{rule2}}"
tasks:
- name: check to see if rules are being changed
brocade_maps_rule:
credential: "{{credential}}"
vfid: -1
rules: "{{myrule}}"
check_mode: yes
register: rules_changed
# - debug: var=rules_changed
- debug: var=rules_changed.remain_brocade_maps_rule
- name: activate a dummy policy with empty list of rules
brocade_maps_maps_policy:
credential: "{{credential}}"
vfid: -1
maps_policies:
- name: dummy_policy
is_active_policy: True
rule_list:
rule: "{{rules_changed.remain_brocade_maps_rule}}"
when: rules_changed.changed
- name: create my rules
brocade_maps_rule:
credential: "{{credential}}"
vfid: -1
rules: "{{myrule}}"
- name: create my policy
brocade_maps_maps_policy:
credential: "{{credential}}"
vfid: -1
maps_policies: "{{mypolicy}}"