community.network.ig_config – Manage the configuration database on an Ingate SBC.

From Get docs
Ansible/docs/2.10/collections/community/network/ig config module


community.network.ig_config – Manage the configuration database on an Ingate SBC.

Note

This plugin is part of the community.network collection (version 1.3.0).

To install it use: ansible-galaxy collection install community.network.

To use it in a playbook, specify: community.network.ig_config.


Synopsis

  • Manage the configuration database on an Ingate SBC.

Requirements

The below requirements are needed on the host that executes this module.

  • ingatesdk >= 1.0.6

Parameters

Parameter Choices/Defaults Comments

add

boolean

  • no
  • yes

Add a row to a table.

client

string

A dict object containing connection details.

address

string / required

The hostname or IP address to the unit.

password

string / required

The password for the REST API user.

port

integer

Which HTTP(S) port to connect to.

scheme

string / required

  • http
  • https

Which HTTP protocol to use.

timeout

integer

The timeout (in seconds) for REST API requests.

username

string / required

The username of the REST API user.

validate_certs

boolean

  • no
  • yes

Verify the unit's HTTPS certificate.


aliases: verify_ssl

version

string

  • v1

REST API version.

columns

string

A dict containing column names/values.

delete

boolean

  • no
  • yes

Delete all rows in a table or a specific row.

download

boolean

  • no
  • yes

Download the configuration database from the unit.

factory

boolean

  • no
  • yes

Reset the preliminary configuration to its factory defaults.

filename

string

The name of the file to store the downloaded configuration in. Refer to the download option.

get

boolean

  • no
  • yes

Return all rows in a table or a specific row.

modify

boolean

  • no
  • yes

Modify a row in a table.

no_response

boolean

  • no

  • yes

Expect no response when storing the preliminary configuration. Refer to the store option.

path

string

Where in the filesystem to store the downloaded configuration. Refer to the download option.

return_rowid

boolean

  • no
  • yes

Get rowid(s) from a table where the columns match.

revert

boolean

  • no
  • yes

Reset the preliminary configuration.

rowid

integer

A row id.

store

boolean

  • no
  • yes

Store the preliminary configuration.

store_download

boolean

  • no

  • yes

If the downloaded configuration should be stored on disk. Refer to the download option.

table

string

The name of the table.



Notes

Note

  • If store_download is set to True, and path and filename is omitted, the file will be stored in the current directory with an automatic filename.
  • This module requires that the Ingate Python SDK is installed on the host. To install the SDK use the pip command from your shell pip install ingatesdk.


Examples

- 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

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description

add

complex

when add is yes and success

A list containing information about the added row


data

complex

success

Column names/values


Sample:

{'number': '2', 'server': '10.48.254.33'}

href

string

success

The REST API URL to the added row


Sample:

id

integer

success

The row id


Sample:

22

delete

complex

when delete is yes and success

A list containing information about the deleted row(s)


data

complex

success

Column names/values


Sample:

{'number': '2', 'server': '10.48.254.33'}

id

integer

success

The row id


Sample:

22

table

string

success

The name of the table


Sample:

misc.dns_servers

download

complex

when download is yes and success

Configuration database and meta data


config

string

success

The configuration database


filename

string

success

A suggested name for the configuration


Sample:

testname_2018-10-01T214040.cfg

mimetype

string

success

The mimetype


Sample:

application/x-config-database

factory

complex

when factory is yes and success

A command status message


msg

string

success

The command status message


Sample:

reverted the configuration to the factory configuration.

get

complex

when get is yes and success

A list containing information about the row(s)


data

complex

success

Column names/values


Sample:

{'number': '2', 'server': '10.48.254.33'}

href

string

success

The REST API URL to the row


Sample:

id

integer

success

The row id


Sample:

1

table

string

success

The name of the table


Sample:

Testname

modify

complex

when modify is yes and success

A list containing information about the modified row


data

complex

success

Column names/values


Sample:

{'number': '2', 'server': '10.48.254.33'}

href

string

success

The REST API URL to the modified row


Sample:

id

integer

success

The row id


Sample:

10

table

string

success

The name of the table


Sample:

Testname

return_rowid

list / elements=string

when return_rowid is yes and success

The matched row id(s).


Sample:

[1, 3]

revert

complex

when revert is yes and success

A command status message


msg

string

success

The command status message


Sample:

reverted the configuration to the last applied configuration.

store

complex

when store is yes and success

A command status message


msg

string

success

The command status message


Sample:

Successfully applied and saved the configuration.




Authors

  • Ingate Systems AB (@ingatesystems)

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/community/network/ig_config_module.html