community.network.ig_config 模块 – 管理 Ingate SBC 上的配置数据库。
注意
此模块是 community.network 集合 (版本 5.1.0) 的一部分。
如果您使用的是 ansible
包,则可能已安装此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install community.network
。您需要其他要求才能使用此模块,有关详细信息,请参阅 要求。
要在 playbook 中使用它,请指定:community.network.ig_config
。
注意
community.network 集合已被弃用,并将从 Ansible 12 中移除。有关更多信息,请参阅 讨论主题。
已弃用
- 移除于:
6.0.0 版本
- 原因:
此集合及其中的所有内容均未维护且已弃用。
- 替代方案:
未知。
概要
管理 Ingate SBC 上的配置数据库。
别名:network.ingate.ig_config
要求
执行此模块的主机需要以下要求。
ingatesdk >= 1.0.6
参数
参数 |
注释 |
---|---|
向表中添加一行。 选项
|
|
包含连接详细信息的字典对象。 |
|
设备的主机名或 IP 地址。 |
|
REST API 用户的密码。 |
|
要连接到的 HTTP(S) 端口。 |
|
要使用的 HTTP 协议。 选项
|
|
REST API 请求的超时时间(以秒为单位)。 |
|
REST API 用户的用户名。 |
|
验证设备的 HTTPS 证书。 选项
|
|
REST API 版本。 选项
|
|
包含列名/值的字典。 |
|
删除表中的所有行或特定行。 选项
|
|
从设备下载配置数据库。 选项
|
|
将初步配置重置为其出厂默认值。 选项
|
|
用于存储下载的配置的文件名。请参考 |
|
返回表中的所有行或特定行。 选项
|
|
修改表中的一行。 选项
|
|
存储初步配置时不希望有响应。请参考 选项
|
|
在文件系统中存储下载的配置的位置。请参考 |
|
获取表中列匹配的 rowid。 选项
|
|
重置初步配置。 选项
|
|
行 ID。 |
|
存储初步配置。 选项
|
|
是否应将下载的配置存储在磁盘上。请参考 选项
|
|
表名。 |
注释
注意
如果
store_download
设置为 True,并且省略了path
和filename
,则文件将使用自动文件名存储在当前目录中。此模块要求在主机上安装 Ingate Python SDK。要安装 SDK,请在 shell 中使用 pip 命令
pip install ingatesdk
。
示例
- name: Add/remove DNS servers
hosts: 192.168.1.1
connection: local
vars:
client_rw:
version: v1
address: "{{ inventory_hostname }}"
scheme: http
username: alice
password: foobar
tasks:
- name: Load factory defaults
community.network.ig_config:
client: "{{ client_rw }}"
factory: true
register: result
- ansible.builtin.debug:
var: result
- name: Revert to last known applied configuration
community.network.ig_config:
client: "{{ client_rw }}"
revert: true
register: result
- ansible.builtin.debug:
var: result
- name: Change the unit name
community.network.ig_config:
client: "{{ client_rw }}"
modify: true
table: misc.unitname
columns:
unitname: "Test Ansible"
register: result
- ansible.builtin.debug:
var: result
- name: Add a DNS server
community.network.ig_config:
client: "{{ client_rw }}"
add: true
table: misc.dns_servers
columns:
server: 192.168.1.21
register: result
- ansible.builtin.debug:
var: result
- name: Add a DNS server
community.network.ig_config:
client: "{{ client_rw }}"
add: true
table: misc.dns_servers
columns:
server: 192.168.1.22
register: result
- ansible.builtin.debug:
var: result
- name: Add a DNS server
community.network.ig_config:
client: "{{ client_rw }}"
add: true
table: misc.dns_servers
columns:
server: 192.168.1.23
register: last_dns
- ansible.builtin.debug:
var: last_dns
- name: Modify the last added DNS server
community.network.ig_config:
client: "{{ client_rw }}"
modify: true
table: misc.dns_servers
rowid: "{{ last_dns['add'][0]['id'] }}"
columns:
server: 192.168.1.24
register: result
- ansible.builtin.debug:
var: result
- name: Return the last added DNS server
community.network.ig_config:
client: "{{ client_rw }}"
get: true
table: misc.dns_servers
rowid: "{{ last_dns['add'][0]['id'] }}"
register: result
- ansible.builtin.debug:
var: result
- name: Remove last added DNS server
community.network.ig_config:
client: "{{ client_rw }}"
delete: true
table: misc.dns_servers
rowid: "{{ last_dns['add'][0]['id'] }}"
register: result
- ansible.builtin.debug:
var: result
- name: Return the all rows from table misc.dns_servers
community.network.ig_config:
client: "{{ client_rw }}"
get: true
table: misc.dns_servers
register: result
- ansible.builtin.debug:
var: result
- name: Remove remaining DNS servers
community.network.ig_config:
client: "{{ client_rw }}"
delete: true
table: misc.dns_servers
register: result
- ansible.builtin.debug:
var: result
- name: Get rowid for interface eth0
community.network.ig_config:
client: "{{ client_rw }}"
return_rowid: true
table: network.local_nets
columns:
interface: eth0
register: result
- ansible.builtin.debug:
var: result
- name: Store the preliminary configuration
community.network.ig_config:
client: "{{ client_rw }}"
store: true
register: result
- ansible.builtin.debug:
var: result
- name: Do backup of the configuration database
community.network.ig_config:
client: "{{ client_rw }}"
download: true
store_download: true
register: result
- ansible.builtin.debug:
var: result
返回值
常见的返回值已在 此处 记录,以下是此模块特有的字段
键 |
描述 |
---|---|
包含有关已添加行的信息的列表 返回:当 |
|
列名/值 返回:成功 示例: |
|
已添加行的 REST API URL 返回:成功 示例: |
|
行 ID 返回:成功 示例: |
|
包含有关已删除行信息的列表 返回:当 |
|
列名/值 返回:成功 示例: |
|
行 ID 返回:成功 示例: |
|
表名 返回:成功 示例: |
|
配置数据库和元数据 返回:当 |
|
配置数据库 返回:成功 |
|
建议的配置名称 返回:成功 示例: |
|
MIME 类型 返回:成功 示例: |
|
命令状态消息 返回:当 |
|
命令状态消息 返回:成功 示例: |
|
包含有关行信息的列表 返回:当 |
|
列名/值 返回:成功 示例: |
|
指向行的 REST API URL 返回:成功 示例: |
|
行 ID 返回:成功 示例: |
|
表名 返回:成功 示例: |
|
包含有关已修改行信息的列表 返回:当 |
|
列名/值 返回:成功 示例: |
|
指向已修改行的 REST API URL 返回:成功 示例: |
|
行 ID 返回:成功 示例: |
|
表名 返回:成功 示例: |
|
匹配的行 ID。 返回:当 示例: |
|
命令状态消息 返回:当 |
|
命令状态消息 返回:成功 示例: |
|
命令状态消息 返回:当 |
|
命令状态消息 返回:成功 示例: |
状态
此模块将在 6.0.0 版本中移除。[已弃用]
更多信息请参见 已弃用。