Ejemplo n.º 1
0
RETURN = r'''
#
'''

from ansible_collections.piolink.pask.plugins.module_utils.pask_module import PaskModule,\
    make_module_args, try_except

passwd_params_str = ['des_passwd', 'md5_passwd', 'sha_passwd', 'aes_passwd']
passwd_args = dict()
for p in passwd_params_str:
    passwd_args[p] = dict(type='str', no_log=True)

trap_host_params_str = ['community', 'engine_id', 'version', 'user']
inner_trap_host_args = dict(ip=dict(type='str', required=True), )
inner_trap_host_args.update(make_module_args(trap_host_params_str))
inner_trap_host_args.update(passwd_args)

trap_params = [
    'cold_start', 'failover', 'fan', 'health_check', 'link_down', 'link_up',
    'management_cpu', 'management_memory', 'packet_cpu', 'packet_memory',
    'power', 'temperature'
]
inner_trap_args = dict(host=dict(type='list',
                                 elements='dict',
                                 options=inner_trap_host_args), )
inner_trap_args.update(make_module_args(trap_params))

inner_user_args = dict(name=dict(type='str', required=True), )
inner_user_args.update(passwd_args)
inner_ip_args = dict(address=dict(type='str', required=True),
                     broadcast=dict(type='str'),
                     overlapped=dict(type='str'))

inner_ip6_args = dict(address=dict(type='str', required=True), )

inner_ip6_params_str = [
    'broadcast',
    'adv_on_link',
    'adv_autonomous',
    'adv_router_addr',
    'adv_valid_lifetime',
    'adv_preferred_lifetime',
]
inner_ip6_args.update(make_module_args(inner_ip6_params_str))

module_args = dict(
    name=dict(type='str', required=True),
    ip=dict(type='dict', options=inner_ip_args),
    ip6=dict(type='dict', options=inner_ip6_args),
)

outermost_param_str = [
    'mtu',
    'rpf',
    'status',
    'state',
    'adv_cur_hop_limit',
    'adv_default_lifetime',
    'adv_reachable_time',
Ejemplo n.º 3
0
      level: "user"
      log: "disable"
      password: "******"
      state: "absent"
'''

RETURN = r'''
#
'''

import os
from ansible_collections.piolink.pask.plugins.module_utils.pask_module import PaskModule,\
    make_module_args, try_except

outermost_param_str = ['description', 'level', 'log', 'state']
outermost_args = make_module_args(outermost_param_str)

password_args = dict(password=dict(type='str', no_log=True),
                     config_password=dict(type='str', no_log=True))

module_args = dict(name=dict(type='str', required=True))
module_args.update(outermost_args)
module_args.update(password_args)

name = 'user'


class PaskUser(PaskModule):
    def __init__(self, name, module_args):
        super(PaskUser, self).__init__(name, module_args)
Ejemplo n.º 4
0
'''

RETURN = r'''
#
'''

import os
from ansible_collections.piolink.pask.plugins.module_utils.pask_module import PaskModule,\
    try_except, make_module_args

inner_nat_param = [
    'type', 'priority', 'sip', 'dip', 'protocol', 'natip', 'status',
    'external_ip', 'internal_ip'
]
inner_nat_args = dict(id=dict(type='str', required=True), )
inner_nat_args.update(make_module_args(inner_nat_param))

inner_hc_args = dict(id=dict(type='str', required=True), )

module_args = dict(id=dict(type='str', required=True),
                   rip=dict(type='str', required=True),
                   nat=dict(type='list',
                            elements='dict',
                            options=inner_nat_args),
                   health_check=dict(type='list',
                                     elements='dict',
                                     options=inner_hc_args))

param_list = [
    'name', 'rport', 'mac', 'interface', 'priority', 'weight',
    'graceful_shutdown', 'max_connection', 'upload_bandwidth',
Ejemplo n.º 5
0
from ansible_collections.piolink.pask.plugins.module_utils.pask_module import PaskModule,\
    make_module_args, try_except


id_inner_args = dict(
    id=dict(type='str', required=True),
    ip=dict(type='str', required=True),
)

outermost_param_str = [
    'retry', 'timeout'
]
module_args = dict(
    id=dict(type='list', elements='dict', options=id_inner_args)
)
module_args.update(make_module_args(outermost_param_str))

name = 'dns'


class PaskDns(PaskModule):
    def __init__(self, name, module_args):
        super(PaskDns, self).__init__(name, module_args)

    @try_except
    def run(self):
        data = self.make_data(self.module.params, include_inner=True)
        self.resp = self.prest.put(self.url, data)


def main():
Ejemplo n.º 6
0
      maxpoll: "8"
      status: "disable"
'''

RETURN = r'''
#
'''

from ansible_collections.piolink.pask.plugins.module_utils.pask_module import PaskModule,\
    make_module_args, try_except

mostouter_params = [
    'status', 'primary_server', 'secondary_server', 'minpoll', 'maxpoll'
]

module_args = make_module_args(mostouter_params)

name = 'ntp'


class PaskNtp(PaskModule):
    def __init__(self, name, module_args):
        super(PaskNtp, self).__init__(name, module_args)

    @try_except
    def run(self):
        data = self.make_data(self.module.params)
        self.resp = self.prest.put(self.url, data)


def main():
Ejemplo n.º 7
0
#
'''

try:
    import netaddr
    HAS_NETADDR = True
except ImportError:
    HAS_NETADDR = False

import json
from ansible.module_utils.basic import missing_required_lib
from ansible_collections.piolink.pask.plugins.module_utils.pask_module import PaskModule,\
    make_module_args, try_except

inner_interface_params = ['interface']
inner_interface_args = make_module_args(inner_interface_params)
inner_gateway_params = ['gateway']
inner_gateway_args = make_module_args(inner_gateway_params)

inner_network_args = dict(dest=dict(type='str', required=True),
                          interface=dict(type='list',
                                         elements='dict',
                                         options=inner_interface_args),
                          gateway=dict(type='list',
                                       elements='dict',
                                       options=inner_gateway_args))

inner_health_check_args = dict(id=dict(type="str", required=True))

inner_defaultgw_args = dict(priority=dict(type='str'),
                            gateway=dict(type='str', required=True),
Ejemplo n.º 8
0
from ansible_collections.piolink.pask.plugins.module_utils.pask_module import PaskModule,\
    make_module_args, try_except
import os

# make vip args
protocol_inner_args = dict(protocol=dict(type='str', required=True),
                           vport=dict(type='str'))

vip_inner_args = dict(ip=dict(type='str', required=True),
                      protocol=dict(type='dict', options=protocol_inner_args))

# real inner args
real_inner_param = ['rport', 'status', 'graceful_shutdown']
real_inner_args = dict(id=dict(type='str', required=True), )
d = make_module_args(real_inner_param)
real_inner_args.update(d)

slow_start_inner_args = dict(
    rate=dict(type='str'),
    timer=dict(type='str'),
)

# sticky param
sticky_inner_param = ['time', 'source_subnet']
sticky_inner_args = make_module_args(sticky_inner_param)

# make dynamic_proximity_args
dynamic_proximity_inner_args = dict(name=dict(type='str', required=True),
                                    ratio=dict(type='str'))