def main():
    ''' Main entry point for module execution
    '''
    ib_spec = dict(
        name=dict(required=True, aliases=['network_view'], ib_req=True),

        extattrs=dict(type='dict'),
        comment=dict(),
    )

    argument_spec = dict(
        provider=dict(required=True),
        state=dict(default='present', choices=['present', 'absent'])
    )

    argument_spec.update(ib_spec)
    argument_spec.update(get_provider_spec())

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)

    wapi = Wapi(module)
    result = wapi.run('networkview', ib_spec)

    module.exit_json(**result)
Example #2
0
def main():
    ''' Main entry point for module execution
    '''
    grid_spec = dict(name=dict(required=True), )

    ib_spec = dict(fqdn=dict(required=True, aliases=['name'], ib_req=True),
                   view=dict(default='default',
                             aliases=['dns_view'],
                             ib_req=True),
                   grid_primary=dict(type='list',
                                     elements='dict',
                                     options=grid_spec),
                   grid_secondaries=dict(type='list',
                                         elements='dict',
                                         options=grid_spec),
                   restart_if_needed=dict(type='bool', default=False),
                   extattrs=dict(type='dict'),
                   comment=dict())

    argument_spec = dict(provider=dict(required=True),
                         state=dict(default='present',
                                    choices=['present', 'absent']))

    argument_spec.update(ib_spec)
    argument_spec.update(get_provider_spec())

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)

    wapi = Wapi(module)
    result = wapi.run('zone_auth', ib_spec)

    module.exit_json(**result)
Example #3
0
 def test_get_provider_spec(self):
     provider_options = [
         'host', 'username', 'password', 'ssl_verify',
         'http_request_timeout', 'http_pool_connections',
         'http_pool_maxsize', 'max_retries', 'wapi_version'
     ]
     res = api.get_provider_spec()
     self.assertIsNotNone(res)
     self.assertIn('provider', res)
     self.assertIn('options', res['provider'])
     returned_options = res['provider']['options']
     self.assertEqual(sorted(provider_options),
                      sorted(returned_options.keys()))
Example #4
0
def main():
    ''' Main entry point for module execution
    '''
    ipv4addr_spec = dict(ipv4addr=dict(required=True,
                                       aliases=['address'],
                                       ib_req=True),
                         mac=dict())

    ipv6addr_spec = dict(
        ipv6addr=dict(required=True, aliases=['address'], ib_req=True))

    ib_spec = dict(
        name=dict(required=True, ib_req=True),
        view=dict(default='default', aliases=['dns_view'], ib_req=True),
        ipv4addrs=dict(type='list',
                       aliases=['ipv4'],
                       elements='dict',
                       options=ipv4addr_spec,
                       transform=ipv4addrs),
        ipv6addrs=dict(type='list',
                       aliases=['ipv6'],
                       elements='dict',
                       options=ipv6addr_spec,
                       transform=ipv6addrs),
        ttl=dict(type='int'),
        extattrs=dict(type='dict'),
        comment=dict(),
    )

    argument_spec = dict(provider=dict(required=True),
                         state=dict(default='present',
                                    choices=['present', 'absent']))

    argument_spec.update(ib_spec)
    argument_spec.update(get_provider_spec())

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)

    wapi = Wapi(module)
    result = wapi.run('record:host', ib_spec)

    module.exit_json(**result)
Example #5
0
def main():
    ''' Main entry point for module execution
    '''
    option_spec = dict(
        # one of name or num is required; enforced by the function options()
        name=dict(),
        num=dict(type='int'),
        value=dict(required=True),
        use_option=dict(type='bool', default=True),
        vendor_class=dict(default='DHCP'))

    ib_spec = dict(network=dict(required=True,
                                aliases=['name', 'cidr'],
                                ib_req=True),
                   network_view=dict(default='default', ib_req=True),
                   options=dict(type='list',
                                elements='dict',
                                options=option_spec,
                                transform=options),
                   extattrs=dict(type='dict'),
                   comment=dict())

    argument_spec = dict(provider=dict(required=True),
                         state=dict(default='present',
                                    choices=['present', 'absent']))

    argument_spec.update(ib_spec)
    argument_spec.update(get_provider_spec())

    module = AnsibleModule(argument_spec=argument_spec,
                           supports_check_mode=True)

    wapi = Wapi(module)
    result = wapi.run('network', ib_spec)

    module.exit_json(**result)