stackhpc.mellanox-switch

Mellanox 交换机

此角色使用 expect Ansible 模块配置运行 MLNX-OS 的 Mellanox 交换机。

此角色将在本地机器的系统站点包中安装 Python expect 包。

要求

交换机应配置为允许 SSH 访问。

角色变量

mellanox_switch_provider 是身份验证提供者信息,类似于 dellos 模块的 provider 参数。它应为一个包含以下字段的字典:

  • host:交换机的主机或 IP 地址。
  • username:用来通过 SSH 访问交换机的用户名。
  • auth_pass:用来进行身份验证的密码。

mellanox_switch_config 是要应用于交换机的配置行列表,默认为空列表。

mellanox_switch_interface_config 包含接口配置。它是一个字典,将交换机接口名称映射到配置字典。每个字典可以包含以下项:

  • description - 应用于接口的描述。
  • config - 每个接口的配置列表。

依赖关系

示例剧本

以下剧本配置了 mellanox-switches 组中的主机。它假设每个交换机的主机变量包含主机、用户名和密码。它为 VLAN 42 应用全局配置,并启用两个以接入模式切换的以太网接口。

---
- name: 确保 Mellanox 交换机配置正确
  hosts: mellanox-switches
  gather_facts: no
  roles:
    - role: stackhpc.mellanox-switch
      mellanox_switch_provider:
        host: "{{ switch_host }}"
        username: "{{ switch_user }}"
        auth_pass: "{{ switch_auth_pass }}"
      mellanox_switch_config:
        - "vlan 42"
        - "exit"
      mellanox_switch_interface_config:
        ethernet 1/1:
          description: server-1
          config:
            - "no shutdown"
            - "switchport mode access"
        ethernet 1/2:
          description: server-2
          config:
            - "no shutdown"
            - "switchport mode access"

作者信息

关于项目

Role to configure Mellanox switches runnning MLNX-OS

安装
ansible-galaxy install stackhpc.mellanox-switch
许可证
apache-2.0
下载
42.1k
拥有者
StackHPC develops OpenStack capabilities for research computing use cases. Through extensive experience, we understand HPC and cloud.