-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathzoning_act.yml
73 lines (62 loc) · 2.25 KB
/
zoning_act.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
---
# 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)
# This playbook is an example of how to use zoning_to_xml.py
# to generate a yml file that contains exising defined zone
# db. After saving the output of the script to a file, the
# file now contains the variables that can be referenced
# by tasks defined below:
#
# example:
# note: zoning_to_xml.py requires PyFOS to be installed first.
# Details on how to install PyFOS is available under
# github.com/brocade/pyfos
#
# bash prompt> ./zoning_to_xml.py -i xxx -L admin -P yyy > zonedb.yml
# note: output file name, zonedb.yml in this example, should match
# the file being included in zoning_act.yml playbook under vars_files.
# The resulting file contains the variables "aliaes", "zones",
# and "cfgs" that are being used by tasks within zoning_act.yml
#
# bash prompt> ansible-playbook -i ../san-inventory zoning_act.yml
# note: this play will apply the zone database catpured in zonedb.yml.
# However, active_cfg variable is not captured by the script.
# So, zoning_act.yml playbook needs to be updated to set the
# active_cfg to be the correct enabled cfg name.
- 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}}"
vars_files:
zonedb.yml
tasks:
- name: Create aliases
brocade_zoning_alias:
credential: "{{credential}}"
vfid: -1
aliases: "{{aliases}}"
# aliases_to_delete: "{{aliases_to_delete}}"
- name: Create zones
brocade_zoning_zone:
credential: "{{credential}}"
vfid: -1
zones: "{{zones}}"
# zones_to_delete: "{{zones_to_delete}}"
- name: Create cfgs
brocade_zoning_cfg:
credential: "{{credential}}"
vfid: -1
cfgs: "{{cfgs}}"
# cfgs_to_delete: "{{cfgs_to_delete}}"
active_cfg: newcfg2
- name: Default zoning
brocade_zoning_default_zone:
credential: "{{credential}}"
vfid: -1
default_zone_access: allaccess