├── .gitattributes ├── .gitignore ├── CHANGELOG.rst ├── CONTRIBUTING.rst ├── README.rst ├── ag_disable.yml ├── ag_enable.yml ├── ag_n_port_settings.yml ├── ag_policy.yml ├── ag_port_config_load_bal_off.yml ├── ag_port_config_load_bal_on.yml ├── ansible.cfg ├── cert_install.yml ├── configdownload.yml ├── configupload.yml ├── csr_gen_export.yml ├── docs ├── .gitignore ├── Makefile ├── conf.py ├── documentation.rst ├── fos-ansible.rst.j2 ├── index.rst └── requirements.txt ├── facts.yml ├── facts_ag.yml ├── facts_ips.yml ├── facts_ldap.yml ├── facts_logical_switch.yml ├── facts_maps.yml ├── facts_relay_server.yml ├── facts_sec_crypto_cfg_template.yml ├── facts_security_certificate.yml ├── facts_snmp.yml ├── facts_sshutil_public_key.yml ├── find_fc_by_name.yml ├── find_ns_by_pid.yml ├── find_ns_by_ptype.yml ├── find_ns_by_pwwn.yml ├── firmwaredownload.yml ├── ips.yml ├── ips_create.yml ├── ips_delete.yml ├── ipsdb.yml ├── ldap_role_map.yml ├── ldap_server.yml ├── library ├── brocade_access_gateway_n_port_map.py ├── brocade_access_gateway_n_port_settings.py ├── brocade_access_gateway_policy.py ├── brocade_access_gateway_port_group.py ├── brocade_chassis.py ├── brocade_fabric_switch_facts_by_pid.py ├── brocade_facts.py ├── brocade_fibrechannel_configuration_fabric.py ├── brocade_fibrechannel_configuration_port_configuration.py ├── brocade_fibrechannel_logical_switch_fibrechannel_logical_switch.py ├── brocade_fibrechannel_switch.py ├── brocade_interface_fibrechannel.py ├── brocade_ips_facts.py ├── brocade_list_obj.py ├── brocade_list_obj_facts.py ├── brocade_list_operation.py ├── brocade_logging_audit.py ├── brocade_logging_syslog_server.py ├── brocade_maps_maps_config.py ├── brocade_maps_maps_policy.py ├── brocade_maps_rule.py ├── brocade_module_compatibility.py ├── brocade_operation.py ├── brocade_operation_firmwaredownload.py ├── brocade_operation_show_status.py ├── brocade_operation_supportsave.py ├── brocade_scalar_operation.py ├── brocade_security_ipfilter_policy.py ├── brocade_security_ipfilter_rule.py ├── brocade_security_ldap_role_map.py ├── brocade_security_password.py ├── brocade_security_sec_crypto_cfg_template_action.py ├── brocade_security_security_certificate_action.py ├── brocade_security_security_certificate_generate.py ├── brocade_security_sshutil_public_key.py ├── brocade_security_sshutil_public_key_action.py ├── brocade_security_user_config.py ├── brocade_singleton_obj.py ├── brocade_singleton_obj_facts.py ├── brocade_snmp_system.py ├── brocade_snmp_v1_account.py ├── brocade_snmp_v1_trap.py ├── brocade_snmp_v3_account.py ├── brocade_snmp_v3_trap.py ├── brocade_time_clock_server.py ├── brocade_time_time_zone.py ├── brocade_zoning_alias.py ├── brocade_zoning_alias_facts_by_wwn.py ├── brocade_zoning_cfg.py ├── brocade_zoning_cfg_disable.py ├── brocade_zoning_copy.py ├── brocade_zoning_default_zone.py └── brocade_zoning_zone.py ├── logical_switch.yml ├── maps_policy.yml ├── maps_policy_delete.yml ├── maps_rule.yml ├── maps_rule_policy.yml ├── module_compatibility.yml ├── password.yml ├── portname.yml ├── relay_server.yml ├── san-inventory ├── sec_crypto_cfg_template_apply.yml ├── sec_crypto_cfg_template_export.yml ├── sec_crypto_cfg_template_import.yml ├── showstatus.yml ├── snmp.yml ├── snmp_access_control.yml ├── snmp_reset.yml ├── sshutil_public_key_delete.yml ├── sshutil_public_key_import.yml ├── supportsave.yml ├── switch_change_all.yml ├── switch_initial_config.yml ├── tasks └── zoning_to_yml.py ├── template_facts.yml ├── template_facts_all.yml ├── template_switch_change_all.yml ├── template_switch_initial_config.yml ├── test_version_matrix.rst ├── utils ├── brocade_access_gateway.py ├── brocade_chassis.py ├── brocade_connection.py ├── brocade_fibrechannel_configuration.py ├── brocade_fibrechannel_switch.py ├── brocade_interface.py ├── brocade_objects.py ├── brocade_security.py ├── brocade_snmp.py ├── brocade_ssh.py ├── brocade_url.py ├── brocade_xml.py ├── brocade_yang.py └── brocade_zoning.py ├── zonedb.yml ├── zoning_act.yml ├── zoning_cfg_disable.yml ├── zoning_copy.yml ├── zoning_migrate.yml ├── zoning_zone.yml ├── zoning_zone_add.yml ├── zoning_zone_add_remove.yml ├── zoning_zone_delete.yml ├── zoning_zone_members_add_only.yml ├── zoning_zone_members_remove_only.yml └── zoning_zone_remove.yml /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # directories 2 | .idea 3 | # force add directories 4 | 5 | # files 6 | **/*.swp 7 | **/*.pyc 8 | **/*.pickle 9 | 10 | # force add files 11 | !README.rst 12 | !CONTRIBUTING.rst 13 | !test_version_matrix.rst 14 | -------------------------------------------------------------------------------- /CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | FOS-Ansible Changelog 2 | ===================== 3 | 4 | FOS-Ansible Changelog captures the modifications that are done in the specific FOS Ansible release. 5 | 6 | FOS-Ansible 2.0.0 release 7 | ------------------------- 8 | - Unified Storage Fabric (USF) functionality is supported 9 | This includes VRF create, delete, and dhcpConfig 10 | VLAN create, delete, interfaceAdd, interfaceRemove, and gatewayConfig 11 | ARP create, and delete 12 | Interface config, and default 13 | StaticRoute create, and delete 14 | Lag create, and delete 15 | TrafficClass create, delete, memberAdd, and memberRemove 16 | 17 | A new module brocade_operation is introduced to support the above functionality 18 | 19 | - Configupload support 20 | - Configdownload support 21 | Configuration upload and download is supported with the help of a new module brocade_scalar_operation 22 | 23 | - shebang is updated from python3 to python to support latest python version 24 | - Documentation is updated in playbook to mention renaming of the telnet_timeout to shell_timeout 25 | - Issue related to some times error is ignored is fixed with throwing proper error to upper layers 26 | - Masked logging of the password mentioned in the credentials of the playbook 27 | - Corrected typo in logical switch playbook by removing syslog 28 | - Tested with Ansible module 10.3.0 (core 2.17.7) running Python 3.11.0 29 | -------------------------------------------------------------------------------- /CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | ============ 2 | Contribution 3 | ============ 4 | 5 | Contributors must sign and submit a CAA before a contribution can be 6 | accepted. Two CAAs are available, one for individual contributions and 7 | one for contributions made on behalf of an entity, e.g., an employer. 8 | Select the appropriate link below to electronically execute a CAA. 9 | 10 | Contributor Assignment Agreement (“CAA”) 11 | ======================================== 12 | 13 | CAA - Individual: 14 | https://na3.docusign.net/Member/PowerFormSigning.aspx?PowerFormId=7af19c0f-ae97-4b56-b950-fc4796860c79 15 | 16 | CAA - Entity: 17 | https://na3.docusign.net/Member/PowerFormSigning.aspx?PowerFormId=f657df18-ed64-4c51-a8f2-618bbd17d355 18 | -------------------------------------------------------------------------------- /ag_disable.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: disable switch before disabling ag mode 22 | brocade_fibrechannel_switch: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | switch: 26 | enabled_state: False 27 | 28 | - name: disable ag mode. switch will reboot afterward. 29 | brocade_fibrechannel_switch: 30 | credential: "{{credential}}" 31 | vfid: -1 32 | switch: 33 | ag_mode: 1 34 | -------------------------------------------------------------------------------- /ag_enable.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: switch disabled 22 | brocade_fibrechannel_switch: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | switch: 26 | enabled_state: False 27 | 28 | - name: ag mode enabled. if changing, switch will reboot afterward. 29 | brocade_fibrechannel_switch: 30 | credential: "{{credential}}" 31 | vfid: -1 32 | switch: 33 | ag_mode: 3 34 | 35 | - name: switch enabled 36 | brocade_fibrechannel_switch: 37 | credential: "{{credential}}" 38 | vfid: -1 39 | switch: 40 | enabled_state: True 41 | -------------------------------------------------------------------------------- /ag_n_port_settings.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | n_port_settings: 19 | reliability_counter: 25 20 | 21 | 22 | tasks: 23 | 24 | - name: ag N-Port settings 25 | brocade_access_gateway_n_port_settings: 26 | credential: "{{credential}}" 27 | vfid: -1 28 | n_port_settings: "{{n_port_settings}}" 29 | -------------------------------------------------------------------------------- /ag_policy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | policy: 19 | auto_policy_enabled: False 20 | port_group_policy_enabled: True 21 | 22 | 23 | tasks: 24 | 25 | - name: ag policy 26 | brocade_access_gateway_policy: 27 | credential: "{{credential}}" 28 | vfid: -1 29 | policy: "{{policy}}" 30 | -------------------------------------------------------------------------------- /ag_port_config_load_bal_off.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | all_port_groups_with_n_ports: 20 | - port_group_id: "0" 21 | port_group_name: "pg0" 22 | - port_group_id: "1" 23 | port_group_name: "pg1" 24 | port_group_n_ports: 25 | n_port: 26 | - "0/44" 27 | - "0/46" 28 | - port_group_id: "2" 29 | port_group_name: "pg2" 30 | port_group_n_ports: 31 | n_port: 32 | - "0/45" 33 | - "0/47" 34 | 35 | all_port_groups_with_mode: 36 | - port_group_id: "0" 37 | port_group_mode: 38 | load_balancing_mode_enabled: "0" 39 | multiple_fabric_name_monitoring_mode_enabled: "0" 40 | - port_group_id: "1" 41 | port_group_mode: 42 | load_balancing_mode_enabled: "0" 43 | multiple_fabric_name_monitoring_mode_enabled: "1" 44 | - port_group_id: "2" 45 | port_group_mode: 46 | load_balancing_mode_enabled: "0" 47 | multiple_fabric_name_monitoring_mode_enabled: "1" 48 | 49 | n_port_map: 50 | - n_port: "0/44" 51 | failback_enabled: "1" 52 | failover_enabled: "1" 53 | n_port_info: null 54 | online_status: "0" 55 | reliable_status: "1" 56 | static_f_port_list: null 57 | configured_f_port_list: 58 | f_port: 59 | - "0/35" 60 | - n_port: "0/45" 61 | failback_enabled: "1" 62 | failover_enabled: "1" 63 | n_port_info: null 64 | online_status: "0" 65 | reliable_status: "1" 66 | static_f_port_list: null 67 | configured_f_port_list: 68 | f_port: 69 | - "0/34" 70 | - n_port: "0/46" 71 | failback_enabled: "1" 72 | failover_enabled: "1" 73 | n_port_info: null 74 | online_status: "0" 75 | reliable_status: "1" 76 | static_f_port_list: null 77 | configured_f_port_list: 78 | f_port: 79 | - "0/37" 80 | - n_port: "0/47" 81 | failback_enabled: "1" 82 | failover_enabled: "1" 83 | n_port_info: null 84 | online_status: "0" 85 | reliable_status: "1" 86 | static_f_port_list: null 87 | configured_f_port_list: 88 | f_port: 89 | - "0/36" 90 | 91 | tasks: 92 | 93 | - name: port group configuration with n-port configuration 94 | brocade_access_gateway_port_group: 95 | credential: "{{credential}}" 96 | vfid: -1 97 | port_groups: "{{all_port_groups_with_n_ports}}" 98 | 99 | - name: port group mode 100 | brocade_access_gateway_port_group: 101 | credential: "{{credential}}" 102 | vfid: -1 103 | port_groups: "{{all_port_groups_with_mode}}" 104 | 105 | - name: n-port map 106 | brocade_access_gateway_n_port_map: 107 | credential: "{{credential}}" 108 | vfid: -1 109 | n_port_map: "{{n_port_map}}" 110 | -------------------------------------------------------------------------------- /ag_port_config_load_bal_on.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | all_port_groups_with_n_ports: 20 | - port_group_id: "0" 21 | port_group_name: "pg0" 22 | - port_group_id: "1" 23 | port_group_name: "pg1" 24 | port_group_n_ports: 25 | n_port: 26 | - "0/44" 27 | - "0/45" 28 | - port_group_id: "2" 29 | port_group_name: "pg2" 30 | port_group_n_ports: 31 | n_port: 32 | - "0/46" 33 | - "0/47" 34 | 35 | all_port_groups_with_mode: 36 | - port_group_id: "0" 37 | port_group_mode: 38 | load_balancing_mode_enabled: "0" 39 | multiple_fabric_name_monitoring_mode_enabled: "0" 40 | - port_group_id: "1" 41 | port_group_mode: 42 | load_balancing_mode_enabled: "1" 43 | multiple_fabric_name_monitoring_mode_enabled: "1" 44 | - port_group_id: "2" 45 | port_group_mode: 46 | load_balancing_mode_enabled: "1" 47 | multiple_fabric_name_monitoring_mode_enabled: "1" 48 | 49 | all_port_groups_with_f_ports: 50 | - port_group_id: "0" 51 | - port_group_id: "1" 52 | port_group_f_ports: 53 | f_port: 54 | - "0/34" 55 | - "0/35" 56 | - port_group_id: "2" 57 | port_group_f_ports: 58 | f_port: 59 | - "0/36" 60 | - "0/37" 61 | 62 | tasks: 63 | 64 | - name: port group configuration with n-port 65 | brocade_access_gateway_port_group: 66 | credential: "{{credential}}" 67 | vfid: -1 68 | port_groups: "{{all_port_groups_with_n_ports}}" 69 | 70 | - name: port group mode 71 | brocade_access_gateway_port_group: 72 | credential: "{{credential}}" 73 | vfid: -1 74 | port_groups: "{{all_port_groups_with_mode}}" 75 | 76 | # pause for 15 seconds to make sure fabric is stable for 77 | # zoning commit 78 | - pause: seconds=15 79 | 80 | - name: port group f-port configuration 81 | brocade_access_gateway_port_group: 82 | credential: "{{credential}}" 83 | vfid: -1 84 | port_groups: "{{all_port_groups_with_f_ports}}" 85 | -------------------------------------------------------------------------------- /ansible.cfg: -------------------------------------------------------------------------------- 1 | # config file for ansible -- https://ansible.com/ 2 | # =============================================== 3 | 4 | # nearly all parameters can be overridden in ansible-playbook 5 | # or with command line flags. ansible will read ANSIBLE_CONFIG, 6 | # ansible.cfg in the current working directory, .ansible.cfg in 7 | # the home directory or /etc/ansible/ansible.cfg, whichever it 8 | # finds first 9 | 10 | [defaults] 11 | 12 | module_utils = utils 13 | interpreter_python = auto 14 | -------------------------------------------------------------------------------- /cert_install.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | action_inputs: 19 | remote_user_name: user_name 20 | remote_host_ip: host_ip 21 | remote_user_password: user_password_in_clear_text 22 | remote_directory: directory_of_cert 23 | protocol: scp 24 | certificate_entity: cert 25 | certificate_type: https 26 | certificate_name: cert_name 27 | operation: import 28 | 29 | tasks: 30 | 31 | - name: Cert installation. Existing cert is not compared. This task will always change. 32 | brocade_security_security_certificate_action: 33 | credential: "{{credential}}" 34 | vfid: -1 35 | action_inputs: "{{action_inputs}}" 36 | -------------------------------------------------------------------------------- /configdownload.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | configdownload: 19 | config_upload_download_option: "virtual-fabric" 20 | config_input_buffer: "copy config_output_buffer value of configupload here" 21 | 22 | 23 | tasks: 24 | 25 | - name: configdownload 26 | brocade_scalar_operation: 27 | credential: "{{credential}}" 28 | module_name: "configdownload" 29 | vfid: -1 30 | entries: "{{configdownload}}" 31 | register: result 32 | 33 | - name: print initial results gathered 34 | debug: 35 | var: result.operation_resp 36 | 37 | - name: pause for few minutes for switch reboot 38 | pause: 39 | minutes: 5 40 | 41 | - name: show status after reboot 42 | brocade_operation_show_status: 43 | credential: "{{credential}}" 44 | vfid: -1 45 | show_status: 46 | message_id: "{{result.operation_resp.show_status.message_id}}" 47 | register: status_result 48 | until: status_result.operation_resp is not defined or status_result.operation_resp.show_status.status == "done" or status_result.operation_resp.show_status.status == "delivered" 49 | retries: 100 50 | delay: 10 51 | 52 | - name: print show_status end result 53 | debug: 54 | var: status_result.operation_resp 55 | -------------------------------------------------------------------------------- /configupload.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | configupload: 19 | config_upload_download_option: "virtual-fabric" 20 | 21 | tasks: 22 | 23 | - name: configupload 24 | brocade_scalar_operation: 25 | credential: "{{credential}}" 26 | module_name: "configupload" 27 | vfid: -1 28 | entries: "{{configupload}}" 29 | register: result 30 | 31 | - name: print results gathered 32 | debug: 33 | var: result.operation_resp 34 | -------------------------------------------------------------------------------- /csr_gen_export.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | generate_inputs: 19 | certificate_entity: csr 20 | certificate_type: https 21 | country_name: US 22 | state_name: CA 23 | locality_name: SJ 24 | organization_name: Broadcom 25 | domain_name: 10.155.107.74 26 | action_inputs: 27 | remote_user_name: user_name 28 | remote_host_ip: host_ip 29 | remote_user_password: password 30 | remote_directory: diretory 31 | protocol: scp 32 | certificate_entity: csr 33 | certificate_type: https 34 | operation: export 35 | 36 | tasks: 37 | 38 | - name: CSR generation. Existing CSR is not compared. This task will always change. 39 | brocade_security_security_certificate_generate: 40 | credential: "{{credential}}" 41 | vfid: -1 42 | generate_inputs: "{{generate_inputs}}" 43 | 44 | 45 | - name: CSR export. Existing CSR is not compared. This task will always change. 46 | brocade_security_security_certificate_action: 47 | credential: "{{credential}}" 48 | vfid: -1 49 | action_inputs: "{{action_inputs}}" 50 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | generated_rst 2 | _build 3 | html 4 | 5 | 6 | !index.rst 7 | 8 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | GENERATED_RST = generated_rst 11 | 12 | # Put it first so that "make" without argument is like "make help". 13 | help: 14 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 15 | 16 | .PHONY: help Makefile 17 | 18 | # Catch-all target: route all unknown targets to Sphinx using the new 19 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 20 | %: Makefile 21 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 22 | 23 | .PHONY: clean 24 | clean: 25 | @echo "Removing everything from $(BUILDDIR) directory..." 26 | rm -rf $(BUILDDIR)/* 27 | @echo "Removing everything from $(GENERATED_RST) directory..." 28 | rm -rf $(GENERATED_RST)/* 29 | 30 | -------------------------------------------------------------------------------- /docs/documentation.rst: -------------------------------------------------------------------------------- 1 | ************* 2 | Documentation 3 | ************* 4 | 5 | To build documentation 6 | 7 | #. Install dependent packages using 8 | 9 | .. code:: 10 | 11 | pip install -r docs/requirements.txt 12 | 13 | #. Trigger a build using the Makefile located under the docs directory 14 | 15 | .. code:: 16 | 17 | cd docs 18 | make html 19 | 20 | .. tip:: 21 | To fail the documentation on warnings with traceback use 22 | 23 | .. code:: 24 | 25 | make SPHINXOPTS=-WT html 26 | 27 | #. Access the documentation by opening the _build/index.html in a web-browser 28 | -------------------------------------------------------------------------------- /docs/fos-ansible.rst.j2: -------------------------------------------------------------------------------- 1 | .. _{{ module }}_module: 2 | 3 | {% if short_description %} 4 | {% set title = module %} 5 | {% else %} 6 | {% set title = module %} 7 | {% endif %} 8 | 9 | {{ title }} 10 | {{ '=' * title|length }} 11 | 12 | {{ short_description }} 13 | 14 | .. contents:: 15 | :local: 16 | :depth: 1 17 | 18 | 19 | {% if description -%} 20 | Synopsis 21 | -------- 22 | 23 | {% for desc in description %} 24 | {{ desc | rst_ify }} 25 | 26 | {% endfor %} 27 | {% endif %} 28 | 29 | 30 | {% if requirements -%} 31 | Requirements 32 | ------------ 33 | The below requirements are needed on the host that executes this module. 34 | 35 | {% for req in requirements %} 36 | - {{ req | rst_ify }} 37 | {% endfor %} 38 | {% endif %} 39 | 40 | 41 | {% macro option_desc(opts, level) %} 42 | {% for name, spec in opts.items() %} 43 | {% set req = spec.required | default("optional") %} 44 | {% set typ = spec.type | default("any") | rst_ify %} 45 | {% set choice = spec.choices | default("none") %} 46 | 47 | {{ " " * level }} **{{ name }}**: {% for para in spec.description %} 48 | {{ " " * level}}{{ para | rst_ify }} 49 | {% endfor %} 50 | 51 | {{ " " * level }} *required: {{ req }}* 52 | 53 | {{ " " * level }} *type: {{ typ }}* 54 | 55 | {% if spec.choices %} 56 | {{ " " * level }} *choices:* 57 | 58 | {% for entry in choice %} 59 | {{ " " * (level + 1) }}{{ '| ' }}*{{ entry }}* 60 | {% endfor %} 61 | {% endif %} 62 | 63 | 64 | {% if spec.suboptions %} 65 | {{ option_desc(spec.suboptions, level + 1) }} 66 | {% endif %} 67 | {% endfor %} 68 | {% endmacro %} 69 | 70 | {% if options -%} 71 | Parameters 72 | ---------- 73 | 74 | {{ option_desc(options, 0) }} 75 | {% endif %} 76 | 77 | 78 | {% if notes -%} 79 | Notes 80 | ----- 81 | 82 | .. note:: 83 | {% for note in notes %} 84 | - {{ note | rst_ify }} 85 | {% endfor %} 86 | {% endif %} 87 | 88 | 89 | {% if seealso -%} 90 | See Also 91 | -------- 92 | 93 | .. seealso:: 94 | 95 | {% for item in seealso %} 96 | {% if item.module is defined and item.description is defined %} 97 | :ref:`{{ item.module }}_module` 98 | {{ item.description | rst_ify }} 99 | {% elif item.module is defined %} 100 | :ref:`{{ item.module }}_module` 101 | The official documentation on the **{{ item.module }}** module. 102 | {% elif item.name is defined and item.link is defined and item.description is defined %} 103 | `{{ item.name }} <{{ item.link }}>`_ 104 | {{ item.description | rst_ify }} 105 | {% elif item.ref is defined and item.description is defined %} 106 | :ref:`{{ item.ref }}` 107 | {{ item.description | rst_ify }} 108 | {% endif %} 109 | {% endfor %} 110 | {% endif %} 111 | 112 | 113 | {% if examples -%} 114 | Examples 115 | -------- 116 | 117 | .. code-block:: yaml+jinja 118 | 119 | {{ examples | indent(4, True) }} 120 | {% endif %} 121 | 122 | {% macro result_desc(results, level) %} 123 | {% for name, spec in results.items() %} 124 | {% set ret = spec.returned %} 125 | {% set typ = spec.type | default("any") %} 126 | {% set sample = spec.sample %} 127 | {{ " " * level }} **{{ name }}**: {% for para in spec.description %} 128 | {{ " " * level }}{{ para | rst_ify }} 129 | {% endfor %} 130 | 131 | *returned: {{ ret }}* 132 | 133 | *type: {{ typ }}* 134 | 135 | {% if spec.contains %} 136 | {{ result_desc(spec.contains, level + 1) }} 137 | {% endif %} 138 | {% endfor %} 139 | {% endmacro %} 140 | 141 | {% if returndocs -%} 142 | Return Values 143 | ------------- 144 | 145 | {{ result_desc(returndocs, 0) }} 146 | {% endif %} 147 | 148 | {% if author is defined -%} 149 | Authors 150 | ~~~~~~~ 151 | 152 | {% for author_name in author %} 153 | - {{ author_name }} 154 | {% endfor %} 155 | 156 | {% endif %} 157 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. ansible_fos documentation master file, created by 2 | sphinx-quickstart on Fri Sep 3 14:45:30 2021. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | ===================================== 7 | Welcome to FOS-ansible documentation! 8 | ===================================== 9 | 10 | .. toctree:: 11 | :maxdepth: 1 12 | :caption: Contents 13 | 14 | generated_rst/README 15 | generated_rst/modules/modules 16 | generated_rst/test_version_matrix 17 | documentation 18 | generated_rst/CONTRIBUTING 19 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | ansible==4.5.0 2 | ansible-doc-extractor==0.1.7 3 | sphinx==4.1.2 4 | sphinx-rtd-theme==1.0.0 5 | 6 | -------------------------------------------------------------------------------- /facts.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: gather facts 22 | brocade_facts: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | gather_subset: 26 | - brocade_zoning 27 | - brocade_interface_fibrechannel 28 | - brocade_chassis_chassis 29 | - brocade_fabric_fabric_switch 30 | - brocade_fibrechannel_configuration_fabric 31 | - brocade_fibrechannel_configuration_port_configuration 32 | - brocade_fibrechannel_switch 33 | - brocade_fibrechannel_trunk_trunk 34 | - brocade_fibrechannel_trunk_performance 35 | - brocade_fibrechannel_trunk_trunk_area 36 | - brocade_time_clock_server 37 | - brocade_time_time_zone 38 | - brocade_logging_syslog_server 39 | - brocade_logging_audit 40 | - brocade_media_media_rdp 41 | - brocade_snmp_system 42 | - brocade_security_ipfilter_rule 43 | - brocade_security_ipfilter_policy 44 | - brocade_security_user_config 45 | - brocade_security_password_cfg 46 | - brocade_snmp_v1_account 47 | - brocade_snmp_v1_trap 48 | - brocade_snmp_v3_account 49 | - brocade_snmp_v3_trap 50 | - brocade_maps_maps_config 51 | - brocade_security_sec_crypto_cfg_template_action 52 | - brocade_security_sshutil_public_key 53 | - brocade_security_ldap_role_map 54 | 55 | - name: print ansible_facts gathered 56 | debug: 57 | var: ansible_facts 58 | -------------------------------------------------------------------------------- /facts_ag.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: gather facts 22 | brocade_facts: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | gather_subset: 26 | - brocade_access_gateway_port_group 27 | - brocade_access_gateway_n_port_map 28 | - brocade_access_gateway_f_port_list 29 | - brocade_access_gateway_device_list 30 | - brocade_access_gateway_policy 31 | - brocade_access_gateway_n_port_settings 32 | 33 | - name: print ansible_facts gathered 34 | debug: 35 | var: ansible_facts 36 | -------------------------------------------------------------------------------- /facts_ips.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: gather facts 22 | brocade_ips_facts: 23 | credential: "{{credential}}" 24 | vfid: "{{ips_fid}}" 25 | gather_subset: 26 | - vrf 27 | - vlan 28 | - staticArp 29 | - staticRoute 30 | - lag 31 | - configuration 32 | - interface 33 | - arpTable 34 | - routeTable 35 | 36 | - name: print gathered ips ansible_facts 37 | debug: 38 | var: ansible_facts 39 | -------------------------------------------------------------------------------- /facts_ldap.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: gather facts for brocade_fibrechannel_switch_fibrechannel_switch 22 | brocade_list_obj_facts: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | module_name: "brocade_security" 26 | list_name: "ldap_role_map" 27 | 28 | - name: print ansible_facts gathered 29 | debug: 30 | var: ansible_facts 31 | -------------------------------------------------------------------------------- /facts_logical_switch.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: gather facts for brocade_fibrechannel_switch_fibrechannel_switch 22 | brocade_list_obj_facts: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | module_name: "brocade_fibrechannel_logical_switch" 26 | list_name: "fibrechannel_logical_switch" 27 | 28 | - name: print ansible_facts gathered 29 | debug: 30 | var: ansible_facts 31 | -------------------------------------------------------------------------------- /facts_maps.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: gather facts for brocade_maps 22 | brocade_list_obj_facts: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | module_name: "brocade_maps" 26 | list_name: "maps_policy" 27 | 28 | - name: gather facts for brocade_maps 29 | brocade_list_obj_facts: 30 | credential: "{{credential}}" 31 | vfid: -1 32 | module_name: "brocade_maps" 33 | list_name: "rule" 34 | 35 | - name: print ansible_facts gathered 36 | debug: 37 | var: ansible_facts 38 | -------------------------------------------------------------------------------- /facts_relay_server.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: relay server 22 | brocade_singleton_obj_facts: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | module_name: "brocade-maps" 26 | obj_name: "maps-config" 27 | 28 | - name: print accumulative ansible_facts gathered 29 | debug: 30 | var: ansible_facts 31 | 32 | -------------------------------------------------------------------------------- /facts_sec_crypto_cfg_template.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: gather facts 22 | brocade_facts: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | gather_subset: 26 | - brocade_security_sec_crypto_cfg_template 27 | 28 | - name: print ansible_facts gathered 29 | debug: 30 | var: ansible_facts 31 | -------------------------------------------------------------------------------- /facts_security_certificate.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: gather facts 22 | brocade_facts: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | gather_subset: 26 | - brocade_security_security_certificate 27 | 28 | - name: print ansible_facts gathered 29 | debug: 30 | var: ansible_facts 31 | -------------------------------------------------------------------------------- /facts_snmp.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: snmp system values 22 | brocade_singleton_obj_facts: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | module_name: "brocade-snmp" 26 | obj_name: "system" 27 | 28 | - name: gather v1 account 29 | brocade_list_obj_facts: 30 | credential: "{{credential}}" 31 | vfid: -1 32 | module_name: "brocade-snmp" 33 | list_name: "v1-account" 34 | 35 | - name: gather v1 traps 36 | brocade_list_obj_facts: 37 | credential: "{{credential}}" 38 | vfid: -1 39 | module_name: "brocade-snmp" 40 | list_name: "v1-trap" 41 | 42 | - name: gather v3 account 43 | brocade_list_obj_facts: 44 | credential: "{{credential}}" 45 | vfid: -1 46 | module_name: "brocade-snmp" 47 | list_name: "v3-account" 48 | 49 | - name: gather v3 traps 50 | brocade_list_obj_facts: 51 | credential: "{{credential}}" 52 | vfid: -1 53 | module_name: "brocade-snmp" 54 | list_name: "v3-trap" 55 | 56 | - name: print accumulative ansible_facts gathered 57 | debug: 58 | var: ansible_facts 59 | 60 | -------------------------------------------------------------------------------- /facts_sshutil_public_key.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: gather facts 22 | brocade_facts: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | gather_subset: 26 | - brocade_security_sshutil_public_key 27 | 28 | - name: print ansible_facts gathered 29 | debug: 30 | var: ansible_facts 31 | -------------------------------------------------------------------------------- /find_fc_by_name.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | name_to_search: "0/0" 19 | 20 | tasks: 21 | 22 | - name: gather facts 23 | brocade_list_obj_facts: 24 | credential: "{{credential}}" 25 | vfid: -1 26 | module_name: "brocade-interface" 27 | list_name: "fibrechannel" 28 | attributes: 29 | name: "{{name_to_search}}" 30 | 31 | - name: print ansible_facts gathered 32 | debug: 33 | var: ansible_facts 34 | -------------------------------------------------------------------------------- /find_ns_by_pid.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | pid_to_search: "0x010b00" 19 | 20 | tasks: 21 | 22 | - name: gather facts 23 | brocade_list_obj_facts: 24 | credential: "{{credential}}" 25 | vfid: -1 26 | module_name: "brocade-name-server" 27 | list_name: "fibrechannel-name-server" 28 | attributes: 29 | port_id: "{{pid_to_search}}" 30 | 31 | - name: print ansible_facts gathered 32 | debug: 33 | var: ansible_facts 34 | -------------------------------------------------------------------------------- /find_ns_by_ptype.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | port_type_to_search: "n-port" 19 | 20 | tasks: 21 | 22 | - name: gather facts 23 | brocade_list_obj_facts: 24 | credential: "{{credential}}" 25 | vfid: -1 26 | module_name: "brocade-name-server" 27 | list_name: "fibrechannel-name-server" 28 | attributes: 29 | port_type: "{{port_type_to_search}}" 30 | 31 | - name: print ansible_facts gathered 32 | debug: 33 | var: ansible_facts 34 | -------------------------------------------------------------------------------- /find_ns_by_pwwn.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | # This playbook is a reference example complete two operations 10 | # 11 | # 1) find a device in NS to display by matching to Port WWN (port_name) 12 | # 2) find a device in alias in Zoning DB to display by matching WWN 13 | # 14 | # wwn_to_search variable is referenced by both tasks 15 | # 16 | # Each operation is associated with a task to get the data 17 | # and another to display the data. 18 | # 19 | # If the matching Port WWN doesn't exist in the DB, the display task 20 | # will be "skiped". The same is true for alias display task. In other 21 | # word, display task will only show something if a match is found. 22 | # 23 | 24 | - hosts: san_eng_zone_seed_san_a 25 | gather_facts: False 26 | 27 | vars: 28 | credential: 29 | fos_ip_addr: "{{fos_ip_addr}}" 30 | fos_user_name: "{{fos_user_name}}" 31 | fos_password: "{{fos_password}}" 32 | https: "{{fos_https}}" 33 | wwn_to_search: "11:11:11:11:11:11:11:11" 34 | 35 | tasks: 36 | 37 | - name: gather device info 38 | brocade_list_obj_facts: 39 | credential: "{{credential}}" 40 | vfid: -1 41 | module_name: "brocade-name-server" 42 | list_name: "fibrechannel-name-server" 43 | attributes: 44 | port_name: "{{wwn_to_search}}" 45 | 46 | - name: print device information matching port_name 47 | vars: 48 | port_index: "{{ ansible_facts['fibrechannel_name_server'][0]['port_index'] }}" 49 | port_wwn: "{{ ansible_facts['fibrechannel_name_server'][0]['port_name'] }}" 50 | port_speed: "{{ ansible_facts['fibrechannel_name_server'][0]['link_speed'] }}" 51 | debug: 52 | msg: device with Port WWN of "{{port_wwn}}" is found at Port Indext of "{{ port_index }}". The device's speed is "{{port_speed}}" 53 | when: ansible_facts['fibrechannel_name_server'][0]['port_name'] is defined 54 | 55 | - name: gather device alias info 56 | brocade_zoning_alias_facts_by_wwn: 57 | credential: "{{credential}}" 58 | vfid: -1 59 | wwn: "{{wwn_to_search}}" 60 | 61 | - name: print device alias information matching port_name 62 | debug: 63 | var: ansible_facts['alias'] 64 | when: ansible_facts['alias'] is defined 65 | 66 | - name: find switch with the matching domain id 67 | brocade_fabric_switch_facts_by_pid: 68 | credential: "{{credential}}" 69 | vfid: -1 70 | pid: "{{ ansible_facts['fibrechannel_name_server'][0]['port_id'] }}" 71 | when: ansible_facts['fibrechannel_name_server'][0]['port_name'] is defined 72 | 73 | - name: print switch WWN where the device is connected 74 | vars: 75 | name: "{{ ansible_facts['fabric_switch']['name'] }}" 76 | switch_user_friendly_name: "{{ ansible_facts['fabric_switch']['switch_user_friendly_name'] }}" 77 | debug: 78 | msg: The device's is connected at "{{name}}" "{{switch_user_friendly_name}}" 79 | when: ansible_facts['fibrechannel_name_server'][0]['port_name'] is defined 80 | -------------------------------------------------------------------------------- /firmwaredownload.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | firmwaredownload: 19 | host: "xx.xx.xx.xx" 20 | user_name: "username" 21 | password: "password" 22 | remote_directory: "directory" 23 | protocol: "scp" 24 | eula_action: "accept-eula" 25 | stage: False 26 | 27 | tasks: 28 | 29 | - name: initiate firmwaredownload 30 | brocade_operation_firmwaredownload: 31 | credential: "{{credential}}" 32 | vfid: -1 33 | firmwaredownload: "{{firmwaredownload}}" 34 | register: result 35 | 36 | - name: print firmwaredownload initial status 37 | debug: 38 | var: result.operation_resp 39 | 40 | - name: show status before reboot. If connection refused error is returned during reboot, use showstatus.yml after reboot to view the current status. 41 | brocade_operation_show_status: 42 | credential: "{{credential}}" 43 | vfid: -1 44 | show_status: 45 | message_id: "{{result.operation_resp.show_status.message_id}}" 46 | register: status_result 47 | until: status_result.operation_resp is not defined or status_result.operation_resp.show_status.status == "done" or status_result.operation_resp.show_status.status == "delivered" 48 | retries: 100 49 | delay: 10 50 | 51 | - name: print show_status end result 52 | debug: 53 | var: status_result.operation_resp 54 | 55 | # pause for few minutes to make sure switch has rebooted 56 | - name: pause for few minutes for switch reboot 57 | pause: 58 | minutes: 10 59 | 60 | - name: show status after reboot 61 | brocade_operation_show_status: 62 | credential: "{{credential}}" 63 | vfid: -1 64 | show_status: 65 | message_id: "{{result.operation_resp.show_status.message_id}}" 66 | register: status_result 67 | until: status_result.operation_resp is not defined or status_result.operation_resp.show_status.status == "done" or status_result.operation_resp.show_status.status == "delivered" 68 | retries: 100 69 | delay: 10 70 | 71 | - name: print show_status end result 72 | debug: 73 | var: status_result.operation_resp 74 | -------------------------------------------------------------------------------- /ips.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars_files: 13 | ipsdb.yml 14 | 15 | vars: 16 | credential: 17 | fos_ip_addr: "{{fos_ip_addr}}" 18 | fos_user_name: "{{fos_user_name}}" 19 | fos_password: "{{fos_password}}" 20 | https: "{{fos_https}}" 21 | 22 | 23 | tasks: 24 | 25 | - name: configure all non-default logical switch 26 | brocade_fibrechannel_logical_switch_fibrechannel_logical_switch: 27 | credential: "{{credential}}" 28 | vfid: -1 29 | all_entries: False 30 | logical_switches: "{{logicalswitches}}" 31 | 32 | - name: configure vrf 33 | brocade_operation: 34 | credential: "{{credential}}" 35 | module_name: vrf 36 | vfid: "{{fabric_id}}" 37 | entries: "{{vrfs}}" 38 | 39 | - name: configure vlan 40 | brocade_operation: 41 | credential: "{{credential}}" 42 | module_name: vlan 43 | vfid: "{{fabric_id}}" 44 | entries: "{{vlans}}" 45 | 46 | - name: configure interface 47 | brocade_operation: 48 | credential: "{{credential}}" 49 | module_name: interface 50 | vfid: "{{fabric_id}}" 51 | entries: "{{interfaces}}" 52 | 53 | - name: configure staticArp 54 | brocade_operation: 55 | credential: "{{credential}}" 56 | module_name: staticArp 57 | vfid: "{{fabric_id}}" 58 | entries: "{{staticarps}}" 59 | 60 | - name: configure staticRoute 61 | brocade_operation: 62 | credential: "{{credential}}" 63 | module_name: staticRoute 64 | vfid: "{{fabric_id}}" 65 | entries: "{{staticroutes}}" 66 | 67 | - name: configure lag 68 | brocade_operation: 69 | credential: "{{credential}}" 70 | module_name: lag 71 | vfid: "{{fabric_id}}" 72 | entries: "{{lags}}" 73 | 74 | - name: configure trafclass 75 | brocade_operation: 76 | credential: "{{credential}}" 77 | module_name: configuration 78 | vfid: "{{fabric_id}}" 79 | entries: "{{trafclasses}}" 80 | -------------------------------------------------------------------------------- /ips_create.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | fabric_id: 5 19 | vrfs: 20 | - vrfID: 28 21 | action: create 22 | - vrfID: 29 23 | action: create 24 | - vrfID: 30 25 | action: create 26 | 27 | 28 | tasks: 29 | 30 | - name: ips delete operation 31 | brocade_list_operation: 32 | credential: "{{credential}}" 33 | module_name: vrf 34 | vfid: "{{fabric_id}}" 35 | entries: "{{vrfs}}" 36 | register: result 37 | 38 | - name: print initial results gathered 39 | debug: 40 | var: result.operation_resp 41 | 42 | - name: show status of operation 43 | brocade_operation_show_status: 44 | credential: "{{credential}}" 45 | vfid: "{{fabric_id}}" 46 | show_status: 47 | message_id: "{{result.operation_resp.show_status.message_id}}" 48 | register: status_result 49 | until: status_result.operation_resp is not defined or status_result.operation_resp.show_status.status == "done" or status_result.operation_resp.show_status.status == "delivered" 50 | retries: 100 51 | delay: 10 52 | 53 | - name: print show_status end result 54 | debug: 55 | var: status_result.operation_resp 56 | -------------------------------------------------------------------------------- /ips_delete.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | fabric_id: 5 19 | vrfs: 20 | - vrfID: 28 21 | action: delete 22 | - vrfID: 29 23 | action: delete 24 | - vrfID: 30 25 | action: delete 26 | 27 | 28 | tasks: 29 | 30 | - name: ips delete operation 31 | brocade_list_operation: 32 | credential: "{{credential}}" 33 | module_name: vrf 34 | vfid: "{{fabric_id}}" 35 | entries: "{{vrfs}}" 36 | register: result 37 | 38 | - name: print initial results gathered 39 | debug: 40 | var: result.operation_resp 41 | 42 | - name: show status of operation 43 | brocade_operation_show_status: 44 | credential: "{{credential}}" 45 | vfid: "{{fabric_id}}" 46 | show_status: 47 | message_id: "{{result.operation_resp.show_status.message_id}}" 48 | register: status_result 49 | until: status_result.operation_resp is not defined or status_result.operation_resp.show_status.status == "done" or status_result.operation_resp.show_status.status == "delivered" 50 | retries: 100 51 | delay: 10 52 | 53 | - name: print show_status end result 54 | debug: 55 | var: status_result.operation_resp 56 | -------------------------------------------------------------------------------- /ipsdb.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | fabric_id: 9 9 | 10 | logicalswitches: 11 | - fabric_id: 9 12 | base_switch_enabled: 0 13 | ficon_mode_enabled: 0 14 | logical_isl_enabled: 1 15 | ip_storage_switch_enabled: true 16 | 17 | vrfs: 18 | - vrfID: 28 19 | - vrfID: 29 20 | - vrfID: 30 21 | - vrfID: 31 22 | - vrfID: 32 23 | - vrfID: 33 24 | dhcpEnabled: true 25 | dhcpServer: 33.20.30.40 26 | - vrfID: 34 27 | dhcpEnabled: false 28 | 29 | vlans: 30 | - vlanID: 28 31 | vrfID: 28 32 | gateway: 28.2.3.4/24 33 | - vlanID: 29 34 | vrfID: 29 35 | gateway: 29.2.3.4/24 36 | - vlanID: 33 37 | vrfID: 33 38 | gateway: 33.2.3.4/24 39 | - vlanID: 34 40 | vrfID: 33 41 | gateway: 34.2.3.5/24 42 | interfaces: 43 | interface: 1/2/5 44 | 45 | interfaces: 46 | - interface: 1/2/5 47 | nativeVlanID: 33 48 | - interface: 1/2/4 49 | 50 | staticroutes: 51 | - destination: 11.2.3.0/24 52 | nextHop: 28.2.3.5 53 | vrfID: 28 54 | metric: 16 55 | - destination: 12.2.3.0/24 56 | nextHop: 29.2.3.5 57 | vrfID: 29 58 | - destination: 13.2.3.0/24 59 | nextHop: 33.2.4.5 60 | 61 | 62 | staticarps: 63 | - ipAddress: 28.2.3.7 64 | vlanID: 28 65 | macAddress: 28:20:30:40:50:60 66 | interface: 1/2/5 67 | - ipAddress: 29.2.3.7 68 | vlanID: 29 69 | macAddress: 29:20:30:40:50:60 70 | interface: 1/2/4 71 | - ipAddress: 33.2.3.7 72 | vlanID: 33 73 | macAddress: 33:20:30:40:50:60 74 | interface: 1/2/3 75 | 76 | 77 | lags: 78 | - name: 1/LAG2 79 | - name: 1/LAG3 80 | - name: 1/LAG4 81 | interfaces: 82 | interface: 1/2/10 83 | 84 | 85 | trafclasses: 86 | - trafficClassName: traf1 87 | interfaces: 88 | interface: 1/2/17 89 | features: 90 | feature: sFlow 91 | -------------------------------------------------------------------------------- /ldap_role_map.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: port group configuration 22 | brocade_security_ldap_role_map: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | ldap_role_map: 26 | - ldap_role: ROLE3 27 | switch_role: admin 28 | - ldap_role: ROLE2 29 | switch_role: admin 30 | -------------------------------------------------------------------------------- /ldap_server.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: change 22 | brocade_list_obj: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | module_name: "brocade_security" 26 | list_name: "ldap_server" 27 | entries: 28 | - server: "10.10.10.10" 29 | port: 389 30 | domain: "local" 31 | timeout: 3 32 | tls_mode: "starttls" 33 | -------------------------------------------------------------------------------- /library/brocade_access_gateway_n_port_map.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | from __future__ import (absolute_import, division, print_function) 10 | __metaclass__ = type 11 | 12 | 13 | DOCUMENTATION = ''' 14 | 15 | module: brocade_access_gateway_n_port_map 16 | short_description: Brocade Fibre Channel AG N-Port map configuration 17 | version_added: '2.7' 18 | author: Broadcom BSN Ansible Team 19 | description: 20 | - Update Fibre Channel AG N-Port map configuration 21 | 22 | options: 23 | credential: 24 | description: 25 | - Login information 26 | suboptions: 27 | fos_ip_addr: 28 | description: 29 | - IP address of the FOS switch 30 | required: true 31 | type: str 32 | fos_user_name: 33 | description: 34 | - Login name of FOS switch 35 | required: true 36 | type: str 37 | fos_password: 38 | description: 39 | - Password of FOS switch 40 | required: true 41 | type: str 42 | https: 43 | description: 44 | - Encryption to use. True for HTTPS, self for self-signed HTTPS, 45 | or False for HTTP 46 | choices: 47 | - True 48 | - False 49 | - self 50 | required: true 51 | type: str 52 | 53 | type: dict 54 | required: true 55 | vfid: 56 | description: 57 | - VFID of the switch. Use -1 for FOS without VF enabled or AG. 58 | type: int 59 | required: false 60 | throttle: 61 | description: 62 | - Throttling delay in seconds. Enables second retry on first 63 | failure. 64 | type: int 65 | timeout: 66 | description: 67 | - REST timeout in seconds for operations that take longer than FOS 68 | default value. 69 | type: int 70 | n_port_map: 71 | description: 72 | - List of N-Port map to be updated. All writable attributes supported 73 | by BSN REST API. Attribute name containing "-" is replaced with "_". 74 | required: true 75 | type: dict 76 | 77 | ''' 78 | 79 | 80 | EXAMPLES = """ 81 | 82 | gather_facts: False 83 | 84 | vars: 85 | credential: 86 | fos_ip_addr: "{{fos_ip_addr}}" 87 | fos_user_name: admin 88 | fos_password: xxxx 89 | https: False 90 | 91 | tasks: 92 | 93 | - name: configure N-Port map 94 | brocade_access_gateway_n_port_map: 95 | credential: "{{credential}}" 96 | vfid: -1 97 | n_port_map: 98 | 99 | """ 100 | 101 | 102 | RETURN = """ 103 | 104 | msg: 105 | description: 106 | - Success message 107 | returned: on success 108 | type: str 109 | 110 | """ 111 | 112 | 113 | """ 114 | Brocade Fibre Channel AG N-Port map configuration 115 | """ 116 | 117 | 118 | from ansible.module_utils.brocade_objects import list_helper 119 | from ansible.module_utils.basic import AnsibleModule 120 | 121 | 122 | def main(): 123 | """ 124 | Main function 125 | """ 126 | 127 | argument_spec = dict( 128 | credential=dict(required=True, type='dict', options=dict( 129 | fos_ip_addr=dict(required=True, type='str'), 130 | fos_user_name=dict(required=True, type='str'), 131 | fos_password=dict(required=True, type='str', no_log=True), 132 | https=dict(required=True, type='str'), 133 | ssh_hostkeymust=dict(required=False, type='bool'))), 134 | vfid=dict(required=False, type='int'), 135 | throttle=dict(required=False, type='int'), 136 | timeout=dict(required=False, type='int'), 137 | n_port_map=dict(required=True, type='list')) 138 | 139 | module = AnsibleModule( 140 | argument_spec=argument_spec, 141 | supports_check_mode=True 142 | ) 143 | 144 | input_params = module.params 145 | 146 | # Set up state variables 147 | fos_ip_addr = input_params['credential']['fos_ip_addr'] 148 | fos_user_name = input_params['credential']['fos_user_name'] 149 | fos_password = input_params['credential']['fos_password'] 150 | https = input_params['credential']['https'] 151 | throttle = input_params['throttle'] 152 | timeout = input_params['timeout'] 153 | vfid = input_params['vfid'] 154 | n_port_map = input_params['n_port_map'] 155 | result = {"changed": False} 156 | 157 | list_helper(module, fos_ip_addr, fos_user_name, fos_password, https, True, throttle, vfid, "brocade_access_gateway", "n_port_map", n_port_map, False, result, timeout) 158 | 159 | 160 | if __name__ == '__main__': 161 | main() 162 | -------------------------------------------------------------------------------- /library/brocade_access_gateway_n_port_settings.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | from __future__ import (absolute_import, division, print_function) 10 | __metaclass__ = type 11 | 12 | 13 | DOCUMENTATION = ''' 14 | 15 | module: brocade_access_gateway_n_port_settings 16 | short_description: Brocade Fibre Channel AG N-Port settings 17 | version_added: '2.7' 18 | author: Broadcom BSN Ansible Team 19 | description: 20 | - Update Fibre Channel AG N-Port settings 21 | 22 | options: 23 | credential: 24 | description: 25 | - Login information 26 | suboptions: 27 | fos_ip_addr: 28 | description: 29 | - IP address of the FOS switch 30 | required: true 31 | type: str 32 | fos_user_name: 33 | description: 34 | - Login name of FOS switch 35 | required: true 36 | type: str 37 | fos_password: 38 | description: 39 | - Password of FOS switch 40 | required: true 41 | type: str 42 | https: 43 | description: 44 | - Encryption to use. True for HTTPS, self for self-signed HTTPS, 45 | or False for HTTP 46 | choices: 47 | - True 48 | - False 49 | - self 50 | required: true 51 | type: str 52 | 53 | type: dict 54 | required: true 55 | vfid: 56 | description: 57 | - VFID of the switch. Use -1 for FOS without VF enabled or AG. 58 | type: int 59 | required: false 60 | throttle: 61 | description: 62 | - Throttling delay in seconds. Enables second retry on first 63 | failure. 64 | type: int 65 | timeout: 66 | description: 67 | - REST timeout in seconds for operations that take longer than FOS 68 | default value. 69 | type: int 70 | n_port_settings: 71 | description: 72 | - N-Port settings data structure 73 | All writable attributes supported 74 | by BSN REST API with - replaced with _. 75 | required: true 76 | type: dict 77 | 78 | ''' 79 | 80 | 81 | EXAMPLES = """ 82 | 83 | gather_facts: False 84 | 85 | vars: 86 | credential: 87 | fos_ip_addr: "{{fos_ip_addr}}" 88 | fos_user_name: admin 89 | fos_password: xxxx 90 | https: False 91 | 92 | tasks: 93 | 94 | - name: AG N-Port settings 95 | brocade_access_gateway_n_port_settings 96 | credential: "{{credential}}" 97 | vfid: -1 98 | n_port_settings: 99 | reliability_counter: 25 100 | 101 | """ 102 | 103 | 104 | RETURN = """ 105 | 106 | msg: 107 | description: Success message 108 | returned: success 109 | type: str 110 | 111 | """ 112 | 113 | 114 | """ 115 | Brocade Fibre Channel AG N-Port settings 116 | """ 117 | 118 | 119 | from ansible.module_utils.brocade_objects import singleton_helper 120 | from ansible.module_utils.basic import AnsibleModule 121 | 122 | 123 | def main(): 124 | """ 125 | Main function 126 | """ 127 | 128 | argument_spec = dict( 129 | credential=dict(required=True, type='dict', options=dict( 130 | fos_ip_addr=dict(required=True, type='str'), 131 | fos_user_name=dict(required=True, type='str'), 132 | fos_password=dict(required=True, type='str', no_log=True), 133 | https=dict(required=True, type='str'), 134 | ssh_hostkeymust=dict(required=False, type='bool'))), 135 | vfid=dict(required=False, type='int'), 136 | throttle=dict(required=False, type='int'), 137 | timeout=dict(required=False, type='int'), 138 | n_port_settings=dict(required=False, type='dict')) 139 | 140 | module = AnsibleModule( 141 | argument_spec=argument_spec, 142 | supports_check_mode=True 143 | ) 144 | 145 | input_params = module.params 146 | 147 | # Set up state variables 148 | fos_ip_addr = input_params['credential']['fos_ip_addr'] 149 | fos_user_name = input_params['credential']['fos_user_name'] 150 | fos_password = input_params['credential']['fos_password'] 151 | https = input_params['credential']['https'] 152 | throttle = input_params['throttle'] 153 | timeout = input_params['timeout'] 154 | vfid = input_params['vfid'] 155 | n_port_settings = input_params['n_port_settings'] 156 | result = {"changed": False} 157 | 158 | singleton_helper(module, fos_ip_addr, fos_user_name, fos_password, https, True, throttle, vfid, "brocade_access_gateway", "n_port_settings", n_port_settings, result, timeout) 159 | 160 | 161 | if __name__ == '__main__': 162 | main() 163 | -------------------------------------------------------------------------------- /library/brocade_access_gateway_port_group.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | from __future__ import (absolute_import, division, print_function) 10 | __metaclass__ = type 11 | 12 | 13 | DOCUMENTATION = ''' 14 | 15 | module: brocade_access_gateway_port_group 16 | short_description: Brocade Fibre Channel AG port group configuration 17 | version_added: '2.7' 18 | author: Broadcom BSN Ansible Team 19 | description: 20 | - Update Fibre Channel AG port group configuration 21 | 22 | options: 23 | credential: 24 | description: 25 | - Login information 26 | suboptions: 27 | fos_ip_addr: 28 | description: 29 | - IP address of the FOS switch 30 | required: true 31 | type: str 32 | fos_user_name: 33 | description: 34 | - Login name of FOS switch 35 | required: true 36 | type: str 37 | fos_password: 38 | description: 39 | - Password of FOS switch 40 | required: true 41 | type: str 42 | https: 43 | description: 44 | - Encryption to use. True for HTTPS, self for self-signed HTTPS, 45 | or False for HTTP 46 | choices: 47 | - True 48 | - False 49 | - self 50 | required: true 51 | type: str 52 | 53 | type: dict 54 | required: true 55 | vfid: 56 | description: 57 | - VFID of the switch. Use -1 for FOS without VF enabled or AG. 58 | type: int 59 | required: false 60 | throttle: 61 | description: 62 | - Throttling delay in seconds. Enables second retry on first 63 | failure. 64 | type: int 65 | timeout: 66 | description: 67 | - REST timeout in seconds for operations that take longer than FOS 68 | default value. 69 | type: int 70 | port_groups: 71 | description: 72 | - List of port groups be updated. All writable attributes supported 73 | by BSN REST API with - replaced with _ 74 | required: true 75 | type: dict 76 | 77 | ''' 78 | 79 | 80 | EXAMPLES = """ 81 | 82 | gather_facts: False 83 | 84 | vars: 85 | credential: 86 | fos_ip_addr: "{{fos_ip_addr}}" 87 | fos_user_name: admin 88 | fos_password: xxxx 89 | https: False 90 | 91 | tasks: 92 | 93 | - name: snmp v3 traps 94 | brocade_access_gateway_port_group: 95 | credential: "{{credential}}" 96 | vfid: -1 97 | port_groups: 98 | 99 | """ 100 | 101 | 102 | RETURN = """ 103 | 104 | msg: 105 | description: Success message 106 | returned: success 107 | type: str 108 | 109 | """ 110 | 111 | 112 | """ 113 | Brocade Fibre Channel AG port group configuration 114 | """ 115 | 116 | 117 | from ansible.module_utils.brocade_objects import list_helper 118 | from ansible.module_utils.basic import AnsibleModule 119 | 120 | 121 | def main(): 122 | """ 123 | Main function 124 | """ 125 | 126 | argument_spec = dict( 127 | credential=dict(required=True, type='dict', options=dict( 128 | fos_ip_addr=dict(required=True, type='str'), 129 | fos_user_name=dict(required=True, type='str'), 130 | fos_password=dict(required=True, type='str', no_log=True), 131 | https=dict(required=True, type='str'), 132 | ssh_hostkeymust=dict(required=False, type='bool'))), 133 | vfid=dict(required=False, type='int'), 134 | throttle=dict(required=False, type='int'), 135 | timeout=dict(required=False, type='int'), 136 | port_groups=dict(required=True, type='list')) 137 | 138 | module = AnsibleModule( 139 | argument_spec=argument_spec, 140 | supports_check_mode=True 141 | ) 142 | 143 | input_params = module.params 144 | 145 | # Set up state variables 146 | fos_ip_addr = input_params['credential']['fos_ip_addr'] 147 | fos_user_name = input_params['credential']['fos_user_name'] 148 | fos_password = input_params['credential']['fos_password'] 149 | https = input_params['credential']['https'] 150 | throttle = input_params['throttle'] 151 | timeout = input_params['timeout'] 152 | vfid = input_params['vfid'] 153 | port_groups = input_params['port_groups'] 154 | result = {"changed": False} 155 | 156 | list_helper(module, fos_ip_addr, fos_user_name, fos_password, https, True, throttle, vfid, "brocade_access_gateway", "port_group", port_groups, False, result, timeout) 157 | 158 | 159 | if __name__ == '__main__': 160 | main() 161 | -------------------------------------------------------------------------------- /library/brocade_interface_fibrechannel.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | from __future__ import (absolute_import, division, print_function) 10 | __metaclass__ = type 11 | 12 | 13 | DOCUMENTATION = ''' 14 | 15 | module: brocade_interface_fibrechannel 16 | short_description: Brocade Fibre Channel port configuration 17 | version_added: '2.7' 18 | author: Broadcom BSN Ansible Team 19 | description: 20 | - Update Fibre Channel port configuration 21 | 22 | options: 23 | credential: 24 | description: 25 | - Login information 26 | suboptions: 27 | fos_ip_addr: 28 | description: 29 | - IP address of the FOS switch 30 | required: true 31 | type: str 32 | fos_user_name: 33 | description: 34 | - Login name of FOS switch 35 | required: true 36 | type: str 37 | fos_password: 38 | description: 39 | - Password of FOS switch 40 | required: true 41 | type: str 42 | https: 43 | description: 44 | - Encryption to use. True for HTTPS, self for self-signed HTTPS, 45 | or False for HTTP 46 | choices: 47 | - True 48 | - False 49 | - self 50 | required: true 51 | type: str 52 | 53 | type: dict 54 | required: true 55 | vfid: 56 | description: 57 | - VFID of the switch. Use -1 for FOS without VF enabled or AG. 58 | type: int 59 | required: false 60 | throttle: 61 | description: 62 | - Throttling delay in seconds. Enables second retry on first 63 | failure. 64 | type: int 65 | timeout: 66 | description: 67 | - REST timeout in seconds for operations that take longer than FOS 68 | default value. 69 | type: int 70 | ports: 71 | description: 72 | - List of ports to be updated. All writable attributes supported 73 | by BSN REST API with - replaced with _. 74 | required: true 75 | type: list 76 | ''' 77 | 78 | 79 | EXAMPLES = """ 80 | 81 | gather_facts: False 82 | 83 | vars: 84 | credential: 85 | fos_ip_addr: "{{fos_ip_addr}}" 86 | fos_user_name: admin 87 | fos_password: xxxx 88 | https: False 89 | 90 | tasks: 91 | 92 | - name: Configure ports 93 | brocade_interface_fibrechannel: 94 | credential: "{{credential}}" 95 | vfid: -1 96 | ports: 97 | - name: "0/0" 98 | enabled_state: False 99 | npiv_pp_limit: 126 100 | - name: "0/1" 101 | persistent_disable: True 102 | 103 | """ 104 | 105 | 106 | RETURN = """ 107 | 108 | msg: 109 | description: Success message 110 | returned: success 111 | type: str 112 | 113 | """ 114 | 115 | 116 | """ 117 | Brocade Fibre Channel port configuration 118 | """ 119 | 120 | 121 | from ansible.module_utils.brocade_objects import list_helper 122 | from ansible.module_utils.basic import AnsibleModule 123 | 124 | 125 | def main(): 126 | """ 127 | Main function 128 | """ 129 | 130 | argument_spec = dict( 131 | credential=dict(required=True, type='dict', options=dict( 132 | fos_ip_addr=dict(required=True, type='str'), 133 | fos_user_name=dict(required=True, type='str'), 134 | fos_password=dict(required=True, type='str', no_log=True), 135 | https=dict(required=True, type='str'), 136 | ssh_hostkeymust=dict(required=False, type='bool'))), 137 | vfid=dict(required=False, type='int'), 138 | throttle=dict(required=False, type='int'), 139 | timeout=dict(required=False, type='int'), 140 | ports=dict(required=True, type='list')) 141 | 142 | module = AnsibleModule( 143 | argument_spec=argument_spec, 144 | supports_check_mode=True 145 | ) 146 | 147 | input_params = module.params 148 | 149 | # Set up state variables 150 | fos_ip_addr = input_params['credential']['fos_ip_addr'] 151 | fos_user_name = input_params['credential']['fos_user_name'] 152 | fos_password = input_params['credential']['fos_password'] 153 | https = input_params['credential']['https'] 154 | throttle = input_params['throttle'] 155 | timeout = input_params['timeout'] 156 | vfid = input_params['vfid'] 157 | ports = input_params['ports'] 158 | result = {"changed": False} 159 | 160 | list_helper(module, fos_ip_addr, fos_user_name, fos_password, https, True, throttle, vfid, "brocade_interface", "fibrechannel", ports, False, result, timeout) 161 | 162 | 163 | if __name__ == '__main__': 164 | main() 165 | -------------------------------------------------------------------------------- /library/brocade_maps_maps_policy.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | from __future__ import (absolute_import, division, print_function) 10 | __metaclass__ = type 11 | 12 | 13 | ANSIBLE_METADATA = {'metadata_version': '1.1', 14 | 'status': ['preview'], 15 | 'supported_by': 'certified'} 16 | 17 | 18 | DOCUMENTATION = ''' 19 | 20 | module: brocade_maps_maps_policy 21 | short_description: Brocade Fibre Channel MAPS policy configuration 22 | version_added: '2.7' 23 | author: Broadcom BSN Ansible Team 24 | description: 25 | - Update Fibre Channel MAPS policy 26 | 27 | options: 28 | 29 | credential: 30 | description: 31 | - login information including 32 | fos_ip_addr - ip address of the FOS switch 33 | fos_user_name - login name of FOS switch REST API 34 | fos_password - password of FOS switch REST API 35 | https - True for HTTPS, self for self-signed HTTPS, or False for HTTP 36 | type: dict 37 | required: true 38 | vfid: 39 | description: 40 | - vfid of the switch to target. The value can be -1 for 41 | FOS without VF enabled. For VF enabled FOS, a valid vfid 42 | should be given 43 | required: false 44 | throttle: 45 | description: 46 | - rest throttling delay in seconds to retry once more if 47 | server is busy. 48 | required: false 49 | timeout: 50 | description: 51 | - rest timeout in seconds for operations taking longer than 52 | default timeout. 53 | required: false 54 | maps_policies: 55 | description: 56 | - list of policies to be updated. All writable attributes supported 57 | by BSN REST API with - replaced with _. 58 | required: true 59 | 60 | ''' 61 | 62 | 63 | EXAMPLES = """ 64 | 65 | gather_facts: False 66 | 67 | vars: 68 | credential: 69 | fos_ip_addr: "{{fos_ip_addr}}" 70 | fos_user_name: admin 71 | fos_password: xxxx 72 | https: False 73 | tasks: 74 | 75 | 76 | - name: maps policies 77 | brocade_maps_maps_policy: 78 | credential: "{{credential}}" 79 | vfid: -1 80 | map_policies: 81 | - name: my_policy 82 | is_active_policy: False 83 | rule_list: 84 | rule: 85 | - my_rule1 86 | - my_rule2 87 | 88 | """ 89 | 90 | 91 | RETURN = """ 92 | 93 | msg: 94 | description: Success message 95 | returned: success 96 | type: str 97 | 98 | """ 99 | 100 | 101 | """ 102 | Brocade Fibre Channel MAPS policy configuration 103 | """ 104 | 105 | 106 | from ansible.module_utils.brocade_objects import list_helper 107 | from ansible.module_utils.basic import AnsibleModule 108 | 109 | 110 | def main(): 111 | """ 112 | Main function 113 | """ 114 | 115 | argument_spec = dict( 116 | credential=dict(required=True, type='dict', options=dict( 117 | fos_ip_addr=dict(required=True, type='str'), 118 | fos_user_name=dict(required=True, type='str'), 119 | fos_password=dict(required=True, type='str', no_log=True), 120 | https=dict(required=True, type='str'), 121 | ssh_hostkeymust=dict(required=False, type='bool'))), 122 | vfid=dict(required=False, type='int'), 123 | throttle=dict(required=False, type='int'), 124 | timeout=dict(required=False, type='int'), 125 | all_entries=dict(required=False, type='bool'), 126 | maps_policies=dict(required=True, type='list')) 127 | 128 | module = AnsibleModule( 129 | argument_spec=argument_spec, 130 | supports_check_mode=True 131 | ) 132 | 133 | input_params = module.params 134 | 135 | # Set up state variables 136 | fos_ip_addr = input_params['credential']['fos_ip_addr'] 137 | fos_user_name = input_params['credential']['fos_user_name'] 138 | fos_password = input_params['credential']['fos_password'] 139 | https = input_params['credential']['https'] 140 | throttle = input_params['throttle'] 141 | timeout = input_params['timeout'] 142 | all_entries = input_params['all_entries'] 143 | vfid = input_params['vfid'] 144 | maps_policies = input_params['maps_policies'] 145 | result = {"changed": False} 146 | 147 | list_helper(module, fos_ip_addr, fos_user_name, fos_password, https, True, throttle, vfid, "brocade_maps", "maps_policy", maps_policies, all_entries, result, timeout) 148 | 149 | 150 | if __name__ == '__main__': 151 | main() 152 | -------------------------------------------------------------------------------- /library/brocade_maps_rule.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | from __future__ import (absolute_import, division, print_function) 10 | __metaclass__ = type 11 | 12 | 13 | ANSIBLE_METADATA = {'metadata_version': '1.1', 14 | 'status': ['preview'], 15 | 'supported_by': 'certified'} 16 | 17 | 18 | DOCUMENTATION = ''' 19 | 20 | module: brocade_maps_rule 21 | short_description: Brocade Fibre Channel MAPS rule configuration 22 | version_added: '2.7' 23 | author: Broadcom BSN Ansible Team 24 | description: 25 | - Update Fibre Channel MAPS rule 26 | 27 | options: 28 | 29 | credential: 30 | description: 31 | - login information including 32 | fos_ip_addr - ip address of the FOS switch 33 | fos_user_name - login name of FOS switch REST API 34 | fos_password - password of FOS switch REST API 35 | https - True for HTTPS, self for self-signed HTTPS, or False for HTTP 36 | type: dict 37 | required: true 38 | vfid: 39 | description: 40 | - vfid of the switch to target. The value can be -1 for 41 | FOS without VF enabled. For VF enabled FOS, a valid vfid 42 | should be given 43 | required: false 44 | throttle: 45 | description: 46 | - rest throttling delay in seconds to retry once more if 47 | server is busy. 48 | required: false 49 | timeout: 50 | description: 51 | - rest timeout in seconds for operations taking longer than 52 | default timeout. 53 | required: false 54 | rules: 55 | description: 56 | - list of rules to be updated. All writable attributes supported 57 | by BSN REST API with - replaced with _. 58 | required: true 59 | 60 | ''' 61 | 62 | 63 | EXAMPLES = """ 64 | 65 | gather_facts: False 66 | 67 | vars: 68 | credential: 69 | fos_ip_addr: "{{fos_ip_addr}}" 70 | fos_user_name: admin 71 | fos_password: xxxx 72 | https: False 73 | tasks: 74 | 75 | 76 | - name: configure maps rules 77 | brocade_maps_rule: 78 | credential: "{{credential}}" 79 | vfid: -1 80 | rules: 81 | - name: my_rule1 82 | actions: 83 | action: 84 | - "raslog" 85 | event_severity: null 86 | group_name: "ALL_E_PORTS" 87 | is_rule_on_rule: False 88 | logical_operator: "g" 89 | monitoring_system: "C3TXTO" 90 | quiet_time: 0 91 | threshold_value: 1 92 | time_base: "Min" 93 | 94 | """ 95 | 96 | 97 | RETURN = """ 98 | 99 | msg: 100 | description: Success message 101 | returned: success 102 | type: str 103 | 104 | """ 105 | 106 | 107 | """ 108 | Brocade Fibre Channel MAPS rule configuration 109 | """ 110 | 111 | 112 | from ansible.module_utils.brocade_objects import list_helper 113 | from ansible.module_utils.basic import AnsibleModule 114 | 115 | 116 | def main(): 117 | """ 118 | Main function 119 | """ 120 | 121 | argument_spec = dict( 122 | credential=dict(required=True, type='dict', options=dict( 123 | fos_ip_addr=dict(required=True, type='str'), 124 | fos_user_name=dict(required=True, type='str'), 125 | fos_password=dict(required=True, type='str', no_log=True), 126 | https=dict(required=True, type='str'), 127 | ssh_hostkeymust=dict(required=False, type='bool'))), 128 | vfid=dict(required=False, type='int'), 129 | throttle=dict(required=False, type='int'), 130 | timeout=dict(required=False, type='int'), 131 | all_entries=dict(required=False, type='bool'), 132 | rules=dict(required=True, type='list')) 133 | 134 | module = AnsibleModule( 135 | argument_spec=argument_spec, 136 | supports_check_mode=True 137 | ) 138 | 139 | input_params = module.params 140 | 141 | # Set up state variables 142 | fos_ip_addr = input_params['credential']['fos_ip_addr'] 143 | fos_user_name = input_params['credential']['fos_user_name'] 144 | fos_password = input_params['credential']['fos_password'] 145 | https = input_params['credential']['https'] 146 | throttle = input_params['throttle'] 147 | timeout = input_params['timeout'] 148 | vfid = input_params['vfid'] 149 | all_entries = input_params['all_entries'] 150 | rules = input_params['rules'] 151 | result = {"changed": False} 152 | 153 | list_helper(module, fos_ip_addr, fos_user_name, fos_password, https, True, throttle, vfid, "brocade_maps", "rule", rules, all_entries, result, timeout) 154 | 155 | 156 | if __name__ == '__main__': 157 | main() 158 | -------------------------------------------------------------------------------- /library/brocade_module_compatibility.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | from __future__ import (absolute_import, division, print_function) 10 | __metaclass__ = type 11 | 12 | 13 | DOCUMENTATION = ''' 14 | 15 | module: brocade_fibrechannel_switch 16 | short_description: Brocade Fibre Channel switch configuration 17 | version_added: '2.7' 18 | author: Broadcom BSN Ansible Team 19 | description: 20 | - Update Module compatibility check 21 | 22 | options: 23 | credential: 24 | description: 25 | - Login information 26 | suboptions: 27 | fos_ip_addr: 28 | description: 29 | - IP address of the FOS switch 30 | required: true 31 | type: str 32 | fos_user_name: 33 | description: 34 | - Login name of FOS switch 35 | required: true 36 | type: str 37 | fos_password: 38 | description: 39 | - Password of FOS switch 40 | required: true 41 | type: str 42 | https: 43 | description: 44 | - Encryption to use. True for HTTPS, self for self-signed HTTPS, 45 | or False for HTTP 46 | choices: 47 | - True 48 | - False 49 | - self 50 | required: true 51 | type: str 52 | 53 | type: dict 54 | required: true 55 | throttle: 56 | description: 57 | - Throttling delay in seconds. Enables second retry on first 58 | failure. 59 | type: int 60 | timeout: 61 | description: 62 | - REST timeout in seconds for operations that take longer than FOS 63 | default value. 64 | type: int 65 | 66 | ''' 67 | 68 | 69 | EXAMPLES = """ 70 | 71 | gather_facts: False 72 | 73 | vars: 74 | credential: 75 | fos_ip_addr: "{{fos_ip_addr}}" 76 | fos_user_name: admin 77 | fos_password: xxxx 78 | https: False 79 | 80 | tasks: 81 | 82 | - name: Module compatibility check 83 | brocade_module_compatibility: 84 | credential: "{{credential}}" 85 | 86 | """ 87 | 88 | 89 | RETURN = """ 90 | 91 | msg: 92 | description: Success message 93 | returned: success 94 | type: str 95 | 96 | """ 97 | 98 | 99 | """ 100 | Brocade Module compatibility check 101 | """ 102 | 103 | 104 | from ansible.module_utils.brocade_objects import moduleCompatibility_helper 105 | from ansible.module_utils.basic import AnsibleModule 106 | 107 | 108 | def main(): 109 | """ 110 | Main function 111 | """ 112 | 113 | argument_spec = dict( 114 | credential=dict(required=True, type='dict', options=dict( 115 | fos_ip_addr=dict(required=True, type='str'), 116 | fos_user_name=dict(required=True, type='str'), 117 | fos_password=dict(required=True, type='str', no_log=True), 118 | https=dict(required=True, type='str'), 119 | ssh_hostkeymust=dict(required=False, type='bool'))), 120 | vfid=dict(required=False, type='int'), 121 | throttle=dict(required=False, type='int'), 122 | timeout=dict(required=False, type='int')) 123 | 124 | module = AnsibleModule( 125 | argument_spec=argument_spec, 126 | supports_check_mode=True 127 | ) 128 | 129 | input_params = module.params 130 | 131 | # Set up state variables 132 | fos_ip_addr = input_params['credential']['fos_ip_addr'] 133 | fos_user_name = input_params['credential']['fos_user_name'] 134 | fos_password = input_params['credential']['fos_password'] 135 | https = input_params['credential']['https'] 136 | throttle = input_params['throttle'] 137 | timeout = input_params['timeout'] 138 | result = {"changed": False} 139 | 140 | moduleCompatibility_helper(module, fos_ip_addr, fos_user_name, fos_password, https, throttle, result, timeout) 141 | 142 | 143 | if __name__ == '__main__': 144 | main() 145 | -------------------------------------------------------------------------------- /library/brocade_operation_show_status.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | from __future__ import (absolute_import, division, print_function) 10 | __metaclass__ = type 11 | 12 | 13 | DOCUMENTATION = ''' 14 | 15 | module: brocade_operation_show_status 16 | short_description: Brocade Fibre Channel operation status retrieval 17 | version_added: '2.7' 18 | author: Broadcom BSN Ansible Team 19 | description: 20 | - Retrieve Fibre Channel operation status 21 | 22 | options: 23 | credential: 24 | description: 25 | - Login information 26 | suboptions: 27 | fos_ip_addr: 28 | description: 29 | - IP address of the FOS switch 30 | required: true 31 | type: str 32 | fos_user_name: 33 | description: 34 | - Login name of FOS switch 35 | required: true 36 | type: str 37 | fos_password: 38 | description: 39 | - Password of FOS switch 40 | required: true 41 | type: str 42 | https: 43 | description: 44 | - Encryption to use. True for HTTPS, self for self-signed HTTPS, 45 | or False for HTTP 46 | choices: 47 | - True 48 | - False 49 | - self 50 | required: true 51 | type: str 52 | 53 | type: dict 54 | required: true 55 | vfid: 56 | description: 57 | - VFID of the switch. Use -1 for FOS without VF enabled or AG. 58 | type: int 59 | required: false 60 | throttle: 61 | description: 62 | - Throttling delay in seconds. Enables second retry on first 63 | failure. 64 | type: int 65 | timeout: 66 | description: 67 | - REST timeout in seconds for operations that take longer than FOS 68 | default value. 69 | type: int 70 | show_status: 71 | description: 72 | - Message id information 73 | type: dict 74 | required: true 75 | 76 | ''' 77 | 78 | 79 | EXAMPLES = """ 80 | 81 | gather_facts: False 82 | 83 | vars: 84 | credential: 85 | fos_ip_addr: "{{fos_ip_addr}}" 86 | fos_user_name: admin 87 | fos_password: xxxx 88 | https: False 89 | 90 | tasks: 91 | 92 | - name: show operation status 93 | brocade_operation_show_status: 94 | credential: "{{credential}}" 95 | vfid: -1 96 | show_status: 97 | message_id: 98 | 99 | """ 100 | 101 | 102 | RETURN = """ 103 | 104 | msg: 105 | description: Success message 106 | returned: success 107 | type: str 108 | 109 | """ 110 | 111 | 112 | """ 113 | Brocade Fibre Channel operation show status 114 | """ 115 | 116 | from ansible.module_utils.brocade_objects import operation_helper 117 | from ansible.module_utils.basic import AnsibleModule 118 | 119 | 120 | def main(): 121 | """ 122 | Main function 123 | """ 124 | 125 | argument_spec = dict( 126 | credential=dict(required=True, type='dict', options=dict( 127 | fos_ip_addr=dict(required=True, type='str'), 128 | fos_user_name=dict(required=True, type='str'), 129 | fos_password=dict(required=True, type='str', no_log=True), 130 | https=dict(required=True, type='str'), 131 | ssh_hostkeymust=dict(required=False, type='bool'))), 132 | vfid=dict(required=False, type='int'), 133 | throttle=dict(required=False, type='int'), 134 | timeout=dict(required=False, type='int'), 135 | show_status=dict(required=True, type='dict')) 136 | 137 | module = AnsibleModule( 138 | argument_spec=argument_spec, 139 | supports_check_mode=True 140 | ) 141 | 142 | input_params = module.params 143 | 144 | # Set up state variables 145 | fos_ip_addr = input_params['credential']['fos_ip_addr'] 146 | fos_user_name = input_params['credential']['fos_user_name'] 147 | fos_password = input_params['credential']['fos_password'] 148 | https = input_params['credential']['https'] 149 | ssh_hostkeymust = True 150 | if 'ssh_hostkeymust' in input_params['credential']: 151 | ssh_hostkeymust = input_params['credential']['ssh_hostkeymust'] 152 | throttle = input_params['throttle'] 153 | timeout = input_params['timeout'] 154 | vfid = input_params['vfid'] 155 | show_status = input_params['show_status'] 156 | result = {"changed": False} 157 | 158 | operation_helper(module, fos_ip_addr, fos_user_name, fos_password, https, ssh_hostkeymust, throttle, vfid, "show_status", "show_status", show_status, result, timeout) 159 | 160 | 161 | if __name__ == '__main__': 162 | main() 163 | -------------------------------------------------------------------------------- /library/brocade_operation_supportsave.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | from __future__ import (absolute_import, division, print_function) 10 | __metaclass__ = type 11 | 12 | 13 | DOCUMENTATION = ''' 14 | 15 | module: brocade_operation_supportsave 16 | short_description: Brocade Fibre Channel operation supportsave 17 | version_added: '2.7' 18 | author: Broadcom BSN Ansible Team 19 | description: 20 | - Initiate Fibre Channel supportsave operation 21 | 22 | options: 23 | credential: 24 | description: 25 | - Login information 26 | suboptions: 27 | fos_ip_addr: 28 | description: 29 | - IP address of the FOS switch 30 | required: true 31 | type: str 32 | fos_user_name: 33 | description: 34 | - Login name of FOS switch 35 | required: true 36 | type: str 37 | fos_password: 38 | description: 39 | - Password of FOS switch 40 | required: true 41 | type: str 42 | https: 43 | description: 44 | - Encryption to use. True for HTTPS, self for self-signed HTTPS, 45 | or False for HTTP 46 | choices: 47 | - True 48 | - False 49 | - self 50 | required: true 51 | type: str 52 | 53 | type: dict 54 | required: true 55 | vfid: 56 | description: 57 | - VFID of the switch. Use -1 for FOS without VF enabled or AG. 58 | type: int 59 | required: false 60 | throttle: 61 | description: 62 | - Throttling delay in seconds. Enables second retry on first 63 | failure. 64 | type: int 65 | timeout: 66 | description: 67 | - REST timeout in seconds for operations that take longer than FOS 68 | default value. 69 | type: int 70 | supportsave: 71 | description: 72 | - Supportsave parameters 73 | required: true 74 | type: dict 75 | 76 | ''' 77 | 78 | 79 | EXAMPLES = """ 80 | 81 | gather_facts: False 82 | 83 | vars: 84 | credential: 85 | fos_ip_addr: "{{fos_ip_addr}}" 86 | fos_user_name: admin 87 | fos_password: xxxx 88 | https: False 89 | 90 | tasks: 91 | 92 | - name: Initiate supportsave 93 | brocade_operation_supportsave: 94 | credential: "{{credential}}" 95 | vfid: -1 96 | supportsave: 97 | host: 98 | user_name: 99 | password: 100 | remote_directory: 101 | protocol: 102 | port: 103 | 104 | """ 105 | 106 | 107 | RETURN = """ 108 | 109 | msg: 110 | description: Success message 111 | returned: success 112 | type: str 113 | 114 | """ 115 | 116 | 117 | """ 118 | Brocade Fibre Channel supportsave initiate 119 | """ 120 | 121 | from ansible.module_utils.brocade_objects import operation_helper 122 | from ansible.module_utils.basic import AnsibleModule 123 | 124 | 125 | def main(): 126 | """ 127 | Main function 128 | """ 129 | 130 | argument_spec = dict( 131 | credential=dict(required=True, type='dict', options=dict( 132 | fos_ip_addr=dict(required=True, type='str'), 133 | fos_user_name=dict(required=True, type='str'), 134 | fos_password=dict(required=True, type='str', no_log=True), 135 | https=dict(required=True, type='str'), 136 | ssh_hostkeymust=dict(required=False, type='bool'))), 137 | vfid=dict(required=False, type='int'), 138 | throttle=dict(required=False, type='int'), 139 | timeout=dict(required=False, type='int'), 140 | supportsave=dict(required=True, type='dict')) 141 | 142 | module = AnsibleModule( 143 | argument_spec=argument_spec, 144 | supports_check_mode=True 145 | ) 146 | 147 | input_params = module.params 148 | 149 | # Set up state variables 150 | fos_ip_addr = input_params['credential']['fos_ip_addr'] 151 | fos_user_name = input_params['credential']['fos_user_name'] 152 | fos_password = input_params['credential']['fos_password'] 153 | https = input_params['credential']['https'] 154 | ssh_hostkeymust = True 155 | if 'ssh_hostkeymust' in input_params['credential']: 156 | ssh_hostkeymust = input_params['credential']['ssh_hostkeymust'] 157 | throttle = input_params['throttle'] 158 | timeout = input_params['timeout'] 159 | vfid = input_params['vfid'] 160 | supportsave = input_params['supportsave'] 161 | result = {"changed": False} 162 | 163 | operation_helper(module, fos_ip_addr, fos_user_name, fos_password, https, ssh_hostkeymust, throttle, vfid, "supportsave", "connection", supportsave, result, timeout) 164 | 165 | 166 | if __name__ == '__main__': 167 | main() 168 | -------------------------------------------------------------------------------- /library/brocade_security_ldap_role_map.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | from __future__ import (absolute_import, division, print_function) 10 | __metaclass__ = type 11 | 12 | 13 | DOCUMENTATION = ''' 14 | 15 | module: brocade_security_ldap_role_map 16 | short_description: Brocade Fibre Channel security LDAP role map configuration 17 | version_added: '2.7' 18 | author: Broadcom BSN Ansible Team 19 | description: 20 | - Update Fibre Channel secuirty LDAP role map configuration 21 | 22 | options: 23 | credential: 24 | description: 25 | - Login information 26 | suboptions: 27 | fos_ip_addr: 28 | description: 29 | - IP address of the FOS switch 30 | required: true 31 | type: str 32 | fos_user_name: 33 | description: 34 | - Login name of FOS switch 35 | required: true 36 | type: str 37 | fos_password: 38 | description: 39 | - Password of FOS switch 40 | required: true 41 | type: str 42 | https: 43 | description: 44 | - Encryption to use. True for HTTPS, self for self-signed HTTPS, 45 | or False for HTTP 46 | choices: 47 | - True 48 | - False 49 | - self 50 | required: true 51 | type: str 52 | 53 | type: dict 54 | required: true 55 | vfid: 56 | description: 57 | - VFID of the switch. Use -1 for FOS without VF enabled or AG. 58 | type: int 59 | required: false 60 | throttle: 61 | description: 62 | - Throttling delay in seconds. Enables second retry on first 63 | failure. 64 | type: int 65 | timeout: 66 | description: 67 | - REST timeout in seconds for operations that take longer than FOS 68 | default value. 69 | type: int 70 | ldap_role_map: 71 | description: 72 | - List of LDAP roles data structure. 73 | All writable attributes supported 74 | by BSN REST API with - replaced with _. 75 | required: true 76 | type: list 77 | 78 | ''' 79 | 80 | 81 | EXAMPLES = """ 82 | 83 | gather_facts: False 84 | 85 | vars: 86 | credential: 87 | fos_ip_addr: "{{fos_ip_addr}}" 88 | fos_user_name: admin 89 | fos_password: password 90 | https: False 91 | 92 | tasks: 93 | 94 | - name: LDAP role map 95 | brocade_security_ldap_role_map: 96 | credential: "{{credential}}" 97 | vfid: -1 98 | ldap_role_map: 99 | - ldap_role: "ROLEXYZ" 100 | switch_role: "admin" 101 | 102 | """ 103 | 104 | 105 | RETURN = """ 106 | 107 | msg: 108 | description: Success message 109 | returned: success 110 | type: str 111 | 112 | """ 113 | 114 | 115 | """ 116 | Brocade Fibre Channel LDAP role map configuration 117 | """ 118 | 119 | 120 | from ansible.module_utils.brocade_objects import list_helper 121 | from ansible.module_utils.basic import AnsibleModule 122 | 123 | 124 | def main(): 125 | """ 126 | Main function 127 | """ 128 | 129 | argument_spec = dict( 130 | credential=dict(required=True, type='dict', options=dict( 131 | fos_ip_addr=dict(required=True, type='str'), 132 | fos_user_name=dict(required=True, type='str'), 133 | fos_password=dict(required=True, type='str', no_log=True), 134 | https=dict(required=True, type='str'), 135 | ssh_hostkeymust=dict(required=False, type='bool'))), 136 | vfid=dict(required=False, type='int'), 137 | throttle=dict(required=False, type='int'), 138 | timeout=dict(required=False, type='int'), 139 | ldap_role_map=dict(required=True, type='list')) 140 | 141 | module = AnsibleModule( 142 | argument_spec=argument_spec, 143 | supports_check_mode=True 144 | ) 145 | 146 | input_params = module.params 147 | 148 | # Set up state variables 149 | fos_ip_addr = input_params['credential']['fos_ip_addr'] 150 | fos_user_name = input_params['credential']['fos_user_name'] 151 | fos_password = input_params['credential']['fos_password'] 152 | https = input_params['credential']['https'] 153 | throttle = input_params['throttle'] 154 | timeout = input_params['timeout'] 155 | vfid = input_params['vfid'] 156 | ldap_role_map = input_params['ldap_role_map'] 157 | result = {"changed": False} 158 | 159 | list_helper(module, fos_ip_addr, fos_user_name, fos_password, https, True, throttle, vfid, "brocade_security", "ldap_role_map", ldap_role_map, True, result, timeout) 160 | 161 | 162 | if __name__ == '__main__': 163 | main() 164 | -------------------------------------------------------------------------------- /library/brocade_security_sec_crypto_cfg_template_action.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | from __future__ import (absolute_import, division, print_function) 10 | __metaclass__ = type 11 | 12 | 13 | DOCUMENTATION = ''' 14 | 15 | module: brocade_security_sec_crypto_template_action 16 | short_description: Brocade Fibre Channel security crypto template file actions 17 | version_added: '2.7' 18 | author: Broadcom BSN Ansible Team 19 | description: 20 | - Use to perform actions on the crypto template files. The module 21 | performs the action each time and is not idempotent. 22 | 23 | options: 24 | credential: 25 | description: 26 | - Login information 27 | suboptions: 28 | fos_ip_addr: 29 | description: 30 | - IP address of the FOS switch 31 | required: true 32 | type: str 33 | fos_user_name: 34 | description: 35 | - Login name of FOS switch 36 | required: true 37 | type: str 38 | fos_password: 39 | description: 40 | - Password of FOS switch 41 | required: true 42 | type: str 43 | https: 44 | description: 45 | - Encryption to use. True for HTTPS, self for self-signed HTTPS, 46 | or False for HTTP 47 | choices: 48 | - True 49 | - False 50 | - self 51 | required: true 52 | type: str 53 | 54 | type: dict 55 | required: true 56 | vfid: 57 | description: 58 | - VFID of the switch. Use -1 for FOS without VF enabled or AG. 59 | type: int 60 | required: false 61 | throttle: 62 | description: 63 | - Throttling delay in seconds. Enables second retry on first 64 | failure. 65 | type: int 66 | timeout: 67 | description: 68 | - REST timeout in seconds for operations that take longer than FOS 69 | default value. 70 | type: int 71 | action_inputs: 72 | description: 73 | - Action attributes 74 | required: true 75 | type: dict 76 | ''' 77 | 78 | 79 | EXAMPLES = """ 80 | 81 | gather_facts: False 82 | 83 | vars: 84 | credential: 85 | fos_ip_addr: "{{fos_ip_addr}}" 86 | fos_user_name: admin 87 | fos_password: xxxx 88 | https: False 89 | 90 | tasks: 91 | 92 | - name: import/export/apply cfg template 93 | brocade_security_sec_crypto_cfg_template_action 94 | credential: "{{credential}}" 95 | vfid: -1 96 | action_inputs: 97 | 98 | """ 99 | 100 | 101 | RETURN = """ 102 | 103 | msg: 104 | description: Success message 105 | returned: success 106 | type: str 107 | 108 | """ 109 | 110 | 111 | """ 112 | Brocade Fibre Channel crypto template file actions 113 | """ 114 | 115 | 116 | from ansible.module_utils.brocade_objects import singleton_helper 117 | from ansible.module_utils.basic import AnsibleModule 118 | 119 | 120 | def main(): 121 | """ 122 | Main function 123 | """ 124 | 125 | argument_spec = dict( 126 | credential=dict(required=True, type='dict', options=dict( 127 | fos_ip_addr=dict(required=True, type='str'), 128 | fos_user_name=dict(required=True, type='str'), 129 | fos_password=dict(required=True, type='str', no_log=True), 130 | https=dict(required=True, type='str'), 131 | ssh_hostkeymust=dict(required=False, type='bool'))), 132 | vfid=dict(required=False, type='int'), 133 | throttle=dict(required=False, type='int'), 134 | timeout=dict(required=False, type='int'), 135 | action_inputs=dict(required=True, type='dict')) 136 | 137 | module = AnsibleModule( 138 | argument_spec=argument_spec, 139 | supports_check_mode=True 140 | ) 141 | 142 | input_params = module.params 143 | 144 | # Set up state variables 145 | fos_ip_addr = input_params['credential']['fos_ip_addr'] 146 | fos_user_name = input_params['credential']['fos_user_name'] 147 | fos_password = input_params['credential']['fos_password'] 148 | https = input_params['credential']['https'] 149 | ssh_hostkeymust = True 150 | if 'ssh_hostkeymust' in input_params['credential']: 151 | ssh_hostkeymust = input_params['credential']['ssh_hostkeymust'] 152 | throttle = input_params['throttle'] 153 | timeout = input_params['timeout'] 154 | vfid = input_params['vfid'] 155 | action_inputs = input_params['action_inputs'] 156 | result = {"changed": False} 157 | 158 | singleton_helper(module, fos_ip_addr, fos_user_name, fos_password, https, ssh_hostkeymust, throttle, vfid, "brocade_security", "sec_crypto_cfg_template_action", action_inputs, result, timeout) 159 | 160 | 161 | if __name__ == '__main__': 162 | main() 163 | -------------------------------------------------------------------------------- /library/brocade_security_security_certificate_action.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | from __future__ import (absolute_import, division, print_function) 10 | __metaclass__ = type 11 | 12 | 13 | DOCUMENTATION = ''' 14 | 15 | module: brocade_security_security_certificate_action 16 | short_description: Brocade Fibre Channel third-party certificate installation 17 | version_added: '2.7' 18 | author: Broadcom BSN Ansible Team 19 | description: 20 | - Use to import or export certificate 21 | 22 | options: 23 | credential: 24 | description: 25 | - Login information 26 | suboptions: 27 | fos_ip_addr: 28 | description: 29 | - IP address of the FOS switch 30 | required: true 31 | type: str 32 | fos_user_name: 33 | description: 34 | - Login name of FOS switch 35 | required: true 36 | type: str 37 | fos_password: 38 | description: 39 | - Password of FOS switch 40 | required: true 41 | type: str 42 | https: 43 | description: 44 | - Encryption to use. True for HTTPS, self for self-signed HTTPS, 45 | or False for HTTP 46 | choices: 47 | - True 48 | - False 49 | - self 50 | required: true 51 | type: str 52 | 53 | type: dict 54 | required: true 55 | vfid: 56 | description: 57 | - VFID of the switch. Use -1 for FOS without VF enabled or AG. 58 | type: int 59 | required: false 60 | throttle: 61 | description: 62 | - Throttling delay in seconds. Enables second retry on first 63 | failure. 64 | type: int 65 | timeout: 66 | description: 67 | - REST timeout in seconds for operations that take longer than FOS 68 | default value. 69 | type: int 70 | action_inputs: 71 | description: 72 | - Action attributes 73 | required: true 74 | type: dict 75 | 76 | ''' 77 | 78 | 79 | EXAMPLES = """ 80 | 81 | gather_facts: False 82 | 83 | vars: 84 | credential: 85 | fos_ip_addr: "{{fos_ip_addr}}" 86 | fos_user_name: admin 87 | fos_password: xxxx 88 | https: False 89 | 90 | tasks: 91 | 92 | - name: import or export certificate 93 | brocade_security_security_certificate_action: 94 | credential: "{{credential}}" 95 | vfid: -1 96 | action_inputs: 97 | 98 | """ 99 | 100 | 101 | RETURN = """ 102 | 103 | msg: 104 | description: Success message 105 | returned: success 106 | type: str 107 | 108 | """ 109 | 110 | 111 | """ 112 | Brocade Fibre Channel certificatei installation 113 | """ 114 | 115 | 116 | from ansible.module_utils.brocade_objects import singleton_helper 117 | from ansible.module_utils.basic import AnsibleModule 118 | 119 | 120 | def main(): 121 | """ 122 | Main function 123 | """ 124 | 125 | argument_spec = dict( 126 | credential=dict(required=True, type='dict', options=dict( 127 | fos_ip_addr=dict(required=True, type='str'), 128 | fos_user_name=dict(required=True, type='str'), 129 | fos_password=dict(required=True, type='str', no_log=True), 130 | https=dict(required=True, type='str'), 131 | ssh_hostkeymust=dict(required=False, type='bool'))), 132 | vfid=dict(required=False, type='int'), 133 | throttle=dict(required=False, type='int'), 134 | timeout=dict(required=False, type='int'), 135 | action_inputs=dict(required=True, type='dict')) 136 | 137 | module = AnsibleModule( 138 | argument_spec=argument_spec, 139 | supports_check_mode=True 140 | ) 141 | 142 | input_params = module.params 143 | 144 | # Set up state variables 145 | fos_ip_addr = input_params['credential']['fos_ip_addr'] 146 | fos_user_name = input_params['credential']['fos_user_name'] 147 | fos_password = input_params['credential']['fos_password'] 148 | https = input_params['credential']['https'] 149 | ssh_hostkeymust = True 150 | if 'ssh_hostkeymust' in input_params['credential']: 151 | ssh_hostkeymust = input_params['credential']['ssh_hostkeymust'] 152 | throttle = input_params['throttle'] 153 | timeout = input_params['timeout'] 154 | vfid = input_params['vfid'] 155 | action_inputs = input_params['action_inputs'] 156 | result = {"changed": False} 157 | 158 | singleton_helper(module, fos_ip_addr, fos_user_name, fos_password, https, ssh_hostkeymust, throttle, vfid, "brocade_security", "security_certificate_action", action_inputs, result, timeout) 159 | 160 | 161 | if __name__ == '__main__': 162 | main() 163 | -------------------------------------------------------------------------------- /library/brocade_security_security_certificate_generate.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | from __future__ import (absolute_import, division, print_function) 10 | __metaclass__ = type 11 | 12 | 13 | DOCUMENTATION = ''' 14 | 15 | module: brocade_security_security_certificate_generate 16 | short_description: Brocade Fibre Channel security CSR or certificate generation like HTTPS, LDAP, etc 17 | version_added: '2.7' 18 | author: Broadcom BSN Ansible Team 19 | description: 20 | - Use to generate CSR or certificate 21 | 22 | options: 23 | credential: 24 | description: 25 | - Login information 26 | suboptions: 27 | fos_ip_addr: 28 | description: 29 | - IP address of the FOS switch 30 | required: true 31 | type: str 32 | fos_user_name: 33 | description: 34 | - Login name of FOS switch 35 | required: true 36 | type: str 37 | fos_password: 38 | description: 39 | - Password of FOS switch 40 | required: true 41 | type: str 42 | https: 43 | description: 44 | - Encryption to use. True for HTTPS, self for self-signed HTTPS, 45 | or False for HTTP 46 | choices: 47 | - True 48 | - False 49 | - self 50 | required: true 51 | type: str 52 | 53 | type: dict 54 | required: true 55 | vfid: 56 | description: 57 | - VFID of the switch. Use -1 for FOS without VF enabled or AG. 58 | type: int 59 | required: false 60 | throttle: 61 | description: 62 | - Throttling delay in seconds. Enables second retry on first 63 | failure. 64 | type: int 65 | timeout: 66 | description: 67 | - REST timeout in seconds for operations that take longer than FOS 68 | default value. 69 | type: int 70 | generate_inputs: 71 | description: 72 | - Attributes used to generate CSR or CERT 73 | required: true 74 | type: dict 75 | 76 | ''' 77 | 78 | 79 | EXAMPLES = """ 80 | 81 | gather_facts: False 82 | 83 | vars: 84 | credential: 85 | fos_ip_addr: "{{fos_ip_addr}}" 86 | fos_user_name: admin 87 | fos_password: xxxx 88 | https: False 89 | 90 | tasks: 91 | 92 | - name: CSR or certificate generation 93 | brocade_security_security_certificate_generate: 94 | credential: "{{credential}}" 95 | vfid: -1 96 | generate_inputs: 97 | 98 | """ 99 | 100 | 101 | RETURN = """ 102 | 103 | msg: 104 | description: Success message 105 | returned: success 106 | type: str 107 | 108 | """ 109 | 110 | 111 | """ 112 | Brocade Fibre Channel security CSR or certificate generation 113 | """ 114 | 115 | 116 | from ansible.module_utils.brocade_objects import singleton_helper 117 | from ansible.module_utils.basic import AnsibleModule 118 | 119 | 120 | def main(): 121 | """ 122 | Main function 123 | """ 124 | 125 | argument_spec = dict( 126 | credential=dict(required=True, type='dict', options=dict( 127 | fos_ip_addr=dict(required=True, type='str'), 128 | fos_user_name=dict(required=True, type='str'), 129 | fos_password=dict(required=True, type='str', no_log=True), 130 | https=dict(required=True, type='str'), 131 | ssh_hostkeymust=dict(required=False, type='bool'))), 132 | vfid=dict(required=False, type='int'), 133 | throttle=dict(required=False, type='int'), 134 | timeout=dict(required=False, type='int'), 135 | generate_inputs=dict(required=True, type='dict')) 136 | 137 | module = AnsibleModule( 138 | argument_spec=argument_spec, 139 | supports_check_mode=True 140 | ) 141 | 142 | input_params = module.params 143 | 144 | # Set up state variables 145 | fos_ip_addr = input_params['credential']['fos_ip_addr'] 146 | fos_user_name = input_params['credential']['fos_user_name'] 147 | fos_password = input_params['credential']['fos_password'] 148 | https = input_params['credential']['https'] 149 | ssh_hostkeymust = True 150 | if 'ssh_hostkeymust' in input_params['credential']: 151 | ssh_hostkeymust = input_params['credential']['ssh_hostkeymust'] 152 | throttle = input_params['throttle'] 153 | timeout = input_params['timeout'] 154 | vfid = input_params['vfid'] 155 | generate_inputs = input_params['generate_inputs'] 156 | result = {"changed": False} 157 | 158 | singleton_helper(module, fos_ip_addr, fos_user_name, fos_password, https, ssh_hostkeymust, throttle, vfid, "brocade_security", "security_certificate_generate", generate_inputs, result, timeout) 159 | 160 | 161 | if __name__ == '__main__': 162 | main() 163 | -------------------------------------------------------------------------------- /library/brocade_security_sshutil_public_key_action.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | from __future__ import (absolute_import, division, print_function) 10 | __metaclass__ = type 11 | 12 | 13 | DOCUMENTATION = ''' 14 | 15 | module: brocade_security_sshutil_public_key_action 16 | short_description: Brocade Fibre Channel public key export or import 17 | version_added: '2.7' 18 | author: Broadcom BSN Ansible Team 19 | description: 20 | - Use to export or import public keys 21 | 22 | options: 23 | credential: 24 | description: 25 | - Login information 26 | suboptions: 27 | fos_ip_addr: 28 | description: 29 | - IP address of the FOS switch 30 | required: true 31 | type: str 32 | fos_user_name: 33 | description: 34 | - Login name of FOS switch 35 | required: true 36 | type: str 37 | fos_password: 38 | description: 39 | - Password of FOS switch 40 | required: true 41 | type: str 42 | https: 43 | description: 44 | - Encryption to use. True for HTTPS, self for self-signed HTTPS, 45 | or False for HTTP 46 | choices: 47 | - True 48 | - False 49 | - self 50 | required: true 51 | type: str 52 | 53 | type: dict 54 | required: true 55 | vfid: 56 | description: 57 | - VFID of the switch. Use -1 for FOS without VF enabled or AG. 58 | type: int 59 | required: false 60 | throttle: 61 | description: 62 | - Throttling delay in seconds. Enables second retry on first 63 | failure. 64 | type: int 65 | timeout: 66 | description: 67 | - REST timeout in seconds for operations that take longer than FOS 68 | default value. 69 | type: int 70 | action_inputs: 71 | description: 72 | - Action attributes 73 | required: true 74 | type: dict 75 | 76 | ''' 77 | 78 | 79 | EXAMPLES = """ 80 | 81 | gather_facts: False 82 | 83 | vars: 84 | credential: 85 | fos_ip_addr: "{{fos_ip_addr}}" 86 | fos_user_name: admin 87 | fos_password: xxxx 88 | https: False 89 | 90 | tasks: 91 | 92 | - name: public key import or export 93 | brocade_security_sshutil_public_key_action: 94 | credential: "{{credential}}" 95 | vfid: -1 96 | action_inputs: 97 | 98 | """ 99 | 100 | 101 | RETURN = """ 102 | 103 | msg: 104 | description: Success message 105 | returned: success 106 | type: str 107 | 108 | """ 109 | 110 | 111 | """ 112 | Brocade Fibre Channel public key import or export 113 | """ 114 | 115 | 116 | from ansible.module_utils.brocade_objects import singleton_helper 117 | from ansible.module_utils.basic import AnsibleModule 118 | 119 | 120 | def main(): 121 | """ 122 | Main function 123 | """ 124 | 125 | argument_spec = dict( 126 | credential=dict(required=True, type='dict', options=dict( 127 | fos_ip_addr=dict(required=True, type='str'), 128 | fos_user_name=dict(required=True, type='str'), 129 | fos_password=dict(required=True, type='str', no_log=True), 130 | https=dict(required=True, type='str'), 131 | ssh_hostkeymust=dict(required=False, type='bool'))), 132 | vfid=dict(required=False, type='int'), 133 | throttle=dict(required=False, type='int'), 134 | timeout=dict(required=False, type='int'), 135 | action_inputs=dict(required=True, type='dict')) 136 | 137 | module = AnsibleModule( 138 | argument_spec=argument_spec, 139 | supports_check_mode=True 140 | ) 141 | 142 | input_params = module.params 143 | 144 | # Set up state variables 145 | fos_ip_addr = input_params['credential']['fos_ip_addr'] 146 | fos_user_name = input_params['credential']['fos_user_name'] 147 | fos_password = input_params['credential']['fos_password'] 148 | https = input_params['credential']['https'] 149 | ssh_hostkeymust = True 150 | if 'ssh_hostkeymust' in input_params['credential']: 151 | ssh_hostkeymust = input_params['credential']['ssh_hostkeymust'] 152 | throttle = input_params['throttle'] 153 | timeout = input_params['timeout'] 154 | vfid = input_params['vfid'] 155 | action_inputs = input_params['action_inputs'] 156 | result = {"changed": False} 157 | 158 | singleton_helper(module, fos_ip_addr, fos_user_name, fos_password, https, ssh_hostkeymust, throttle, vfid, "brocade_security", "sshutil_public_key_action", action_inputs, result, timeout) 159 | 160 | 161 | if __name__ == '__main__': 162 | main() 163 | -------------------------------------------------------------------------------- /library/brocade_snmp_v1_account.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | from __future__ import (absolute_import, division, print_function) 10 | __metaclass__ = type 11 | 12 | 13 | DOCUMENTATION = ''' 14 | 15 | module: brocade_snmp_v1_account 16 | short_description: Brocade Fibre Channel SNMP v1 account configuration 17 | version_added: '2.7' 18 | author: Broadcom BSN Ansible Team 19 | description: 20 | - Update Fibre Channel SNMP v1 account 21 | 22 | options: 23 | credential: 24 | description: 25 | - Login information 26 | suboptions: 27 | fos_ip_addr: 28 | description: 29 | - IP address of the FOS switch 30 | required: true 31 | type: str 32 | fos_user_name: 33 | description: 34 | - Login name of FOS switch 35 | required: true 36 | type: str 37 | fos_password: 38 | description: 39 | - Password of FOS switch 40 | required: true 41 | type: str 42 | https: 43 | description: 44 | - Encryption to use. True for HTTPS, self for self-signed HTTPS, 45 | or False for HTTP 46 | choices: 47 | - True 48 | - False 49 | - self 50 | required: true 51 | type: str 52 | 53 | type: dict 54 | required: true 55 | vfid: 56 | description: 57 | - VFID of the switch. Use -1 for FOS without VF enabled or AG. 58 | type: int 59 | required: false 60 | throttle: 61 | description: 62 | - Throttling delay in seconds. Enables second retry on first 63 | failure. 64 | type: int 65 | timeout: 66 | description: 67 | - REST timeout in seconds for operations that take longer than FOS 68 | default value. 69 | type: int 70 | v1_accounts: 71 | description: 72 | - List of v1 accounts to be updated. All writable attributes supported 73 | by BSN REST API with - replaced with _. 74 | required: true 75 | type: list 76 | ''' 77 | 78 | 79 | EXAMPLES = """ 80 | 81 | gather_facts: False 82 | 83 | vars: 84 | credential: 85 | fos_ip_addr: "{{fos_ip_addr}}" 86 | fos_user_name: admin 87 | fos_password: xxxx 88 | https: False 89 | 90 | tasks: 91 | 92 | - name: snmp v1 accounts 93 | brocade_snmp_v1_account: 94 | credential: "{{credential}}" 95 | vfid: -1 96 | v1_accounts: 97 | - index: 1 98 | community_name: "secret code" 99 | - index: 2 100 | community_name: "oem" 101 | 102 | """ 103 | 104 | 105 | RETURN = """ 106 | 107 | msg: 108 | description: Success message 109 | returned: success 110 | type: str 111 | 112 | """ 113 | 114 | 115 | """ 116 | Brocade Fibre Channel SNMP v1 account configuration 117 | """ 118 | 119 | 120 | from ansible.module_utils.brocade_objects import list_helper 121 | from ansible.module_utils.basic import AnsibleModule 122 | 123 | 124 | def main(): 125 | """ 126 | Main function 127 | """ 128 | 129 | argument_spec = dict( 130 | credential=dict(required=True, type='dict', options=dict( 131 | fos_ip_addr=dict(required=True, type='str'), 132 | fos_user_name=dict(required=True, type='str'), 133 | fos_password=dict(required=True, type='str', no_log=True), 134 | https=dict(required=True, type='str'), 135 | ssh_hostkeymust=dict(required=False, type='bool'))), 136 | vfid=dict(required=False, type='int'), 137 | throttle=dict(required=False, type='int'), 138 | timeout=dict(required=False, type='int'), 139 | v1_accounts=dict(required=True, type='list')) 140 | 141 | module = AnsibleModule( 142 | argument_spec=argument_spec, 143 | supports_check_mode=True 144 | ) 145 | 146 | input_params = module.params 147 | 148 | # Set up state variables 149 | fos_ip_addr = input_params['credential']['fos_ip_addr'] 150 | fos_user_name = input_params['credential']['fos_user_name'] 151 | fos_password = input_params['credential']['fos_password'] 152 | https = input_params['credential']['https'] 153 | throttle = input_params['throttle'] 154 | timeout = input_params['timeout'] 155 | vfid = input_params['vfid'] 156 | v1_accounts = input_params['v1_accounts'] 157 | result = {"changed": False} 158 | 159 | list_helper(module, fos_ip_addr, fos_user_name, fos_password, https, True, throttle, vfid, "brocade_snmp", "v1_account", v1_accounts, False, result, timeout) 160 | 161 | 162 | if __name__ == '__main__': 163 | main() 164 | -------------------------------------------------------------------------------- /library/brocade_snmp_v1_trap.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | from __future__ import (absolute_import, division, print_function) 10 | __metaclass__ = type 11 | 12 | 13 | DOCUMENTATION = ''' 14 | 15 | module: brocade_snmp_v1_trap 16 | short_description: Brocade Fibre Channel SNMP v1 trap configuration 17 | version_added: '2.7' 18 | author: Broadcom BSN Ansible Team 19 | description: 20 | - Update Fibre Channel SNMP v1 trap 21 | 22 | options: 23 | credential: 24 | description: 25 | - Login information 26 | suboptions: 27 | fos_ip_addr: 28 | description: 29 | - IP address of the FOS switch 30 | required: true 31 | type: str 32 | fos_user_name: 33 | description: 34 | - Login name of FOS switch 35 | required: true 36 | type: str 37 | fos_password: 38 | description: 39 | - Password of FOS switch 40 | required: true 41 | type: str 42 | https: 43 | description: 44 | - Encryption to use. True for HTTPS, self for self-signed HTTPS, 45 | or False for HTTP 46 | choices: 47 | - True 48 | - False 49 | - self 50 | required: true 51 | type: str 52 | 53 | type: dict 54 | required: true 55 | vfid: 56 | description: 57 | - VFID of the switch. Use -1 for FOS without VF enabled or AG. 58 | type: int 59 | required: false 60 | throttle: 61 | description: 62 | - Throttling delay in seconds. Enables second retry on first 63 | failure. 64 | type: int 65 | timeout: 66 | description: 67 | - REST timeout in seconds for operations that take longer than FOS 68 | default value. 69 | type: int 70 | v1_traps: 71 | description: 72 | - List of v1 traps to be updated. All writable attributes supported 73 | by BSN REST API with - replaced with _. 74 | required: true 75 | type: list 76 | 77 | ''' 78 | 79 | 80 | EXAMPLES = """ 81 | 82 | gather_facts: False 83 | 84 | vars: 85 | credential: 86 | fos_ip_addr: "{{fos_ip_addr}}" 87 | fos_user_name: admin 88 | fos_password: xxxx 89 | https: False 90 | 91 | tasks: 92 | 93 | - name: snmp v1 traps 94 | brocade_snmp_v1_trap: 95 | credential: "{{credential}}" 96 | vfid: -1 97 | v1_traps: 98 | - index: 1 99 | host: "10.10.10.10" 100 | port_number: 1010 101 | trap_severity_level: "warning" 102 | 103 | """ 104 | 105 | 106 | RETURN = """ 107 | 108 | msg: 109 | description: Success message 110 | returned: success 111 | type: str 112 | 113 | """ 114 | 115 | 116 | """ 117 | Brocade Fibre Channel SNMP v1 trap configuration 118 | """ 119 | 120 | 121 | from ansible.module_utils.brocade_objects import list_helper 122 | from ansible.module_utils.basic import AnsibleModule 123 | 124 | 125 | def main(): 126 | """ 127 | Main function 128 | """ 129 | 130 | argument_spec = dict( 131 | credential=dict(required=True, type='dict', options=dict( 132 | fos_ip_addr=dict(required=True, type='str'), 133 | fos_user_name=dict(required=True, type='str'), 134 | fos_password=dict(required=True, type='str', no_log=True), 135 | https=dict(required=True, type='str'), 136 | ssh_hostkeymust=dict(required=False, type='bool'))), 137 | vfid=dict(required=False, type='int'), 138 | throttle=dict(required=False, type='int'), 139 | timeout=dict(required=False, type='int'), 140 | v1_traps=dict(required=True, type='list')) 141 | 142 | module = AnsibleModule( 143 | argument_spec=argument_spec, 144 | supports_check_mode=True 145 | ) 146 | 147 | input_params = module.params 148 | 149 | # Set up state variables 150 | fos_ip_addr = input_params['credential']['fos_ip_addr'] 151 | fos_user_name = input_params['credential']['fos_user_name'] 152 | fos_password = input_params['credential']['fos_password'] 153 | https = input_params['credential']['https'] 154 | throttle = input_params['throttle'] 155 | timeout = input_params['timeout'] 156 | vfid = input_params['vfid'] 157 | v1_traps = input_params['v1_traps'] 158 | result = {"changed": False} 159 | 160 | list_helper(module, fos_ip_addr, fos_user_name, fos_password, https, True, throttle, vfid, "brocade_snmp", "v1_trap", v1_traps, False, result, timeout) 161 | 162 | 163 | if __name__ == '__main__': 164 | main() 165 | -------------------------------------------------------------------------------- /library/brocade_snmp_v3_trap.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | from __future__ import (absolute_import, division, print_function) 10 | __metaclass__ = type 11 | 12 | 13 | DOCUMENTATION = ''' 14 | 15 | module: brocade_snmp_v3_trap 16 | short_description: Brocade Fibre Channel SNMP v3 trap configuration 17 | version_added: '2.7' 18 | author: Broadcom BSN Ansible Team 19 | description: 20 | - Update Fibre Channel SNMP v3 trap 21 | 22 | options: 23 | credential: 24 | description: 25 | - Login information 26 | suboptions: 27 | fos_ip_addr: 28 | description: 29 | - IP address of the FOS switch 30 | required: true 31 | type: str 32 | fos_user_name: 33 | description: 34 | - Login name of FOS switch 35 | required: true 36 | type: str 37 | fos_password: 38 | description: 39 | - Password of FOS switch 40 | required: true 41 | type: str 42 | https: 43 | description: 44 | - Encryption to use. True for HTTPS, self for self-signed HTTPS, 45 | or False for HTTP 46 | choices: 47 | - True 48 | - False 49 | - self 50 | required: true 51 | type: str 52 | 53 | type: dict 54 | required: true 55 | vfid: 56 | description: 57 | - VFID of the switch. Use -1 for FOS without VF enabled or AG. 58 | type: int 59 | required: false 60 | throttle: 61 | description: 62 | - Throttling delay in seconds. Enables second retry on first 63 | failure. 64 | type: int 65 | timeout: 66 | description: 67 | - REST timeout in seconds for operations that take longer than FOS 68 | default value. 69 | type: int 70 | v3_traps: 71 | description: 72 | - List of v3 traps to be updated. All writable attributes supported 73 | by BSN REST API with - replaced with _. 74 | required: true 75 | type: list 76 | 77 | ''' 78 | 79 | 80 | EXAMPLES = """ 81 | 82 | gather_facts: False 83 | 84 | vars: 85 | credential: 86 | fos_ip_addr: "{{fos_ip_addr}}" 87 | fos_user_name: admin 88 | fos_password: xxxx 89 | https: False 90 | 91 | tasks: 92 | 93 | - name: snmp v3 traps 94 | brocade_snmp_v3_trap: 95 | credential: "{{credential}}" 96 | vfid: -1 97 | v3_traps: 98 | - trap_index: 1 99 | host: "10.10.10.11" 100 | informs_enabled: true 101 | port_number: 1011 102 | trap_severity_level: "warning" 103 | usm_index: 1 104 | 105 | """ 106 | 107 | 108 | RETURN = """ 109 | 110 | msg: 111 | description: Success message 112 | returned: success 113 | type: str 114 | 115 | """ 116 | 117 | 118 | """ 119 | Brocade Fibre Channel SNMP v3 trap configuration 120 | """ 121 | 122 | 123 | from ansible.module_utils.brocade_objects import list_helper 124 | from ansible.module_utils.basic import AnsibleModule 125 | 126 | 127 | def main(): 128 | """ 129 | Main function 130 | """ 131 | 132 | argument_spec = dict( 133 | credential=dict(required=True, type='dict', options=dict( 134 | fos_ip_addr=dict(required=True, type='str'), 135 | fos_user_name=dict(required=True, type='str'), 136 | fos_password=dict(required=True, type='str', no_log=True), 137 | https=dict(required=True, type='str'), 138 | ssh_hostkeymust=dict(required=False, type='bool'))), 139 | vfid=dict(required=False, type='int'), 140 | throttle=dict(required=False, type='int'), 141 | timeout=dict(required=False, type='int'), 142 | v3_traps=dict(required=True, type='list')) 143 | 144 | module = AnsibleModule( 145 | argument_spec=argument_spec, 146 | supports_check_mode=True 147 | ) 148 | 149 | input_params = module.params 150 | 151 | # Set up state variables 152 | fos_ip_addr = input_params['credential']['fos_ip_addr'] 153 | fos_user_name = input_params['credential']['fos_user_name'] 154 | fos_password = input_params['credential']['fos_password'] 155 | https = input_params['credential']['https'] 156 | throttle = input_params['throttle'] 157 | timeout = input_params['timeout'] 158 | vfid = input_params['vfid'] 159 | v3_traps = input_params['v3_traps'] 160 | result = {"changed": False} 161 | 162 | list_helper(module, fos_ip_addr, fos_user_name, fos_password, https, True, throttle, vfid, "brocade_snmp", "v3_trap", v3_traps, False, result, timeout) 163 | 164 | 165 | if __name__ == '__main__': 166 | main() 167 | -------------------------------------------------------------------------------- /library/brocade_time_time_zone.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | from __future__ import (absolute_import, division, print_function) 10 | __metaclass__ = type 11 | 12 | 13 | DOCUMENTATION = ''' 14 | 15 | module: brocade_time_time_zone 16 | short_description: Brocade Fibre Channel time zone configuration 17 | version_added: '2.7' 18 | author: Broadcom BSN Ansible Team 19 | description: 20 | - Update time zone configuration 21 | 22 | options: 23 | credential: 24 | description: 25 | - Login information 26 | suboptions: 27 | fos_ip_addr: 28 | description: 29 | - IP address of the FOS switch 30 | required: true 31 | type: str 32 | fos_user_name: 33 | description: 34 | - Login name of FOS switch 35 | required: true 36 | type: str 37 | fos_password: 38 | description: 39 | - Password of FOS switch 40 | required: true 41 | type: str 42 | https: 43 | description: 44 | - Encryption to use. True for HTTPS, self for self-signed HTTPS, 45 | or False for HTTP 46 | choices: 47 | - True 48 | - False 49 | - self 50 | required: true 51 | type: str 52 | 53 | type: dict 54 | required: true 55 | vfid: 56 | description: 57 | - VFID of the switch. Use -1 for FOS without VF enabled or AG. 58 | type: int 59 | required: false 60 | throttle: 61 | description: 62 | - Throttling delay in seconds. Enables second retry on first 63 | failure. 64 | type: int 65 | timeout: 66 | description: 67 | - REST timeout in seconds for operations that take longer than FOS 68 | default value. 69 | type: int 70 | time_zone: 71 | description: 72 | - Time zone data structure. 73 | All writable attributes supported 74 | by BSN REST API with - replaced with _. 75 | required: false 76 | type: dict 77 | 78 | ''' 79 | 80 | 81 | EXAMPLES = """ 82 | 83 | gather_facts: False 84 | 85 | vars: 86 | credential: 87 | fos_ip_addr: "{{fos_ip_addr}}" 88 | fos_user_name: admin 89 | fos_password: xxxx 90 | https: False 91 | 92 | tasks: 93 | 94 | - name: initial time zone configuration 95 | brocade_time_time_zone: 96 | credential: "{{credential}}" 97 | vfid: -1 98 | time_zone: 99 | name: "America/Chicago" 100 | 101 | """ 102 | 103 | 104 | RETURN = """ 105 | 106 | msg: 107 | description: Success message 108 | returned: success 109 | type: str 110 | 111 | """ 112 | 113 | 114 | """ 115 | Brocade Fibre Channel time zone configuration 116 | """ 117 | 118 | 119 | from ansible.module_utils.brocade_objects import singleton_helper 120 | from ansible.module_utils.basic import AnsibleModule 121 | 122 | 123 | def main(): 124 | """ 125 | Main function 126 | """ 127 | 128 | argument_spec = dict( 129 | credential=dict(required=True, type='dict', options=dict( 130 | fos_ip_addr=dict(required=True, type='str'), 131 | fos_user_name=dict(required=True, type='str'), 132 | fos_password=dict(required=True, type='str', no_log=True), 133 | https=dict(required=True, type='str'), 134 | ssh_hostkeymust=dict(required=False, type='bool'))), 135 | vfid=dict(required=False, type='int'), 136 | throttle=dict(required=False, type='int'), 137 | timeout=dict(required=False, type='int'), 138 | time_zone=dict(required=False, type='dict')) 139 | 140 | module = AnsibleModule( 141 | argument_spec=argument_spec, 142 | supports_check_mode=True 143 | ) 144 | 145 | input_params = module.params 146 | 147 | # Set up state variables 148 | fos_ip_addr = input_params['credential']['fos_ip_addr'] 149 | fos_user_name = input_params['credential']['fos_user_name'] 150 | fos_password = input_params['credential']['fos_password'] 151 | https = input_params['credential']['https'] 152 | throttle = input_params['throttle'] 153 | timeout = input_params['timeout'] 154 | vfid = input_params['vfid'] 155 | time_zone = input_params['time_zone'] 156 | result = {"changed": False} 157 | 158 | singleton_helper(module, fos_ip_addr, fos_user_name, fos_password, https, True, throttle, vfid, "brocade_time", "time_zone", time_zone, result, timeout) 159 | 160 | 161 | if __name__ == '__main__': 162 | main() 163 | -------------------------------------------------------------------------------- /logical_switch.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | non_default_switches: 19 | - fabric_id: 1 20 | base_switch_enabled: 0 21 | ficon_mode_enabled: 0 22 | logical_isl_enabled: 1 23 | port_member_list: 24 | port_member: 25 | - "0/0" 26 | - "0/1" 27 | - "0/2" 28 | 29 | tasks: 30 | 31 | - name: configure all non-default logical switch 32 | brocade_fibrechannel_logical_switch_fibrechannel_logical_switch: 33 | credential: "{{credential}}" 34 | vfid: -1 35 | logical_switches: "{{non_default_switches}}" 36 | -------------------------------------------------------------------------------- /maps_policy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: create my policy 22 | brocade_maps_maps_policy: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | maps_policies: 26 | - name: my_policy 27 | is_active_policy: False 28 | rule_list: 29 | rule: 30 | - my_rule1 31 | - my_rule2 32 | -------------------------------------------------------------------------------- /maps_policy_delete.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: delete my policy 22 | brocade_list_obj: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | module_name: "brocade-maps" 26 | list_name: "maps-policy" 27 | throttle: 5 28 | timeout: 300 29 | delete_entries: 30 | - name: my_policy 31 | -------------------------------------------------------------------------------- /maps_rule.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: create my rules 22 | brocade_maps_rule: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | rules: 26 | - name: my_rule1 27 | actions: 28 | action: 29 | - "raslog" 30 | event_severity: null 31 | group_name: "ALL_E_PORTS" 32 | is_rule_on_rule: False 33 | logical_operator: "g" 34 | monitoring_system: "C3TXTO" 35 | quiet_time: 0 36 | threshold_value: 1 37 | time_base: "Min" 38 | - name: my_rule2 39 | actions: 40 | action: 41 | - "raslog" 42 | event_severity: null 43 | group_name: "ALL_E_PORTS" 44 | is_rule_on_rule: False 45 | logical_operator: "g" 46 | monitoring_system: "C3TXTO" 47 | quiet_time: 0 48 | threshold_value: 1 49 | time_base: "Min" 50 | -------------------------------------------------------------------------------- /maps_rule_policy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | policyname: my_policy 19 | rule1: my_rule1 20 | rule2: my_rule2 21 | myrule: 22 | - name: "{{rule1}}" 23 | actions: 24 | action: 25 | - "raslog" 26 | event_severity: null 27 | group_name: "ALL_E_PORTS" 28 | is_rule_on_rule: False 29 | logical_operator: "g" 30 | monitoring_system: "C3TXTO" 31 | quiet_time: 0 32 | threshold_value: 1 33 | time_base: "Min" 34 | - name: "{{rule2}}" 35 | actions: 36 | action: 37 | - "raslog" 38 | event_severity: null 39 | group_name: "ALL_E_PORTS" 40 | is_rule_on_rule: False 41 | logical_operator: "g" 42 | monitoring_system: "C3TXTO" 43 | quiet_time: 0 44 | threshold_value: 1 45 | time_base: "Min" 46 | mypolicy: 47 | - name: "{{policyname}}" 48 | is_active_policy: True 49 | rule_list: 50 | rule: 51 | - "{{rule1}}" 52 | - "{{rule2}}" 53 | 54 | tasks: 55 | 56 | - name: check to see if rules are being changed 57 | brocade_maps_rule: 58 | credential: "{{credential}}" 59 | vfid: -1 60 | rules: "{{myrule}}" 61 | check_mode: yes 62 | register: rules_changed 63 | 64 | # - debug: var=rules_changed 65 | - debug: var=rules_changed.remain_brocade_maps_rule 66 | 67 | - name: activate a dummy policy with empty list of rules 68 | brocade_maps_maps_policy: 69 | credential: "{{credential}}" 70 | vfid: -1 71 | maps_policies: 72 | - name: dummy_policy 73 | is_active_policy: True 74 | rule_list: 75 | rule: "{{rules_changed.remain_brocade_maps_rule}}" 76 | when: rules_changed.changed 77 | 78 | - name: create my rules 79 | brocade_maps_rule: 80 | credential: "{{credential}}" 81 | vfid: -1 82 | rules: "{{myrule}}" 83 | 84 | - name: create my policy 85 | brocade_maps_maps_policy: 86 | credential: "{{credential}}" 87 | vfid: -1 88 | maps_policies: "{{mypolicy}}" 89 | -------------------------------------------------------------------------------- /module_compatibility.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | # Note: Please set 'BROCADE_VERSION_PATH' environment variable 9 | # to the version file 'test_version_matrix.rst' 10 | # By default galaxy collection is installed under ~/.ansible/collections, 11 | # in that case the following example shows how to set the environment variable 12 | # in the Linux system 13 | # export BROCADE_VERSION_PATH=~/.ansible/collections/ansible_collections/brocade/fos/test_version_matrix.rst 14 | 15 | - hosts: san_eng_zone_seed_san_a 16 | gather_facts: False 17 | 18 | vars: 19 | credential: 20 | fos_ip_addr: "{{fos_ip_addr}}" 21 | fos_user_name: "{{fos_user_name}}" 22 | fos_password: "{{fos_password}}" 23 | https: "{{fos_https}}" 24 | 25 | tasks: 26 | 27 | - name: check module(s) are compatible with the given switch version 28 | brocade_module_compatibility: 29 | credential: "{{credential}}" 30 | -------------------------------------------------------------------------------- /password.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: change password 22 | brocade_security_password: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | password: 26 | user_name: "admin" 27 | old_password: "password3" 28 | new_password: "password4" 29 | -------------------------------------------------------------------------------- /portname.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: set portname - user_friendly_name. 22 | brocade_interface_fibrechannel: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | ports: 26 | - name: "0/0" 27 | user_friendly_name: "my_port0" 28 | -------------------------------------------------------------------------------- /relay_server.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | maps_config: 19 | relay_ip_address: "10.10.10.11" 20 | domain_name: "dd.com" 21 | sender_address: "s@dd.com" 22 | recipient_address_list: 23 | recipient_address: 24 | - "r@dd.com" 25 | - "r@rr.com" 26 | 27 | tasks: 28 | 29 | - name: configure relay server 30 | brocade_maps_maps_config: 31 | credential: "{{credential}}" 32 | vfid: -1 33 | maps_config: "{{maps_config}}" 34 | -------------------------------------------------------------------------------- /san-inventory: -------------------------------------------------------------------------------- 1 | san_eng_zone_seed_san_a ansible_connection=local fos_ip_addr=10.155.107.74 fos_user_name=admin fos_password=password fos_https=False 2 | #san_eng_zone_seed_san_a ansible_connection=local fos_ip_addr=10.155.107.32 fos_user_name=admin fos_password=password fos_https=False 3 | -------------------------------------------------------------------------------- /sec_crypto_cfg_template_apply.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | action_inputs: 19 | template_name: default_generic 20 | action: apply 21 | 22 | tasks: 23 | 24 | - name: apply template. warning - this task will always change. 25 | brocade_security_sec_crypto_cfg_template_action: 26 | credential: "{{credential}}" 27 | vfid: -1 28 | action_inputs: "{{action_inputs}}" 29 | -------------------------------------------------------------------------------- /sec_crypto_cfg_template_export.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | action_inputs: 19 | remote_user_name: name 20 | remote_host_ip: "xx.xx.xx.xx" 21 | remote_user_password: "passwordincleartext" 22 | remote_directory: /directory 23 | file_transfer_protocol_type: "scp" 24 | template_name: default_generic 25 | action: export 26 | 27 | tasks: 28 | 29 | - name: export template. warning - this task will always change. 30 | brocade_security_sec_crypto_cfg_template_action: 31 | credential: "{{credential}}" 32 | vfid: -1 33 | action_inputs: "{{action_inputs}}" 34 | -------------------------------------------------------------------------------- /sec_crypto_cfg_template_import.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | action_inputs: 19 | remote_user_name: name 20 | remote_host_ip: "xx.xx.xx.xx" 21 | remote_user_password: "passwordincleartext" 22 | remote_directory: /directory_path/append_template_name_at_the_end 23 | file_transfer_protocol_type: "scp" 24 | template_name: new_template_name 25 | action: import 26 | 27 | tasks: 28 | 29 | - name: import cfg template. warning - this task will always change. 30 | brocade_security_sec_crypto_cfg_template_action: 31 | credential: "{{credential}}" 32 | vfid: -1 33 | action_inputs: "{{action_inputs}}" 34 | -------------------------------------------------------------------------------- /showstatus.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | show_status: 19 | message_id: 20000 20 | 21 | tasks: 22 | 23 | - name: show status 24 | brocade_operation_show_status: 25 | credential: "{{credential}}" 26 | vfid: -1 27 | show_status: "{{show_status}}" 28 | register: result 29 | until: result.operation_resp is not defined or result.operation_resp.show_status.status == "done" or result.operation_resp.show_status.status == "delivered" 30 | retries: 100 31 | delay: 10 32 | 33 | - name: print ansible_facts gathered 34 | debug: 35 | var: result.operation_resp 36 | 37 | -------------------------------------------------------------------------------- /snmp.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019-2025 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | snmp_system: 19 | audit_interval: 60 20 | contact: "more Field Support." 21 | description: "more DemoSwitch" 22 | encryption_enabled: True 23 | informs_enabled: True 24 | location: "more San Jose" 25 | security_get_level: 0 26 | security_set_level: 3 27 | snmpv1_enabled: False 28 | v1_accounts: 29 | - index: 1 30 | community_name: "Secret code new" 31 | community_group: "read-write" 32 | - index: 2 33 | community_name: "OrigEquipMfr new" 34 | community_group: "read-write" 35 | - index: 3 36 | community_name: "private" 37 | community_group: "read-write" 38 | - index: 4 39 | community_name: "public" 40 | community_group: "read-only" 41 | - index: 5 42 | community_name: "common" 43 | community_group: "read-only" 44 | - index: 6 45 | community_name: "FibreChannelNew" 46 | community_group: "read-only" 47 | v1_traps: 48 | - index: 1 49 | host: "10.10.10.12" 50 | port_number: 1002 51 | trap_severity_level: "warning" 52 | v3_accounts: 53 | - index: 1 54 | authentication_protocol: "md5" 55 | manager_engine_id: "00:00:00:00:00:00:00:00:00" 56 | privacy_protocol: "aes128" 57 | user_name: "asc-test" 58 | user_group: "read-only" 59 | authentication_password: "password1" 60 | privacy_password: "password1" 61 | - index: 2 62 | authentication_protocol: "sha" 63 | manager_engine_id: "00:00:00:00:00:00:00:00:00" 64 | privacy_protocol: "des" 65 | user_name: "snmpadmin2" 66 | user_group: "read-write" 67 | authentication_password: "password2" 68 | privacy_password: "password2" 69 | v3_traps: 70 | - trap_index: 1 71 | host: "10.10.10.11" 72 | informs_enabled: true 73 | port_number: 1011 74 | trap_severity_level: "warning" 75 | usm_index: 1 76 | - trap_index: 2 77 | host: "10.10.10.10" 78 | informs_enabled: false 79 | port_number: 1010 80 | trap_severity_level: "critical" 81 | usm_index: 2 82 | - trap_index: 3 83 | host: "0.0.0.0" 84 | informs_enabled: false 85 | port_number: 162 86 | trap_severity_level: "none" 87 | usm_index: 3 88 | - trap_index: 4 89 | host: "0.0.0.0" 90 | informs_enabled: false 91 | port_number: 162 92 | trap_severity_level: "none" 93 | usm_index: 4 94 | - trap_index: 5 95 | host: "0.0.0.0" 96 | informs_enabled: false 97 | port_number: 162 98 | trap_severity_level: "none" 99 | usm_index: 5 100 | - trap_index: 6 101 | host: "0.0.0.0" 102 | informs_enabled: false 103 | port_number: 162 104 | trap_severity_level: "none" 105 | usm_index: 6 106 | v3_accounts_passwords_only: 107 | - index: 1 108 | authentication_password: "password1" 109 | privacy_password: "password1" 110 | - index: 2 111 | authentication_password: "password2" 112 | privacy_password: "password" 113 | 114 | tasks: 115 | 116 | - name: change all snmp system configuration 117 | brocade_snmp_system: 118 | credential: "{{credential}}" 119 | vfid: -1 120 | snmp_system: "{{snmp_system}}" 121 | 122 | - name: v1 accounts 123 | brocade_snmp_v1_account: 124 | credential: "{{credential}}" 125 | vfid: -1 126 | v1_accounts: "{{v1_accounts}}" 127 | 128 | - name: v1 traps 129 | brocade_snmp_v1_trap: 130 | credential: "{{credential}}" 131 | vfid: -1 132 | v1_traps: "{{v1_traps}}" 133 | 134 | - name: v3 accounts - setup attributes 135 | brocade_snmp_v3_account: 136 | credential: "{{credential}}" 137 | vfid: -1 138 | v3_accounts: "{{v3_accounts}}" 139 | 140 | - name: v3 traps 141 | brocade_snmp_v3_trap: 142 | credential: "{{credential}}" 143 | vfid: -1 144 | v3_traps: "{{v3_traps}}" 145 | 146 | - name: v3 accounts - set passwords. warning - password cannot be read. this task will always change. 147 | brocade_snmp_v3_account: 148 | credential: "{{credential}}" 149 | vfid: -1 150 | v3_accounts: "{{v3_accounts_passwords_only}}" 151 | -------------------------------------------------------------------------------- /snmp_access_control.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2021 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: access control for snmp 22 | brocade_list_obj: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | module_name: "brocade_snmp" 26 | list_name: "access_control" 27 | entries: 28 | - index: 1 29 | host: "10.10.10.11" 30 | access_level: "ro" 31 | - index: 2 32 | host: "10.10.10.10" 33 | access_level: "rw" 34 | -------------------------------------------------------------------------------- /snmp_reset.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | snmp_system: 19 | default_config: 20 | default_control: 21 | - snmpv1 22 | - snmpv3 23 | 24 | tasks: 25 | 26 | - name: change all snmp system configuration 27 | brocade_snmp_system: 28 | credential: "{{credential}}" 29 | vfid: -1 30 | snmp_system: "{{snmp_system}}" 31 | -------------------------------------------------------------------------------- /sshutil_public_key_delete.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | delete_sshutil_public_key: 19 | - user_name: "admin" 20 | 21 | tasks: 22 | 23 | 24 | - name: delete public keys for admin 25 | brocade_security_sshutil_public_key: 26 | credential: "{{credential}}" 27 | vfid: -1 28 | delete_sshutil_public_key: "{{delete_sshutil_public_key}}" 29 | -------------------------------------------------------------------------------- /sshutil_public_key_import.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | action_inputs: 19 | remote_user_name: username 20 | remote_host_ip: "xx.xx.xx.xx" 21 | remote_user_password: password 22 | remote_directory: /home/username/.ssh 23 | user_name: admin 24 | public_key_name: id_rsa.pub 25 | action: import 26 | 27 | tasks: 28 | 29 | - name: import public key. Existing public key is not compared. The task will always change. 30 | brocade_security_sshutil_public_key_action: 31 | credential: "{{credential}}" 32 | vfid: -1 33 | action_inputs: "{{action_inputs}}" 34 | -------------------------------------------------------------------------------- /supportsave.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2021 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | supportsave: 19 | host: "xx.xx.xx.xx" 20 | user_name: "username" 21 | password: "password" 22 | remote_directory: "/directory_to_save" 23 | protocol: "scp" 24 | 25 | tasks: 26 | 27 | - name: initiate supportsave 28 | brocade_operation_supportsave: 29 | credential: "{{credential}}" 30 | vfid: -1 31 | supportsave: "{{supportsave}}" 32 | register: result 33 | 34 | - name: print supportsave initial status 35 | debug: 36 | var: result.operation_resp 37 | 38 | - name: show status 39 | brocade_operation_show_status: 40 | credential: "{{credential}}" 41 | vfid: -1 42 | show_status: 43 | message_id: "{{result.operation_resp.show_status.message_id}}" 44 | register: status_result 45 | until: status_result.operation_resp is not defined or status_result.operation_resp.show_status.status == "done" or status_result.operation_resp.show_status.status == "delivered" 46 | retries: 150 47 | delay: 10 48 | 49 | - name: print show_status end result 50 | debug: 51 | var: status_result.operation_resp 52 | -------------------------------------------------------------------------------- /tasks/zoning_to_yml.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright 2018 Brocade Communications Systems LLC. All rights reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may also obtain a copy of the License at 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | """ 17 | 18 | :mod:`zoning_to_yml` - PyFOS util for specific Zoning use case. 19 | *********************************************************************************** 20 | The :mod:`zoning_to_yml` provides for specific Zoning use case. 21 | 22 | This module is a standalone script to display Zone DB in yml. 23 | 24 | * inputs: 25 | * -L=: Login ID. If not provided, interactive 26 | prompt will request one. 27 | * -P=: Password. If not provided, interactive 28 | prompt will request one. 29 | * -i=: IP address 30 | * -f=: VFID or -1 if VF is disabled. If unspecified, 31 | VFID of 128 is assumed. 32 | 33 | * outputs: 34 | * Python dictionary content with RESTCONF response data 35 | 36 | """ 37 | 38 | import sys 39 | from pyfos import pyfos_auth 40 | import pyfos.pyfos_brocade_zone as pyfos_zone 41 | from pyfos import pyfos_util 42 | from pyfos.utils import brcd_util 43 | 44 | 45 | def usage(): 46 | print("") 47 | 48 | 49 | def main(argv): 50 | valid_options = [] 51 | inputs = brcd_util.generic_input(argv, usage, valid_options) 52 | 53 | session = pyfos_auth.login(inputs["login"], inputs["password"], 54 | inputs["ipaddr"], inputs["secured"], 55 | verbose=inputs["verbose"]) 56 | if pyfos_auth.is_failed_login(session): 57 | print("login failed because", 58 | session.get(pyfos_auth.CREDENTIAL_KEY) 59 | [pyfos_auth.LOGIN_ERROR_KEY]) 60 | brcd_util.full_usage(usage, valid_options) 61 | sys.exit() 62 | 63 | brcd_util.exit_register(session) 64 | 65 | vfid = None 66 | if 'vfid' in inputs: 67 | vfid = inputs['vfid'] 68 | 69 | if vfid is not None: 70 | pyfos_auth.vfid_set(session, vfid) 71 | 72 | defined_zone = pyfos_zone.defined_configuration.get(session) 73 | 74 | print("aliases:") 75 | for alias in defined_zone.peek_alias(): 76 | print(" - name:", alias["alias-name"]) 77 | print(" members:") 78 | for member in alias["member-entry"]["alias-entry-name"]: 79 | print(" - ", member) 80 | 81 | print() 82 | 83 | print("zones:") 84 | for zone in defined_zone.peek_zone(): 85 | print(" - name:", zone["zone-name"]) 86 | if len(zone["member-entry"]["entry-name"]) > 0: 87 | print(" members:") 88 | for member in zone["member-entry"]["entry-name"]: 89 | print(" - ", member) 90 | if len(zone["member-entry"]["principal-entry-name"]) > 0: 91 | print(" principal_members:") 92 | for member in zone["member-entry"]["principal-entry-name"]: 93 | print(" - ", member) 94 | 95 | print() 96 | 97 | print("cfgs:") 98 | for cfg in defined_zone.peek_cfg(): 99 | print(" - name:", cfg["cfg-name"]) 100 | print(" members:") 101 | for member in cfg["member-zone"]["zone-name"]: 102 | print(" - ", member) 103 | 104 | # effective_zone = pyfos_zone.effective_configuration.get(session) 105 | # pyfos_util.response_print(effective_zone) 106 | 107 | # options = effective_zone.options(session) 108 | # print(options) 109 | 110 | pyfos_auth.logout(session) 111 | 112 | 113 | if __name__ == "__main__": 114 | main(sys.argv[1:]) 115 | -------------------------------------------------------------------------------- /template_facts.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: gather facts 22 | brocade_facts: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | gather_subset: 26 | - brocade_zoning 27 | - brocade_security_ipfilter_policy 28 | 29 | - name: gather facts for brocade_chassis_chassis 30 | brocade_singleton_obj_facts: 31 | credential: "{{credential}}" 32 | vfid: -1 33 | module_name: "brocade_chassis" 34 | obj_name: "chassis" 35 | 36 | - name: gather facts for brocade_fibrechannel_configuration_fabric 37 | brocade_singleton_obj_facts: 38 | credential: "{{credential}}" 39 | vfid: -1 40 | module_name: "brocade_fibrechannel_configuration" 41 | obj_name: "fabric" 42 | 43 | - name: gather facts for brocade_fibrechannel_configuration_port_configuration 44 | brocade_singleton_obj_facts: 45 | credential: "{{credential}}" 46 | vfid: -1 47 | module_name: "brocade_fibrechannel_configuration" 48 | obj_name: "port_configuration" 49 | 50 | - name: gather facts for brocade_fibrechannel_switch_fibrechannel_switch 51 | brocade_list_obj_facts: 52 | credential: "{{credential}}" 53 | vfid: -1 54 | module_name: "brocade_fibrechannel_switch" 55 | list_name: "fibrechannel_switch" 56 | 57 | - name: gather facts for brocade_interface_fibrechannel 58 | brocade_list_obj_facts: 59 | credential: "{{credential}}" 60 | vfid: -1 61 | module_name: "brocade_interface" 62 | list_name: "fibrechannel" 63 | 64 | - name: gather facts for brocade_logging_audit 65 | brocade_singleton_obj_facts: 66 | credential: "{{credential}}" 67 | vfid: -1 68 | module_name: "brocade_logging" 69 | obj_name: "audit" 70 | 71 | - name: gather facts for brocade_logging_syslog_server 72 | brocade_list_obj_facts: 73 | credential: "{{credential}}" 74 | vfid: -1 75 | module_name: "brocade_logging" 76 | list_name: "syslog_server" 77 | 78 | - name: gather facts for brocade_snmp_system 79 | brocade_singleton_obj_facts: 80 | credential: "{{credential}}" 81 | vfid: -1 82 | module_name: "brocade_snmp" 83 | obj_name: "system" 84 | 85 | - name: gather facts for brocade_time_clock_server 86 | brocade_singleton_obj_facts: 87 | credential: "{{credential}}" 88 | vfid: -1 89 | module_name: "brocade_time" 90 | obj_name: "clock_server" 91 | 92 | - name: gather facts for brocade_time_time_zone 93 | brocade_singleton_obj_facts: 94 | credential: "{{credential}}" 95 | vfid: -1 96 | module_name: "brocade_time" 97 | obj_name: "time_zone" 98 | 99 | - name: gather facts for brocade_security_user_config 100 | brocade_list_obj_facts: 101 | credential: "{{credential}}" 102 | vfid: -1 103 | module_name: "brocade_security" 104 | list_name: "user_config" 105 | 106 | - name: gather facts for brocade_security_ipfilter_rule 107 | brocade_list_obj_facts: 108 | credential: "{{credential}}" 109 | vfid: -1 110 | module_name: "brocade_security" 111 | list_name: "ipfilter_rule" 112 | 113 | - name: print ansible_facts gathered 114 | debug: 115 | var: ansible_facts 116 | -------------------------------------------------------------------------------- /template_facts_all.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | obj_list: 19 | brocade_access_gateway: 20 | - policy 21 | - n_port_settings 22 | brocade_chassis: 23 | - chassis 24 | - ha_status 25 | brocade_fibrechannel_configuration: 26 | - switch_configuration 27 | - f_port_login_settings 28 | - port_configuration 29 | - zone_configuration 30 | - fabric 31 | brocade_logging: 32 | - audit 33 | - log_setting 34 | brocade_maps: 35 | - switch_status_policy_report 36 | - system_resources 37 | - maps_config 38 | - dashboard_misc 39 | brocade_security: 40 | - password_cfg 41 | - auth_spec 42 | - sec_crypto_cfg 43 | - sshutil 44 | brocade_snmp: 45 | - system 46 | brocade_time: 47 | - time_zone 48 | - clock_server 49 | list_list: 50 | brocade_access_gateway: 51 | - port_group 52 | - n_port_map 53 | - f_port_list 54 | - device_list 55 | brocade_extension_ip_route: 56 | - extension_ip_route 57 | brocade_extension_ipsec_policy: 58 | - extension_ipsec_policy 59 | brocade_extension_tunnel: 60 | - extension_tunnel 61 | - extension_tunnel_statistics 62 | - extension_circuit_statistics 63 | brocade_fabric: 64 | - fabric_switch 65 | brocade_fdmi: 66 | - hba 67 | - port 68 | brocade_fibrechannel_logical_switch: 69 | - fibrechannel_logical_switch 70 | brocade_fibrechannel_switch: 71 | - fibrechannel_switch 72 | brocade_fibrechannel_trunk: 73 | - trunk 74 | - performance 75 | - trunk_area 76 | brocade_fru: 77 | - blade 78 | - fan 79 | - power_supply 80 | brocade_interface: 81 | - fibrechannel 82 | - fibrechannel_statistics 83 | - extension_ip_interface 84 | - gigabitethernet 85 | - gigabitethernet_statistics 86 | brocade_license: 87 | - license 88 | brocade_logging: 89 | - syslog_server 90 | - raslog 91 | - raslog_module 92 | - log_quiet_control 93 | brocade_maps: 94 | - paused_cfg 95 | - group 96 | - dashboard_rule 97 | - rule 98 | - monitoring_system_matrix 99 | brocade_media: 100 | - media_rdp 101 | brocade_name_server: 102 | - fibrechannel_name_server 103 | brocade_security: 104 | - ipfilter_policy 105 | - ipfilter_rule 106 | - user_specific_password_cfg 107 | - user_config 108 | - radius_server 109 | - tacacs_server 110 | - ldap_server 111 | - ldap_role_map 112 | - sec_crypto_cfg_template 113 | - sshutil_key 114 | - sshutil_public_key 115 | - security_certificate 116 | brocade_snmp: 117 | - mib_capability 118 | - trap_capability 119 | - v1_account 120 | - v1_trap 121 | - v3_account 122 | - v3_trap 123 | 124 | 125 | tasks: 126 | 127 | - name: gather facts 128 | brocade_facts: 129 | credential: "{{credential}}" 130 | vfid: -1 131 | gather_subset: 132 | - brocade_zoning 133 | 134 | - name: gather non-zoning facts - non-list object 135 | brocade_singleton_obj_facts: 136 | credential: "{{credential}}" 137 | vfid: -1 138 | module_name: "{{ item.0.key }}" 139 | obj_name: "{{ item.1 }}" 140 | loop: "{{ obj_list | dict2items | subelements('value') }}" 141 | 142 | - name: gather non-zoning facts - list object 143 | brocade_list_obj_facts: 144 | credential: "{{credential}}" 145 | vfid: -1 146 | module_name: "{{ item.0.key }}" 147 | list_name: "{{ item.1 }}" 148 | loop: "{{ list_list | dict2items | subelements('value') }}" 149 | 150 | - name: print ansible_facts gathered 151 | debug: 152 | var: ansible_facts 153 | -------------------------------------------------------------------------------- /test_version_matrix.rst: -------------------------------------------------------------------------------- 1 | FOS-ansible Test Version Matrix 2 | =============================== 3 | 4 | The following are the tested ansible releases against the FOS versions. The 5 | notes section provide the details on the exceptions and release notes. 6 | 7 | +---------------+-------------+------------------------------------------+ 8 | | FOS-ansible | FOS | Notes | 9 | +===============+=============+==========================================+ 10 | | 1.3.0 | 8.2.3a | The minimum FOS version for module | 11 | | | | firmwaredownload is v9.0.0. | 12 | +---------------+-------------+------------------------------------------+ 13 | | 1.3.1 | 8.2.3c, | The minimum FOS version for module | 14 | | | 9.0.1d, | firmwaredownload is v9.0.0. | 15 | | | 9.1.1a | | 16 | +---------------+-------------+------------------------------------------+ 17 | | 1.3.2 | 8.2.3d, | The minimum FOS version for module | 18 | | | 9.0.1e, | firmwaredownload is v9.0.0. | 19 | | | 9.1.1b | | 20 | +---------------+-------------+------------------------------------------+ 21 | | 1.3.3 | 8.2.3d, | The minimum FOS version for module | 22 | | | 9.0.1e, | firmwaredownload is v9.0.0. | 23 | | | 9.1.1b | | 24 | +---------------+-------------+------------------------------------------+ 25 | | 1.3.4 | 9.2.0b | The minimum FOS version for module | 26 | | | | firmwaredownload is v9.0.0. | 27 | +---------------+-------------+------------------------------------------+ 28 | | 2.0.0 | 9.2.1a | | 29 | | | | | 30 | +---------------+-------------+------------------------------------------+ 31 | -------------------------------------------------------------------------------- /utils/brocade_access_gateway.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Broadcom. All rights reserved. 2 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 3 | # GNU General Public License v3.0+ 4 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 5 | 6 | 7 | from __future__ import (absolute_import, division, print_function) 8 | from ansible.module_utils.brocade_url import url_get_to_dict, url_patch, full_url_get 9 | from ansible.module_utils.brocade_yang import yang_to_human, human_to_yang, str_to_human 10 | 11 | __metaclass__ = type 12 | 13 | 14 | """ 15 | Brocade Fibre Channel AG utils 16 | """ 17 | 18 | 19 | zero_one_attributes = [ 20 | "port-group-policy-enabled", 21 | "auto-policy-enabled", 22 | ] 23 | 24 | 25 | def to_human_access_gateway_policy(config): 26 | for attrib in zero_one_attributes: 27 | if str_to_human(attrib) in config: 28 | if config[str_to_human(attrib)] == "0": 29 | config[str_to_human(attrib)] = False 30 | else: 31 | config[str_to_human(attrib)] = True 32 | 33 | 34 | def to_fos_access_gateway_policy(config, result): 35 | for attrib in zero_one_attributes: 36 | if attrib in config: 37 | if isinstance(config[attrib], bool): 38 | if config[attrib] == False: 39 | config[attrib] = "0" 40 | else: 41 | config[attrib] = "1" 42 | else: 43 | result["failed"] = True 44 | result["msg"] = attrib + " converted non-bool value" 45 | return -1 46 | 47 | return 0 48 | -------------------------------------------------------------------------------- /utils/brocade_chassis.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Broadcom. All rights reserved. 2 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 3 | # GNU General Public License v3.0+ 4 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 5 | 6 | 7 | from __future__ import (absolute_import, division, print_function) 8 | from ansible.module_utils.brocade_url import url_get_to_dict, url_patch, full_url_get, url_patch_single_object 9 | from ansible.module_utils.brocade_ssh import ssh_and_configure 10 | from ansible.module_utils.brocade_yang import yang_to_human, human_to_yang 11 | 12 | __metaclass__ = type 13 | 14 | 15 | """ 16 | Brocade chassis utils 17 | """ 18 | 19 | 20 | REST_CHASSIS = "/rest/running/brocade-chassis/chassis" 21 | 22 | 23 | def chassis_get(login, password, fos_ip_addr, fos_version, is_https, auth, vfid, result, ssh_hostkeymust, timeout): 24 | """ 25 | retrieve existing switch configurations 26 | 27 | :param fos_ip_addr: ip address of FOS switch 28 | :type fos_ip_addr: str 29 | :param is_https: indicate to use HTTP or HTTPS 30 | :type is_https: bool 31 | :param auth: authorization struct from login 32 | :type auth: dict 33 | :param result: dict to keep track of execution msgs 34 | :type result: dict 35 | :return: code to indicate failure or success 36 | :rtype: int 37 | :return: dict of chassis configurations 38 | :rtype: dict 39 | """ 40 | full_chassis_url, validate_certs = full_url_get(is_https, 41 | fos_ip_addr, 42 | REST_CHASSIS) 43 | 44 | rtype, rdict = url_get_to_dict(fos_ip_addr, is_https, auth, vfid, 45 | result, full_chassis_url, timeout) 46 | if rtype != 0: 47 | result["failed"] = True 48 | result["msg"] = "API failed to return data" 49 | return -1, None 50 | 51 | rssh, sshstr = ssh_and_configure(login, password, fos_ip_addr, ssh_hostkeymust, "timeout", "showcommand") 52 | if rssh == 0: 53 | if "Current IDLE Timeout is " in sshstr: 54 | text = sshstr[len("Current IDLE Timeout is "):] 55 | timeout = text.split(" ") 56 | rdict["Response"]["chassis"]["telnet-timeout"] = timeout[0] 57 | elif "Shell Idle Timeout is " in sshstr: 58 | text = sshstr[len("Shell Idle Timeout is "):] 59 | timeout = text.split(" ") 60 | rdict["Response"]["chassis"]["telnet-timeout"] = timeout[0] 61 | else: 62 | result["failed"] = True 63 | result["msg"] = "telnet_timeout returned unknown string" 64 | return -1, None 65 | 66 | return 0, rdict 67 | 68 | 69 | def chassis_patch(login, password, fos_ip_addr, fos_version, is_https, auth, vfid, result, diff_attributes, ssh_hostkeymust, timeout): 70 | """ 71 | update existing switch configurations 72 | 73 | :param fos_ip_addr: ip address of FOS switch 74 | :type fos_ip_addr: str 75 | :param is_https: indicate to use HTTP or HTTPS 76 | :type is_https: bool 77 | :param auth: authorization struct from login 78 | :type auth: dict 79 | :param result: dict to keep track of execution msgs 80 | :type result: dict 81 | :param diff_attributes: list of attributes for update 82 | :type ports: dict 83 | :return: code to indicate failure or success 84 | :rtype: int 85 | :return: list of dict of chassis configurations 86 | :rtype: list 87 | """ 88 | l_diffs = diff_attributes.copy() 89 | 90 | if "telnet-timeout" in l_diffs: 91 | rssh, sshstr = ssh_and_configure(login, password, fos_ip_addr, ssh_hostkeymust, "timeout " + str(l_diffs["telnet-timeout"]), "Timeout will be in effect after NEXT login") 92 | if rssh != 0: 93 | result["failed"] = True 94 | result["msg"] = "Failed to set telnet-timeout. " + sshstr 95 | else: 96 | result["changed"] = True 97 | result["messages"] = "telnet-timeout set" 98 | l_diffs.pop("telnet-timeout") 99 | 100 | if len(l_diffs) == 0: 101 | return 0 102 | 103 | full_chassis_url, validate_certs = full_url_get(is_https, 104 | fos_ip_addr, 105 | REST_CHASSIS) 106 | 107 | return (url_patch_single_object(fos_ip_addr, is_https, auth, 108 | vfid, result, full_chassis_url, 109 | "chassis", l_diffs, timeout)) 110 | -------------------------------------------------------------------------------- /utils/brocade_snmp.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019-2025 Broadcom. All rights reserved. 2 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 3 | # GNU General Public License v3.0+ 4 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 5 | 6 | 7 | from __future__ import (absolute_import, division, print_function) 8 | from ansible.module_utils.brocade_ssh import ssh_and_configure 9 | 10 | __metaclass__ = type 11 | 12 | 13 | """ 14 | Brocade logging utils 15 | """ 16 | 17 | 18 | def v1_trap_patch(login, password, fos_ip_addr, fos_version, is_https, auth, 19 | vfid, result, v1_traps, ssh_hostkeymust, timeout): 20 | """ 21 | update existing user config configurations 22 | 23 | :param fos_ip_addr: ip address of FOS switch 24 | :type fos_ip_addr: str 25 | :param is_https: indicate to use HTTP or HTTPS 26 | :type is_https: bool 27 | :param auth: authorization struct from login 28 | :type struct: dict 29 | :param result: dict to keep track of execution msgs 30 | :type result: dict 31 | :param diff_attributes: list of attributes for update 32 | :type ports: dict 33 | :return: code to indicate failure or success 34 | :rtype: int 35 | :return: list of dict of chassis configurations 36 | :rtype: list 37 | """ 38 | l_v1_traps = v1_traps[:] 39 | 40 | ifos_version = int(fos_version.split(".", 1)[0].replace("v", "")) 41 | if ifos_version < 9: 42 | for l_v1_trap in l_v1_traps: 43 | if "host" in l_v1_trap and l_v1_trap["host"] == "0.0.0.0": 44 | rssh, sshstr = ssh_and_configure(login, password, fos_ip_addr, ssh_hostkeymust, "snmpconfig --set snmpv1 -index " + str(l_v1_trap["index"]) + " -host 0.0.0.0" , "Committing configuration.....done.") 45 | if rssh != 0: 46 | result["failed"] = True 47 | result["msg"] = "Failed to reset host IP to 0.0.0.0. " + sshstr 48 | else: 49 | result["changed"] = True 50 | result["messages"] = "IP is reset to 0.0.0.0" 51 | 52 | l_v1_trap.pop("host") 53 | 54 | rest_v1_traps = [] 55 | 56 | for l_v1_trap in l_v1_traps: 57 | if len(l_v1_trap) > 1: 58 | rest_v1_traps.append(l_v1_trap) 59 | 60 | return rest_v1_traps 61 | 62 | 63 | def v3_trap_patch(login, password, fos_ip_addr, fos_version, is_https, auth, 64 | vfid, result, v3_traps, ssh_hostkeymust, timeout): 65 | """ 66 | update existing user config configurations 67 | 68 | :param fos_ip_addr: ip address of FOS switch 69 | :type fos_ip_addr: str 70 | :param is_https: indicate to use HTTP or HTTPS 71 | :type is_https: bool 72 | :param auth: authorization struct from login 73 | :type struct: dict 74 | :param result: dict to keep track of execution msgs 75 | :type result: dict 76 | :param diff_attributes: list of attributes for update 77 | :type ports: dict 78 | :return: code to indicate failure or success 79 | :rtype: int 80 | :return: list of dict of chassis configurations 81 | :rtype: list 82 | """ 83 | l_v3_traps = v3_traps[:] 84 | 85 | ifos_version = int(fos_version.split(".", 1)[0].replace("v", "")) 86 | if ifos_version < 9: 87 | for l_v3_trap in l_v3_traps: 88 | if "host" in l_v3_trap and l_v3_trap["host"] == "0.0.0.0": 89 | rssh, sshstr = ssh_and_configure(login, password, fos_ip_addr, ssh_hostkeymust, "snmpconfig --set snmpv3 -index " + str(l_v3_trap["trap-index"]) + " -host 0.0.0.0" , "Committing configuration.....done.") 90 | if rssh != 0: 91 | result["failed"] = True 92 | result["msg"] = "Failed to reset host IP to 0.0.0.0. " + sshstr 93 | else: 94 | result["changed"] = True 95 | result["messages"] = "IP is reset to 0.0.0.0" 96 | 97 | l_v3_trap.pop("host") 98 | 99 | rest_v3_traps = [] 100 | 101 | for l_v3_trap in l_v3_traps: 102 | if len(l_v3_trap) > 1: 103 | rest_v3_traps.append(l_v3_trap) 104 | 105 | return rest_v3_traps 106 | -------------------------------------------------------------------------------- /utils/brocade_ssh.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Broadcom. All rights reserved. 2 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 3 | # GNU General Public License v3.0+ 4 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 5 | 6 | 7 | import paramiko 8 | 9 | def ssh_and_configure(login, password, ipaddr, hostkeymust, cmdstr, expected): 10 | ssh = paramiko.SSHClient() 11 | ssh.load_system_host_keys() 12 | if not hostkeymust: 13 | ssh.set_missing_host_key_policy(paramiko.client.WarningPolicy()) 14 | try: 15 | ssh.connect(ipaddr, username=login, password=password) 16 | except paramiko.ssh_exception.AuthenticationException: 17 | return -1, "invalid name/password" 18 | except Exception as e: 19 | return -2, "skiiping due to error" + str(e) 20 | 21 | e_stdin, e_stdout, e_stderr = ssh.exec_command(cmdstr) 22 | e_resp = e_stdout.read().decode() 23 | ssh.close() 24 | 25 | if isinstance(expected, list): 26 | found = False 27 | for line in expected: 28 | if line in e_resp: 29 | found = True 30 | break 31 | if found: 32 | return 0, e_resp 33 | else: 34 | return -1, e_resp 35 | else: 36 | if expected == "showcommand": 37 | return 0, e_resp 38 | elif expected == "": 39 | if len(e_resp) == 0: 40 | return 0, e_resp 41 | else: 42 | return -1, e_resp 43 | else: 44 | if expected in e_resp: 45 | return 0, e_resp 46 | else: 47 | return -1, e_resp 48 | -------------------------------------------------------------------------------- /utils/brocade_xml.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Broadcom. All rights reserved. 2 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 3 | # GNU General Public License v3.0+ 4 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 5 | 6 | 7 | from __future__ import (absolute_import, division, print_function) 8 | 9 | __metaclass__ = type 10 | 11 | 12 | """ 13 | Brocade xml parsing lib 14 | """ 15 | 16 | try: 17 | import xmltodict 18 | HAS_XMLTODICT = True 19 | except ImportError: 20 | HAS_XMLTODICT = False 21 | 22 | 23 | def bsn_xmltodict(result, data): 24 | """ 25 | converts data into dict and check for xmltodict lib 26 | 27 | :param result: dict to keep track of execution msgs 28 | :type result: dict 29 | :param data: xml data in str 30 | :type data: str 31 | :param url: url for FOS REST API 32 | :type url: str 33 | :return: code to indicate failure or success 34 | :rtype: int 35 | :return: dict of data content 36 | :rtype: dict 37 | """ 38 | if not HAS_XMLTODICT: 39 | result["failed"] = True 40 | result["lxml_err_msg"] = 'The brocade_xml module requires'\ 41 | ' the xmltodict python library installed on the managed machine' 42 | return -1, None 43 | 44 | try: 45 | ret_dict = xmltodict.parse(data) 46 | except xmltodict.expat.ExpatError: 47 | return -1, data 48 | 49 | # result["xmltodict"] = ret_dict 50 | 51 | return 0, ret_dict 52 | -------------------------------------------------------------------------------- /zonedb.yml: -------------------------------------------------------------------------------- 1 | aliases: 2 | - name: Host1 3 | members: 4 | - 11:22:33:44:55:66:77:88 5 | - name: Target1 6 | members: 7 | - 22:22:33:44:55:66:77:99 8 | - name: Target2 9 | members: 10 | - 22:22:33:44:55:66:77:aa 11 | - name: Target3 12 | members: 13 | - 22:22:33:44:55:66:77:bb 14 | 15 | zones: 16 | - name: NewZoneName 17 | members: 18 | - Host1 19 | - Target1 20 | - Target2 21 | - name: NewZoneName2 22 | members: 23 | - Host1 24 | - Target2 25 | - name: NewZoneNameP 26 | members: 27 | - 11:22:33:44:55:66:77:88 28 | principal_members: 29 | - 22:22:33:44:55:66:77:88 30 | 31 | cfgs: 32 | - name: newcfg1 33 | members: 34 | - NewZoneName 35 | - NewZoneName2 36 | - name: newcfg2 37 | members: 38 | - NewZoneName 39 | - NewZoneName2 40 | - name: newcfg3 41 | members: 42 | - NewZoneName 43 | - NewZoneName2 44 | -------------------------------------------------------------------------------- /zoning_act.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | # This playbook is an example of how to use zoning_to_xml.py 9 | # to generate a yml file that contains exising defined zone 10 | # db. After saving the output of the script to a file, the 11 | # file now contains the variables that can be referenced 12 | # by tasks defined below: 13 | # 14 | # example: 15 | # note: zoning_to_xml.py requires PyFOS to be installed first. 16 | # Details on how to install PyFOS is available under 17 | # github.com/brocade/pyfos 18 | # 19 | # bash prompt> ./zoning_to_xml.py -i xxx -L admin -P yyy > zonedb.yml 20 | # note: output file name, zonedb.yml in this example, should match 21 | # the file being included in zoning_act.yml playbook under vars_files. 22 | # The resulting file contains the variables "aliaes", "zones", 23 | # and "cfgs" that are being used by tasks within zoning_act.yml 24 | # 25 | # bash prompt> ansible-playbook -i ../san-inventory zoning_act.yml 26 | # note: this play will apply the zone database catpured in zonedb.yml. 27 | # However, active_cfg variable is not captured by the script. 28 | # So, zoning_act.yml playbook needs to be updated to set the 29 | # active_cfg to be the correct enabled cfg name. 30 | 31 | 32 | - hosts: san_eng_zone_seed_san_a 33 | gather_facts: False 34 | 35 | vars: 36 | credential: 37 | fos_ip_addr: "{{fos_ip_addr}}" 38 | fos_user_name: "{{fos_user_name}}" 39 | fos_password: "{{fos_password}}" 40 | https: "{{fos_https}}" 41 | 42 | vars_files: 43 | zonedb.yml 44 | 45 | tasks: 46 | 47 | - name: Create aliases 48 | brocade_zoning_alias: 49 | credential: "{{credential}}" 50 | vfid: -1 51 | aliases: "{{aliases}}" 52 | # aliases_to_delete: "{{aliases_to_delete}}" 53 | 54 | - name: Create zones 55 | brocade_zoning_zone: 56 | credential: "{{credential}}" 57 | vfid: -1 58 | zones: "{{zones}}" 59 | # zones_to_delete: "{{zones_to_delete}}" 60 | 61 | - name: Create cfgs 62 | brocade_zoning_cfg: 63 | credential: "{{credential}}" 64 | vfid: -1 65 | cfgs: "{{cfgs}}" 66 | # cfgs_to_delete: "{{cfgs_to_delete}}" 67 | active_cfg: newcfg2 68 | 69 | - name: Default zoning 70 | brocade_zoning_default_zone: 71 | credential: "{{credential}}" 72 | vfid: -1 73 | default_zone_access: allaccess 74 | -------------------------------------------------------------------------------- /zoning_cfg_disable.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | 19 | tasks: 20 | 21 | - name: Disable cfgs 22 | brocade_zoning_cfg_disable: 23 | credential: "{{credential}}" 24 | vfid: -1 25 | -------------------------------------------------------------------------------- /zoning_copy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | copy_list: 19 | - current: Host1 20 | new: Host1_new 21 | - current: Zone3 22 | new: Zone3_new 23 | - current: cfg1 24 | new: cfg1_new 25 | 26 | tasks: 27 | 28 | - name: walk through the copy_list and copy from current to new 29 | brocade_zoning_copy: 30 | credential: "{{credential}}" 31 | vfid: -1 32 | object_name: "{{item.current}}" 33 | new_name: "{{item.new}}" 34 | loop: "{{copy_list}}" 35 | -------------------------------------------------------------------------------- /zoning_migrate.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | # This playbook reads the current zone database from a FOS switch and using the facts 9 | # collected to apply to another FOS switch. f_credential contains ip address, login, and 10 | # connection type for "from FOS" switch. t_credential contains ip address, login, and 11 | # connection type for "to FOS" switch. Migrating will be additive to the "to FOS" switch. 12 | # i.e. Existing aliases, zones and aliases will remain and NOT be deleted. However, 13 | # overlapping aliases, zone, and alises will be overwritten by the "from FOS" copy and 14 | # "from FOS" active cfg will be activated. 15 | # 16 | # Below is san-inventory entry example: 17 | # 18 | # zone_migration_app ansible_connection=local f_fos_ip_addr=10.10.10.10 f_fos_user_name=admin f_fos_password=frompassword f_fos_https=False t_fos_ip_addr=10.10.10.12 t_fos_user_name=admin t_fos_password=topassword t_fos_https=False 19 | 20 | - hosts: zone_migration_app 21 | gather_facts: False 22 | 23 | vars: 24 | f_credential: 25 | fos_ip_addr: "{{f_fos_ip_addr}}" 26 | fos_user_name: "{{f_fos_user_name}}" 27 | fos_password: "{{f_fos_password}}" 28 | https: "{{f_fos_https}}" 29 | t_credential: 30 | fos_ip_addr: "{{t_fos_ip_addr}}" 31 | fos_user_name: "{{t_fos_user_name}}" 32 | fos_password: "{{t_fos_password}}" 33 | https: "{{t_fos_https}}" 34 | 35 | tasks: 36 | 37 | - name: gather facts from "from FOS" using f_credential 38 | brocade_facts: 39 | credential: "{{f_credential}}" 40 | vfid: -1 41 | gather_subset: 42 | - brocade_zoning_simple 43 | 44 | - name: print ansible_facts gathered 45 | debug: 46 | var: ansible_facts['brocade_zoning_simple'] 47 | 48 | - name: Create aliases to "to FOS" using t_credential 49 | brocade_zoning_alias: 50 | credential: "{{t_credential}}" 51 | vfid: -1 52 | aliases: "{{ansible_facts['brocade_zoning_simple']['defined-configuration']['aliases']}}" 53 | when: ansible_facts['brocade_zoning_simple']['defined-configuration']['aliases'] | length > 0 54 | 55 | - name: Create zones to "to FOS" using t_credential 56 | brocade_zoning_zone: 57 | credential: "{{t_credential}}" 58 | vfid: -1 59 | zones: "{{ansible_facts['brocade_zoning_simple']['defined-configuration']['zones']}}" 60 | when: ansible_facts['brocade_zoning_simple']['defined-configuration']['zones'] | length > 0 61 | 62 | - name: Create cfgs to "to FOS" using t_credential 63 | brocade_zoning_cfg: 64 | credential: "{{t_credential}}" 65 | vfid: -1 66 | cfgs: "{{ansible_facts['brocade_zoning_simple']['defined-configuration']['cfgs']}}" 67 | # active_cfg: "{{ansible_facts['brocade_zoning_simple']['effective-configuration']['cfg_name']}}" 68 | when: ansible_facts['brocade_zoning_simple']['defined-configuration']['cfgs'] | length > 0 69 | 70 | - name: Enable active cfg on "to FOS" using t_credential 71 | brocade_zoning_cfg: 72 | credential: "{{t_credential}}" 73 | vfid: -1 74 | cfgs: "{{ansible_facts['brocade_zoning_simple']['defined-configuration']['cfgs']}}" 75 | active_cfg: "{{ansible_facts['brocade_zoning_simple']['effective-configuration']['cfg_name']}}" 76 | when: "'cfg_name' in ansible_facts['brocade_zoning_simple']['effective-configuration']" 77 | 78 | # - name: Default zoning 79 | # brocade_zoning_default_zone: 80 | # credential: "{{t_credential}}" 81 | # vfid: -1 82 | # default_zone_access: allaccess 83 | -------------------------------------------------------------------------------- /zoning_zone.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | aliases: 19 | - name: Host1 20 | members: 21 | - aa:11:11:11:11:11:11:11 22 | - aa:22:22:22:22:22:22:22 23 | - name: Target2 24 | members: 25 | - aa:44:44:44:44:44:44:44 26 | - name: Target3 27 | members: 28 | - aa:55:55:55:55:55:55:55 29 | - name: Target4 30 | members: 31 | - aa:bb:cc:dd:AA:BB:CC:DD 32 | aliases_to_delete: 33 | - name: Target3 34 | - name: Target4 35 | zones: 36 | - name: Zone1 37 | members: 38 | - Host1 39 | - Target2 40 | - Target3 41 | - name: Zone2 42 | members: 43 | - Host1 44 | - Target3 45 | - Target4 46 | - name: Zone3 47 | members: 48 | - aa:44:44:44:44:44:44:44 49 | - aa:55:55:55:55:55:55:55 50 | principal_members: 51 | - aa:aa:aa:aa:bb:bb:bb:bb 52 | - aa:aa:aa:aa:cc:cc:cc:cc 53 | zones_to_delete: 54 | - name: Zone2 55 | - name: Zone3 56 | cfgs: 57 | - name: cfg1 58 | members: 59 | - Zone1 60 | - Zone2 61 | - name: cfg2 62 | members: 63 | - Zone2 64 | - zone3 65 | - name: cfg3 66 | members: 67 | - Zone1 68 | - Zone3 69 | cfgs_to_delete: 70 | - name: cfg2 71 | - name: cfg3 72 | 73 | tasks: 74 | 75 | - name: Create aliases 76 | brocade_zoning_alias: 77 | credential: "{{credential}}" 78 | vfid: -1 79 | aliases: "{{aliases}}" 80 | # aliases_to_delete: "{{aliases_to_delete}}" 81 | 82 | - name: Create zones 83 | brocade_zoning_zone: 84 | credential: "{{credential}}" 85 | vfid: -1 86 | zones: "{{zones}}" 87 | # zones_to_delete: "{{zones_to_delete}}" 88 | 89 | - name: Create cfgs 90 | brocade_zoning_cfg: 91 | credential: "{{credential}}" 92 | vfid: -1 93 | cfgs: "{{cfgs}}" 94 | # cfgs_to_delete: "{{cfgs_to_delete}}" 95 | active_cfg: cfg1 96 | 97 | - name: Default zoning 98 | brocade_zoning_default_zone: 99 | credential: "{{credential}}" 100 | vfid: -1 101 | default_zone_access: allaccess 102 | -------------------------------------------------------------------------------- /zoning_zone_add.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | aliases: 19 | - name: Host1 20 | members: 21 | - aa:11:11:11:11:11:11:11 22 | - aa:22:22:22:22:22:22:22 23 | - bb:99:99:99:99:99:99:99 24 | zones: 25 | - name: Zone3 26 | members: 27 | - aa:44:44:44:44:44:44:44 28 | - aa:55:55:55:55:55:55:55 29 | - bb:99:99:99:99:99:99:99 30 | principal_members: 31 | - aa:aa:aa:aa:bb:bb:bb:bb 32 | - aa:aa:aa:aa:cc:cc:cc:CC 33 | - bb:bb:bb:bb:99:99:99:99 34 | cfgs: 35 | - name: cfg1 36 | members: 37 | - Zone1 38 | - Zone2 39 | - Zone3 40 | 41 | tasks: 42 | 43 | - name: after zoning_zone.yml, add bb:99:99:99:99:99:99:99 to Host1 by specifying all members 44 | brocade_zoning_alias: 45 | credential: "{{credential}}" 46 | vfid: -1 47 | aliases: "{{aliases}}" 48 | 49 | - name: after zoning_zone.yml, add bb:99:99:99:99:99:99:99/bb:bb:bb:bb:99:99:99:99 to Zone3 by specifying all members 50 | brocade_zoning_zone: 51 | credential: "{{credential}}" 52 | vfid: -1 53 | zones: "{{zones}}" 54 | 55 | - name: after zoning_zone.yml, add Zone3 to cfg1 by specifying all members and leave it enabled 56 | brocade_zoning_cfg: 57 | credential: "{{credential}}" 58 | vfid: -1 59 | cfgs: "{{cfgs}}" 60 | active_cfg: cfg1 61 | -------------------------------------------------------------------------------- /zoning_zone_add_remove.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | aliases: 19 | - name: Host1 20 | members: 21 | - cc:99:99:99:99:99:99:99 22 | zones: 23 | - name: Zone3 24 | members: 25 | - cc:99:99:99:99:99:99:99 26 | principal_members: 27 | - cc:cc:cc:cc:99:99:99:99 28 | - name: Zone4 29 | members: 30 | - cc:88:88:88:88:88:88:88 31 | principal_members: 32 | - cc:cc:cc:cc:88:88:88:88 33 | cfgs: 34 | - name: cfg1 35 | members: 36 | - Zone4 37 | 38 | tasks: 39 | 40 | - name: after zoning_zone.yml, add cc:99:99:99:99:99:99:99 and remove aa:11:11:11:11:11:11:11/aa:22:22:22:22:22:22:22 from Host1 by specifying the final member list 41 | brocade_zoning_alias: 42 | credential: "{{credential}}" 43 | vfid: -1 44 | aliases: "{{aliases}}" 45 | 46 | - name: after zoning_zone.yml, add cc:99:99:99:99:99:99:99/cc:cc:cc:cc:99:99:99:99 and remove aa:44:44:44:44:44:44:44/aa:55:55:55:55:55:55:55/aa:aa:aa:aa:bb:bb:bb:bb/aa:aa:aa:aa:cc:cc:cc:cc from Zone3 by specifying the final member list. Also, create Zone4. 47 | brocade_zoning_zone: 48 | credential: "{{credential}}" 49 | vfid: -1 50 | zones: "{{zones}}" 51 | 52 | - name: after zoning_zone.yml, add Zone4 and remove Zone1/Zone2. And leave cfg1 enabled 53 | brocade_zoning_cfg: 54 | credential: "{{credential}}" 55 | vfid: -1 56 | cfgs: "{{cfgs}}" 57 | active_cfg: cfg1 58 | -------------------------------------------------------------------------------- /zoning_zone_delete.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | aliases_to_delete: 19 | - name: Host1 20 | - name: Target2 21 | - name: Target3 22 | - name: Target4 23 | zones_to_delete: 24 | - name: Zone1 25 | - name: Zone2 26 | - name: Zone3 27 | cfgs_to_delete: 28 | - name: cfg2 29 | - name: cfg3 30 | 31 | tasks: 32 | 33 | - name: delete cfg2, & cfg3 and leave cfg1 enabled 34 | brocade_zoning_cfg: 35 | credential: "{{credential}}" 36 | vfid: -1 37 | cfgs_to_delete: "{{cfgs_to_delete}}" 38 | active_cfg: cfg1 39 | 40 | - name: delete Host1, Target2, Target3 and Targer4 41 | brocade_zoning_alias: 42 | credential: "{{credential}}" 43 | vfid: -1 44 | aliases_to_delete: "{{aliases_to_delete}}" 45 | 46 | - name: delete Zone1, Zone2, and Zone3 47 | brocade_zoning_zone: 48 | credential: "{{credential}}" 49 | vfid: -1 50 | zones_to_delete: "{{zones_to_delete}}" 51 | 52 | -------------------------------------------------------------------------------- /zoning_zone_members_add_only.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | aliases: 19 | - name: Host1 20 | members: 21 | - bb:99:99:99:99:99:99:99 22 | zones: 23 | - name: Zone3 24 | members: 25 | - bb:99:99:99:99:99:99:99 26 | principal_members: 27 | - bb:bb:bb:bb:99:99:99:99 28 | cfgs: 29 | - name: cfg1 30 | members: 31 | - Zone3 32 | 33 | tasks: 34 | 35 | - name: after zoning_zone.yml, add bb:99:99:99:99:99:99:99 to Host1 by specificying the addition only and setting members_add_only to True 36 | brocade_zoning_alias: 37 | credential: "{{credential}}" 38 | vfid: -1 39 | members_add_only: True 40 | aliases: "{{aliases}}" 41 | 42 | - name: add bb:99:99:99:99:99:99:99/bb:bb:bb:bb:99:99:99:99 to Zone3 by specifying the addition only and setting members_add_only to True 43 | brocade_zoning_zone: 44 | credential: "{{credential}}" 45 | vfid: -1 46 | members_add_only: True 47 | zones: "{{zones}}" 48 | 49 | - name: add Zone3 to cfg1 by specifying the addition only an setting the members_add_only to True & leave cfg1 enabled 50 | brocade_zoning_cfg: 51 | credential: "{{credential}}" 52 | vfid: -1 53 | members_add_only: True 54 | cfgs: "{{cfgs}}" 55 | active_cfg: cfg1 56 | -------------------------------------------------------------------------------- /zoning_zone_members_remove_only.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | aliases: 19 | - name: Host1 20 | members: 21 | - aa:11:11:11:11:11:11:11 22 | zones: 23 | - name: Zone3 24 | members: 25 | - aa:44:44:44:44:44:44:44 26 | principal_members: 27 | - aa:aa:aa:aa:bb:bb:bb:bB 28 | cfgs: 29 | - name: cfg1 30 | members: 31 | - Zone1 32 | 33 | tasks: 34 | 35 | - name: after zoning_zone.yml, remove aa:11:11:11:11:11:11:11 from Host1 by specifying only those members being removed and setting members_remove_only to True 36 | brocade_zoning_alias: 37 | credential: "{{credential}}" 38 | vfid: -1 39 | members_remove_only: True 40 | aliases: "{{aliases}}" 41 | 42 | - name: after zoning_zone.yml, remove aa:44:44:44:44:44:44:44/aa:aa:aa:aa:bb:bb:bb:bb from Zone3 by specifying only those members being removed and setting members_remove_only to True 43 | brocade_zoning_zone: 44 | credential: "{{credential}}" 45 | vfid: -1 46 | members_remove_only: True 47 | zones: "{{zones}}" 48 | 49 | - name: after zoning_zone.yml, remove Zone1 from cfg1 a by specifying only those members being removed and setting members_remove_only to True and leave it enabled 50 | brocade_zoning_cfg: 51 | credential: "{{credential}}" 52 | vfid: -1 53 | members_remove_only: True 54 | cfgs: "{{cfgs}}" 55 | active_cfg: cfg1 56 | -------------------------------------------------------------------------------- /zoning_zone_remove.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Copyright 2019 Broadcom. All rights reserved. 4 | # The term 'Broadcom' refers to Broadcom Inc. and/or its subsidiaries. 5 | # GNU General Public License v3.0+ 6 | # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) 7 | 8 | 9 | - hosts: san_eng_zone_seed_san_a 10 | gather_facts: False 11 | 12 | vars: 13 | credential: 14 | fos_ip_addr: "{{fos_ip_addr}}" 15 | fos_user_name: "{{fos_user_name}}" 16 | fos_password: "{{fos_password}}" 17 | https: "{{fos_https}}" 18 | aliases: 19 | - name: Host1 20 | members: 21 | - aa:22:22:22:22:22:22:22 22 | zones: 23 | - name: Zone3 24 | members: 25 | - aa:55:55:55:55:55:55:55 26 | principal_members: 27 | - aa:aa:aa:aa:cc:cc:cc:CC 28 | cfgs: 29 | - name: cfg1 30 | members: 31 | - Zone2 32 | 33 | tasks: 34 | 35 | - name: after zoning_zone.yml, remove aa:11:11:11:11:11:11:11 from Host1 by specifying all members 36 | brocade_zoning_alias: 37 | credential: "{{credential}}" 38 | vfid: -1 39 | aliases: "{{aliases}}" 40 | 41 | - name: after zoning_zone.yml, remove aa:44:44:44:44:44:44:44/aa:aa:aa:aa:bb:bb:bb:bb from Zone3 by specifying all members 42 | brocade_zoning_zone: 43 | credential: "{{credential}}" 44 | vfid: -1 45 | zones: "{{zones}}" 46 | 47 | - name: after zoning_zone.yml, remove Zone1 from cfg1 by specifying all members and leave it enabled 48 | brocade_zoning_cfg: 49 | credential: "{{credential}}" 50 | vfid: -1 51 | cfgs: "{{cfgs}}" 52 | active_cfg: cfg1 53 | --------------------------------------------------------------------------------