FRR 平台选项
The FRR collection supports the ansible.netcommon.network_cli
connection. This section provides details on how to use this connection for Free Range Routing (FRR).
可用连接
CLI |
|
---|---|
协议 |
SSH |
凭据 |
如果存在,使用 SSH 密钥 / SSH 代理 如果使用密码,则接受 |
间接访问 |
通过堡垒机(跳板主机) |
连接设置 |
|
启用模式 |
不支持 |
返回的数据格式 |
|
在 Ansible 中使用 CLI
Example CLI group_vars/frr.yml
ansible_connection: ansible.netcommon.network_cli
ansible_network_os: frr.frr.frr
ansible_user: frruser
ansible_password: !vault...
ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q bastion01"'
The
ansible_user
should be a part of thefrrvty
group and should have the default shell set to/bin/vtysh
.If you are using SSH keys (including an ssh-agent) you can remove the
ansible_password
configuration.If you are accessing your host directly (not through a bastion/jump host) you can remove the
ansible_ssh_common_args
configuration.If you are accessing your host through a bastion/jump host, you cannot include your SSH password in the
ProxyCommand
directive. To prevent secrets from leaking out (for example inps
output), SSH does not support providing passwords through environment variables.
Example CLI task
- name: Gather FRR facts
frr.frr.frr_facts:
gather_subset:
- config
- hardware
警告
切勿以明文形式存储密码。 我们建议使用 SSH 密钥来验证 SSH 连接。 Ansible 支持 ssh-agent 来管理您的 SSH 密钥。 如果您必须使用密码来验证 SSH 连接,我们建议使用 Ansible Vault 对其进行加密。
另请参阅