Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/ingate/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/ingate/ig_config.pyc

�
�Udac@`s�ddlmZmZmZeZidgd6dd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
mZydd
lmZeZWnek
r�eZnXd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functiontpreviewtstatust	communitytsupported_bys1.1tmetadata_versions
---
module: ig_config
short_description: Manage the configuration database on an Ingate SBC.
description:
  - Manage the configuration database on an Ingate SBC.
version_added: 2.8
extends_documentation_fragment: ingate
options:
  add:
    description:
      - Add a row to a table.
    type: bool
  delete:
    description:
      - Delete all rows in a table or a specific row.
    type: bool
  get:
    description:
      - Return all rows in a table or a specific row.
    type: bool
  modify:
    description:
      - Modify a row in a table.
    type: bool
  revert:
    description:
      - Reset the preliminary configuration.
    type: bool
  factory:
    description:
      - Reset the preliminary configuration to its factory defaults.
    type: bool
  store:
    description:
      - Store the preliminary configuration.
    type: bool
  no_response:
    description:
      - Expect no response when storing the preliminary configuration.
        Refer to the C(store) option.
    type: bool
  return_rowid:
    description:
      - Get rowid(s) from a table where the columns match.
    type: bool
  download:
    description:
      - Download the configuration database from the unit.
    type: bool
  store_download:
    description:
      - If the downloaded configuration should be stored on disk.
        Refer to the C(download) option.
    type: bool
    default: false
  path:
    description:
      - Where in the filesystem to store the downloaded configuration.
        Refer to the C(download) option.
  filename:
    description:
      - The name of the file to store the downloaded configuration in.
        Refer to the C(download) option.
  table:
    description:
      - The name of the table.
  rowid:
    description:
      - A row id.
    type: int
  columns:
    description:
      - A dict containing column names/values.
notes:
  - If C(store_download) is set to True, and C(path) and C(filename) is omitted,
    the file will be stored in the current directory with an automatic filename.
author:
  - Ingate Systems AB (@ingatesystems)
sI
- 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
    ig_config:
      client: "{{ client_rw }}"
      factory: true
    register: result
  - debug:
      var: result

  - name: Revert to last known applied configuration
    ig_config:
      client: "{{ client_rw }}"
      revert: true
    register: result
  - debug:
      var: result

  - name: Change the unit name
    ig_config:
      client: "{{ client_rw }}"
      modify: true
      table: misc.unitname
      columns:
        unitname: "Test Ansible"
    register: result
  - debug:
      var: result

  - name: Add a DNS server
    ig_config:
      client: "{{ client_rw }}"
      add: true
      table: misc.dns_servers
      columns:
        server: 192.168.1.21
    register: result
  - debug:
      var: result

  - name: Add a DNS server
    ig_config:
      client: "{{ client_rw }}"
      add: true
      table: misc.dns_servers
      columns:
        server: 192.168.1.22
    register: result
  - debug:
      var: result

  - name: Add a DNS server
    ig_config:
      client: "{{ client_rw }}"
      add: true
      table: misc.dns_servers
      columns:
        server: 192.168.1.23
    register: last_dns
  - debug:
      var: last_dns

  - name: Modify the last added DNS server
    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
  - debug:
      var: result

  - name: Return the last added DNS server
    ig_config:
      client: "{{ client_rw }}"
      get: true
      table: misc.dns_servers
      rowid: "{{ last_dns['add'][0]['id'] }}"
    register: result
  - debug:
      var: result

  - name: Remove last added DNS server
    ig_config:
      client: "{{ client_rw }}"
      delete: true
      table: misc.dns_servers
      rowid: "{{ last_dns['add'][0]['id'] }}"
    register: result
  - debug:
      var: result

  - name: Return the all rows from table misc.dns_servers
    ig_config:
      client: "{{ client_rw }}"
      get: true
      table: misc.dns_servers
    register: result
  - debug:
      var: result

  - name: Remove remaining DNS servers
    ig_config:
      client: "{{ client_rw }}"
      delete: true
      table: misc.dns_servers
    register: result
  - debug:
      var: result

  - name: Get rowid for interface eth0
    ig_config:
      client: "{{ client_rw }}"
      return_rowid: true
      table: network.local_nets
      columns:
        interface: eth0
    register: result
  - debug:
      var: result

  - name: Store the preliminary configuration
    ig_config:
      client: "{{ client_rw }}"
      store: true
    register: result
  - debug:
      var: result

  - name: Do backup of the configuration database
    ig_config:
      client: "{{ client_rw }}"
      download: true
      store_download: true
    register: result
  - debug:
      var: result
sH
add:
  description: A list containing information about the added row
  returned: when C(add) is yes and success
  type: complex
  contains:
    href:
      description: The REST API URL to the added row
      returned: success
      type: str
      sample: http://192.168.1.1/api/v1/misc/dns_servers/2
    data:
      description: Column names/values
      returned: success
      type: complex
      sample: {'number': '2', 'server': '10.48.254.33'}
    id:
      description: The row id
      returned: success
      type: int
      sample: 22
delete:
  description: A list containing information about the deleted row(s)
  returned: when C(delete) is yes and success
  type: complex
  contains:
    table:
      description: The name of the table
      returned: success
      type: str
      sample: misc.dns_servers
    data:
      description: Column names/values
      returned: success
      type: complex
      sample: {'number': '2', 'server': '10.48.254.33'}
    id:
      description: The row id
      returned: success
      type: int
      sample: 22
get:
  description: A list containing information about the row(s)
  returned: when C(get) is yes and success
  type: complex
  contains:
    table:
      description: The name of the table
      returned: success
      type: str
      sample: Testname
    href:
      description: The REST API URL to the row
      returned: success
      type: str
      sample: http://192.168.1.1/api/v1/misc/dns_servers/1
    data:
      description: Column names/values
      returned: success
      type: complex
      sample: {'number': '2', 'server': '10.48.254.33'}
    id:
      description: The row id
      returned: success
      type: int
      sample: 1
modify:
  description: A list containing information about the modified row
  returned: when C(modify) is yes and success
  type: complex
  contains:
    table:
      description: The name of the table
      returned: success
      type: str
      sample: Testname
    href:
      description: The REST API URL to the modified row
      returned: success
      type: str
      sample: http://192.168.1.1/api/v1/misc/dns_servers/1
    data:
      description: Column names/values
      returned: success
      type: complex
      sample: {'number': '2', 'server': '10.48.254.33'}
    id:
      description: The row id
      returned: success
      type: int
      sample: 10
revert:
  description: A command status message
  returned: when C(revert) is yes and success
  type: complex
  contains:
    msg:
      description: The command status message
      returned: success
      type: str
      sample: reverted the configuration to the last applied configuration.
factory:
  description: A command status message
  returned: when C(factory) is yes and success
  type: complex
  contains:
    msg:
      description: The command status message
      returned: success
      type: str
      sample: reverted the configuration to the factory configuration.
store:
  description: A command status message
  returned: when C(store) is yes and success
  type: complex
  contains:
    msg:
      description: The command status message
      returned: success
      type: str
      sample: Successfully applied and saved the configuration.
return_rowid:
  description: The matched row id(s).
  returned: when C(return_rowid) is yes and success
  type: list
  sample: [1, 3]
download:
  description: Configuration database and meta data
  returned: when C(download) is yes and success
  type: complex
  contains:
    config:
      description: The configuration database
      returned: success
      type: str
    filename:
      description: A suggested name for the configuration
      returned: success
      type: str
      sample: testname_2018-10-01T214040.cfg
    mimetype:
      description: The mimetype
      returned: success
      type: str
      sample: application/x-config-database
(t
AnsibleModule(tingate_argument_spectingate_create_client(t	ingatesdkcC`s,t|j�}|jjd�rZ|jd}|jd}|j||�}td|fS|jjd�r�t}|jd}|jjd�}|r�|j|d|�}n|j|�}|r�t}n|d|fS|jjd�rT|jd}|jjd�}|r)|j|d|�}n|j	|�}|rGt}n|d|fS|jjd�r�|jd}|jd}|jjd�}|r�|j
|d||�}n|j||�}|r�t}n|d|fS|jjd�r#|j�}|r|d	d
}ntd|fS|jjd�re|j
�}|rX|d	d}ntd|fS|jjd
�r�|jjd�}|jd|�}|r�|d	d}ntd
|fS|jjd�r�|jd}|jd}|j	|�}g}x�|D]}}	t}
xT|j�D]F\}}||	dkrBq n|	d||ks`t}
Pq t}
q W|
r|j|	d�qqWtd|fS|jjd�r|jjd�}
|jjd�}|jjd�}|jd
|
d|d|�}|r|d	d}ntd|fStdifS(Ntaddttabletcolumnstdeletetrowidtgettmodifytrevertisrevert-editstfactorysload-factorytstoretno_responses
store-edittreturn_rowidtdatatidtdownloadtstore_downloadtpathtfilenamesdownload-configt(R
tparamsRtadd_rowtTruetFalset
delete_rowtdelete_tabletdump_rowt
dump_tablet
modify_rowtmodify_single_rowtrevert_editstload_factoryt
store_edittitemstappendtdownload_config(tmodulet
api_clientR
RtresponsetchangedRRtrowidstrowtmatchtnametvalueRRR((sL/usr/lib/python2.7/site-packages/ansible/modules/network/ingate/ig_config.pytmake_request�s�



	

	


	








	
c
#C`sEtdtdd�dtdd�dtdd�dtdd�dtdd�dtdd�d	tdd�d
tdddt�dtdd�d
tdd�dtdddt�dt�dt�dt�dtdd�dtdd��}dg}ddddddd	dd
g	g}dtddgfdtdgfdtdgfdtddgfdtddgfg}td|d|d|d|dt�}ts�|jdd�ntdt�}y<t|�\}}}|r�|r�|||<n||d<Wn,tj	k
r3}	|jdt
|	��nX|j|�dS(NRttypetboolRRRRRRRtdefaultRRRRRR
RtintRtdictt
argument_spectmutually_exclusivetrequired_iftrequired_one_oftsupports_check_modetmsgs(The Ingate Python SDK module is requiredR2(	RRRRRRRRR(R	R=R"R!Rt
HAS_INGATESDKt	fail_jsonR8RtSdkErrortstrt	exit_json(
R>R?RAR@R/tresultR2tcommandR1te((sL/usr/lib/python2.7/site-packages/ansible/modules/network/ingate/ig_config.pytmainsT					
t__main__N(t
__future__RRRR9t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRt*ansible.module_utils.network.ingate.commonR	R
tingateRR!RDtImportErrorR"R8RLt__name__(((sL/usr/lib/python2.7/site-packages/ansible/modules/network/ingate/ig_config.pyt<module>s$

Q��


	`	1

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]