EXOS 平台选项

Extreme EXOS 是 community.network 专辑的一部分,支持多种连接。本页提供了有关在 Ansible 中各种连接工作原理及使用方法的详细介绍。

译注: ExtremeXOS 是用于 Extreme Networks 较新型号网络交换机的软件或网络操作系统。他是 Extreme Networks 继基于 VxWorks 的 ExtremeWare 操作系统之后的第二代操作系统。

ExtremeXOS 基于 Linux 内核和 BusyBox。2008 年 7 月,Extreme Networks 因涉嫌违反 GNU 通用公共许可证而遭到法律诉讼。三个月后,该诉讼达成庭外和解。

参考:

可用连接

| | CLI | EXOS-API | | 协议 | SSH | HTTP(S) | | 凭据 | 在存在 SSH 密钥/ ssh-agent 时使用 SSH 密钥/ssh-agent,在使用密码时接受 -u my_user -k 参数 | 存在 HTTPS 证书时使用 HTTPS 证书 | | 间接访问 | 通过堡垒机(跳转主机) | 经由 web 代理 | | 连接设置 | ansible_connection: ansible.netcommon.network_cli | ansible_connection: ansible.netcommon.httpapi | | enable 模式(权限提升) | 不受 EXOS 支持 | 不受 EXOS 支持 | | 返回的数据格式 | stdout[0]. | stdout[0].messages[0]. |

EXOS 不支持 ansible_connection: local。咱们必须使用 ansible_connection: ansible.netcommon.network_cliansible_connection: ansible.netcommon.httpapi

在 Ansible 中使用 CLI

示例 CLI group_vars/exos.yml

ansible_connection: ansible.netcommon.network_cli
ansible_network_os: community.network.exos
ansible_user: myuser
ansible_password: !vault...
ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q bastion01"'
  • 若咱们使用的是 SSH 密钥(包括 ssh-agent),则可以移除 ansible_password 配置项;
  • 若咱们直接访问的主机(不通过堡垒机/跳转主机),则可移除 ansible_ssh_common_args 配置项;
  • 若咱们通过堡垒机/跳转主机访问咱们的主机,则咱们不能在 ProxyCommand 指令中包含咱们的 SSH 密码。为防止秘密外泄(例如在 ps 的输出中),SSH 不支持使用环境变量提供密码。

示例 CLI 任务

- name: Retrieve EXOS OS version
  community.network.exos_command:
    commands: show version
  when: ansible_network_os == 'community.network.exos'

在 Ansible 中使用 EXOS-API

示例 EXOS-API group_vars/exos.yml

ansible_connection: ansible.netcommon.httpapi
ansible_network_os: community.network.exos
ansible_user: myuser
ansible_password: !vault...
proxy_env:
  http_proxy: http://proxy.example.com:8080
  • 如果咱们是直接访问主机(而非通过 web 代理),咱们可移除 proxy_env 配置项;
  • 如果咱们通过某个使用 https 的 web 代理服务器访问主机,则要将 http_proxy 更改为 https_proxy

示例 EXOS-API 任务

- name: Retrieve EXOS OS version
  community.network.exos_command:
    commands: show version
  when: ansible_network_os == 'community.network.exos'

在这个示例中,group_vars 中定义的 proxy_env 变量,被传递给任务中模组的 environment 选项。

警告

切勿以明文方式存储密码。我们建议使用 SSH 密钥验证 SSH 连接。Ansible 支持 ssh-agent 来管理 SSH 密钥。如果必须使用密码来验证 SSH 连接,建议使用 Ansible Vault 对密码进行加密。

(End)

Last change: 2025-03-22, commit: 21e5221

小额打赏,赞助 xfoss.com 长存......

微信 | 支付宝

若这里内容有帮助到你,请选择上述方式向 xfoss.com 捐赠。