stackhpc.ansible-role-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.ansible-role-mellanox-switch
许可证
apache-2.0
下载
148.5k
拥有者
StackHPC develops OpenStack capabilities for research computing use cases. Through extensive experience, we understand HPC and cloud.