Debian Codegraph @

ansible_collections/ibm/storage_virtualize/playbooks/cisco_fc_zoning/README.md

raw symbols SCIP
1 # Automation of Fibre Channel Zoning for Cisco Switches
2
3
4 ## Table of Contents
5
6 - [Objective](#objective)
7 - [Prerequisites](#prerequisites)
8 - [Variables](#variables)
9 - [Playbook Overview](#playbook-overview)
10 - [Sample Playbook Usage](#sample-playbook-usage)
11 - [Authors](#authors)
12
13 ## Objective
14
15 Automate and synchronize Fibre Channel zoning on Cisco SAN switches using zone data defined under `lshostzone` on IBM FlashSystem clusters.
16
17 ## Prerequisites
18
19 - Controller Requirements:
20 - Python version 3.10 or later.
21 - Install **Ansible** (*v2.16* or later)
22 - Install **IBM Storage Virtualize Ansible Collection**:
23 ```bash
24 ansible-galaxy collection install ibm.storage_virtualize
25 ```
26 - Install **Cisco NX-OS Ansible Collection**:
27 ```bash
28 ansible-galaxy collection install cisco.nxos
29 ```
30 - Install Python dependency: **ansible-pylibssh**:
31 ```bash
32 pip install ansible-pylibssh
33 ```
34 - IBM FlashSystem (*v9.1.2* or later)
35
36 - Switch Requirements:
37 - Cisco MDS switch running NX-OS
38 - NX-OS version 8.4(1) or later
39
40 ## Variables
41
42 - **inventory.ini** - Defines the FlashSystem clusters and Cisco switches managed by the playbook.
43 ```ini
44 ; Inventory File - inventory.ini
45 [clusters]
46 cluster1 ansible_host=x.x.x.x ansible_user=username ansible_password=password
47 cluster2 ansible_host=x.x.x.x ansible_user=username ansible_password=password
48
49 [switches]
50 switch1 ansible_host=x.x.x.x ansible_user=username ansible_password=password
51 switch2 ansible_host=x.x.x.x ansible_user=username ansible_password=password
52 ```
53
54 ## Playbook Overview
55
56 The automation consists of two playbooks:
57
58 ### 1. main.yaml:
59 - Entry point for execution.
60 - Run using:
61 ```bash
62 ansible-playbook main.yaml -i inventory.ini
63 ```
64 - Target group: **clusters**
65 - Collects all required data from the clusters.
66 - Invokes **cisco_zone_sync.yaml** to apply zoning on the switches
67
68 ### 2. cisco_zone_sync.yaml:
69 - Target group: **switches**
70 - Generates zone configurations based on the collected cluster data.
71 - Pushes the generated zone configurations to the Cisco switches.
72
73 ## Sample Playbook Usage
74 - On the FlashSystem cluster, create an FC portset with auto-zoning enabled:
75 ```yaml
76 - name: Create a portset
77 ibm.storage_virtualize.ibm_svctask_command:
78 command: "svctask mkportset -name {{ portset_name }} -porttype fc -autozoneenabled yes"
79 clustername: "{{ clustername }}"
80 username: "{{ username }}"
81 password: "{{ password }}"
82 ```
83 - Associate FlashSystem Fibre Channel I/O port ID that will be used for host connectivity to this portset.
84 ```yaml
85 - name: Add port ID to the portset
86 ibm.storage_virtualize.ibm_svctask_command:
87 command: "svctask addfcportsetmember -portset {{ portset_name }} -fcioportid {{ fcioportid }} -ignoreautozoneincapable"
88 clustername: "{{ clustername }}"
89 username: "{{ username }}"
90 password: "{{ password }}"
91 ```
92 > [!NOTE]
93 > Ensure the `ignoreautozoneincapable` flag is used when adding ports.
94 - Map this portset to the host object.
95 ```yaml
96 - name: Create a host and map to portset
97 ibm.storage_virtualize.ibm_svctask_command:
98 command: "svctask mkhost -fcwwpn {{ fcwwpn }} -portset {{ portset_name }}"
99 clustername: "{{ clustername }}"
100 username: "{{ username }}"
101 password: "{{ password }}"
102 ```
103 - On the controller, navigate to the playbook directory and update `inventory.ini` with the FlashSystem and Cisco switch credentials.
104 - Run the playbook:
105 ```bash
106 ansible-playbook main.yaml -i inventory.ini
107 ```
108 - The playbook creates Fibre Channel zones based on the configuration reported by the `lshostzone` command on the FlashSystem.
109 - If the configuration changes, rerun the playbook to synchronize the zones with the updated configuration.
110
111 ## Authors
112
113 - Om Dhumal ([email protected])
114 - Pravin Mahajan ([email protected])