Esempio n. 1
0
def main():
    argument_spec = scaleway_argument_spec()
    argument_spec.update(
        dict(
            state=dict(type='str',
                       default='present',
                       choices=['absent', 'present']),
            organization=dict(type='str', required=True),
            name=dict(type='str', required=True),
            description=dict(type='str'),
            region=dict(type='str',
                        required=True,
                        choices=list(SCALEWAY_LOCATION.keys())),
            stateful=dict(type='bool', required=True),
            inbound_default_policy=dict(type='str', choices=['accept',
                                                             'drop']),
            outbound_default_policy=dict(type='str',
                                         choices=['accept', 'drop']),
            organization_default=dict(type='bool'),
        ))
    module = AnsibleModule(
        argument_spec=argument_spec,
        supports_check_mode=True,
        required_if=[[
            'stateful', True,
            ['inbound_default_policy', 'outbound_default_policy']
        ]])

    core(module)
Esempio n. 2
0
def main():
    argument_spec = scaleway_argument_spec()
    argument_spec.update(
        state=dict(type='str',
                   default='present',
                   choices=['absent', 'present']),
        region=dict(type='str',
                    required=True,
                    choices=list(SCALEWAY_LOCATION.keys())),
        protocol=dict(type='str',
                      required=True,
                      choices=['TCP', 'UDP', 'ICMP']),
        port=dict(type='int', required=True),
        ip_range=dict(type='str', default='0.0.0.0/0'),
        direction=dict(type='str',
                       required=True,
                       choices=['inbound', 'outbound']),
        action=dict(type='str', required=True, choices=['accept', 'drop']),
        security_group=dict(type='str', required=True),
    )
    module = AnsibleModule(
        argument_spec=argument_spec,
        supports_check_mode=True,
    )
    if not HAS_IPADDRESS:
        module.fail_json(msg=missing_required_lib('ipaddress'),
                         exception=IPADDRESS_IMP_ERR)

    core(module)
Esempio n. 3
0
def main():
    argument_spec = scaleway_argument_spec()
    argument_spec.update(dict(
        state=dict(default='present', choices=['absent', 'present', 'exported', 'restored']),
        region=dict(required=True, choices=SCALEWAY_REGIONS),
        id=dict(),
        name=dict(type='str'),
        database_name=dict(required=False),
        instance_id=dict(required=False),
        expires_at=dict(),
        wait=dict(type='bool', default=False),
        wait_timeout=dict(type='int', default=300),
        wait_sleep_time=dict(type='int', default=3),
    ))
    module = AnsibleModule(
        argument_spec=argument_spec,
        supports_check_mode=True,
        required_together=[
            ['database_name', 'instance_id'],
        ],
        required_if=[
            ['state', 'present', ['name', 'database_name', 'instance_id']],
            ['state', 'absent', ['id']],
            ['state', 'exported', ['id']],
            ['state', 'restored', ['id', 'database_name', 'instance_id']],
        ],
    )

    core(module)
def main():
    argument_spec = scaleway_argument_spec()
    argument_spec.update(dict(
        image=dict(required=True),
        name=dict(),
        region=dict(required=True, choices=list(SCALEWAY_LOCATION.keys())),
        commercial_type=dict(required=True),
        enable_ipv6=dict(default=False, type="bool"),
        public_ip=dict(default="absent"),
        state=dict(choices=list(state_strategy.keys()), default='present'),
        tags=dict(type="list", elements="str", default=[]),
        organization=dict(),
        project=dict(),
        wait=dict(type="bool", default=False),
        wait_timeout=dict(type="int", default=300),
        wait_sleep_time=dict(type="int", default=3),
        security_group=dict(),
    ))
    module = AnsibleModule(
        argument_spec=argument_spec,
        supports_check_mode=True,
        mutually_exclusive=[
            ('organization', 'project'),
        ],
        required_one_of=[
            ('organization', 'project'),
        ],
    )

    core(module)
def main():
    argument_spec = scaleway_argument_spec()
    argument_spec.update(
        state=dict(type='str',
                   default='present',
                   choices=['absent', 'present']),
        region=dict(type='str',
                    required=True,
                    choices=list(SCALEWAY_LOCATION.keys())),
        protocol=dict(type='str',
                      required=True,
                      choices=['TCP', 'UDP', 'ICMP']),
        port=dict(type='int', required=True),
        ip_range=dict(type='str', default='0.0.0.0/0'),
        direction=dict(type='str',
                       required=True,
                       choices=['inbound', 'outbound']),
        action=dict(type='str', required=True, choices=['accept', 'drop']),
        security_group=dict(type='str', required=True),
    )
    module = AnsibleModule(
        argument_spec=argument_spec,
        supports_check_mode=True,
    )

    core(module)
Esempio n. 6
0
def main():
    argument_spec = scaleway_argument_spec()
    argument_spec.update(dict(
        region=dict(required=True, choices=list(SCALEWAY_LOCATION.keys())),
        user_data=dict(type="dict"),
        server_id=dict(required=True),
    ))
    module = AnsibleModule(
        argument_spec=argument_spec,
        supports_check_mode=True,
    )

    core(module)
Esempio n. 7
0
def main():
    argument_spec = scaleway_argument_spec()
    argument_spec.update(dict(
        state=dict(default='present', choices=['absent', 'present']),
        ssh_pub_key=dict(required=True),
        api_url=dict(fallback=(env_fallback, ['SCW_API_URL']), default='https://account.scaleway.com', aliases=['base_url']),
    ))
    module = AnsibleModule(
        argument_spec=argument_spec,
        supports_check_mode=True,
    )

    core(module)
Esempio n. 8
0
def main():
    argument_spec = scaleway_argument_spec()
    argument_spec.update(
        dict(region=dict(required=True, choices=SCALEWAY_LOCATION.keys()), ))
    module = AnsibleModule(
        argument_spec=argument_spec,
        supports_check_mode=True,
    )

    try:
        module.exit_json(
            scaleway_image_info=ScalewayImageInfo(module).get_resources())
    except ScalewayException as exc:
        module.fail_json(msg=exc.message)
def main():
    argument_spec = scaleway_argument_spec()
    argument_spec.update(
        dict(state=dict(default='present', choices=['absent', 'present']),
             organization=dict(required=True),
             server=dict(),
             reverse=dict(),
             region=dict(required=True, choices=SCALEWAY_LOCATION.keys()),
             id=dict()))
    module = AnsibleModule(
        argument_spec=argument_spec,
        supports_check_mode=True,
    )

    core(module)
def main():
    argument_spec = scaleway_argument_spec()
    argument_spec.update(
        dict(state=dict(default='present', choices=['absent', 'present']),
             project=dict(required=True),
             region=dict(required=True,
                         choices=list(SCALEWAY_LOCATION.keys())),
             tags=dict(type="list", elements="str", default=[]),
             name=dict()))
    module = AnsibleModule(
        argument_spec=argument_spec,
        supports_check_mode=True,
    )

    core(module)
def main():
    argument_spec = scaleway_argument_spec()
    argument_spec.update(dict(
        region=dict(required=True, choices=SCALEWAY_LOCATION.keys()),
    ))
    module = AnsibleModule(
        argument_spec=argument_spec,
        supports_check_mode=True,
    )

    try:
        module.exit_json(
            ansible_facts={'scaleway_security_group_facts': ScalewaySecurityGroupFacts(module).get_resources()}
        )
    except ScalewayException as exc:
        module.fail_json(msg=exc.message)
Esempio n. 12
0
def main():
    argument_spec = scaleway_argument_spec()
    argument_spec.update(
        dict(
            state=dict(default='present', choices=['absent', 'present']),
            name=dict(required=True),
            size=dict(type='int'),
            organization=dict(),
            volume_type=dict(),
            region=dict(required=True, choices=list(SCALEWAY_LOCATION.keys())),
        ))
    module = AnsibleModule(
        argument_spec=argument_spec,
        supports_check_mode=True,
    )

    core(module)
def main():
    argument_spec = scaleway_argument_spec()
    argument_spec.update(
        dict(api_url=dict(fallback=(env_fallback, ['SCW_API_URL']),
                          default='https://account.scaleway.com',
                          aliases=['base_url']), ))

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

    try:
        module.exit_json(scaleway_organization_info=ScalewayOrganizationInfo(
            module).get_resources())
    except ScalewayException as exc:
        module.fail_json(msg=exc.message)
Esempio n. 14
0
def main():
    argument_spec = scaleway_argument_spec()
    argument_spec.update(dict(
        name=dict(required=True),
        description=dict(required=True),
        region=dict(required=True, choices=SCALEWAY_REGIONS),
        state=dict(choices=list(state_strategy.keys()), default='present'),
        tags=dict(type="list", default=[]),
        organization_id=dict(required=True),
        wait=dict(type="bool", default=False),
        wait_timeout=dict(type="int", default=300),
        wait_sleep_time=dict(type="int", default=3),
    ))
    module = AnsibleModule(
        argument_spec=argument_spec,
        supports_check_mode=True,
    )

    core(module)