예제 #1
0
def main():

    required_togheter_args = [['name', 'state']]
    module = AnsibleModule(argument_spec=dict(
        image=dict(required=True, type='str'),
        automount=dict(required=False, type='bool', default=True),
        network=dict(required=False, type='bool', default=True),
        selinux_relabel=dict(required=False, type='bool', default=False),
        name=dict(required=True, type='str'),
        password=dict(type='str', no_log=True),
        state=dict(required=True, choices=['present', 'absent']),
        debug=dict(required=False, type='bool', default=False),
        force=dict(required=False, type='bool', default=False)),
                           required_together=required_togheter_args,
                           supports_check_mode=False)

    if not module.params['password'] and module.params['state'] == 'present':
        err = True
        results = {'msg': 'Please provide password when using present state'}
        module.fail_json(**results)

    g = guest(module)
    instance = g.bootstrap()
    results, err = users(instance, module)
    g.close()

    if err:
        module.fail_json(**results)
    module.exit_json(**results)
def main():

    mutual_exclusive_args = [['name', 'list'], ['list', 'state']]
    required_togheter_args = [['name', 'state']]
    required_one_of_args = [['name', 'list']]

    module = AnsibleModule(argument_spec=dict(
        image=dict(required=True, type='str'),
        automount=dict(required=False, type='bool', default=True),
        network=dict(required=False, type='bool', default=True),
        selinux_relabel=dict(required=False, type='bool', default=False),
        name=dict(required=False, type='list'),
        state=dict(required=False, choices=['present', 'absent']),
        list=dict(required=False, type='str'),
    ),
                           mutually_exclusive=mutual_exclusive_args,
                           required_one_of=required_one_of_args,
                           required_together=required_togheter_args,
                           supports_check_mode=False)

    g = guest(module)
    instance = g.bootstrap()
    results, err = packages(instance, module)
    g.close()

    if err:
        module.fail_json(**results)
    module.exit_json(**results)
def main():

    required_togheter_args = [['name', 'state']]
    module = AnsibleModule(
        argument_spec=dict(
            image=dict(required=True, type='str'),
            automount=dict(required=False, type='bool', default=True),
            network=dict(required=False, type='bool', default=True),
            selinux_relabel=dict(required=False, type='bool', default=False),
            name=dict(required=True, type='str'),
            # TODO vkhitrin: state=absent and no password support
            password=dict(required=True, type='str', no_log=True),
            state=dict(required=True, choices=['present', 'absent']),
            debug=dict(required=False, type='bool', default=False),
            force=dict(required=False, type='bool', default=False)
        ),
        required_together=required_togheter_args,
        supports_check_mode=True
    )

    g = guest(module)
    instance = g.bootstrap()
    results, err = users(instance, module)
    g.close()

    if err:
        module.fail_json(**results)
    module.exit_json(**results)
def main():

    required_togheter_args = [['name', 'state']]
    module = AnsibleModule(
        argument_spec=dict(
            image=dict(required=True, type='str'),
            automount=dict(required=False, type='bool', default=True),
            network=dict(required=False, type='bool', default=True),
            selinux_relabel=dict(required=False, type='bool', default=False),
            name=dict(required=True, type='str'),
            # TODO vkhitrin: state=absent and no password support
            password=dict(required=True, type='str', no_log=True),
            state=dict(required=True, choices=['present', 'absent']),
            debug=dict(required=False, type='bool', default=False),
            force=dict(required=False, type='bool', default=False)
        ),
        required_together=required_togheter_args,
        supports_check_mode=True
    )

    g = guest(module)
    instance = g.bootstrap()
    results, err = users(instance, module)
    g.close()

    if err:
        module.fail_json(**results)
    module.exit_json(**results)
예제 #5
0
def main():

    mutual_exclusive_args = [['command', 'shell']]
    required_one_of_args = [['command', 'shell']]
    module = AnsibleModule(
        argument_spec=dict(
            image=dict(required=True, type='str'),
            automount=dict(required=False, type='bool', default=True),
            network=dict(required=False, type='bool', default=True),
            selinux_relabel=dict(required=False, type='bool', default=False),
            command=dict(required=False, type='list'),
            shell=dict(required=False, type='list'),
            debug=dict(required=False, type='bool', default=False),
        ),
        mutually_exclusive=mutual_exclusive_args,
        required_one_of=required_one_of_args,
        supports_check_mode=False
    )

    g = guest(module)
    instance = g.bootstrap()
    results, err = execute(instance, module)
    g.close()

    if err:
        module.fail_json(**results)
    module.exit_json(**results)
def main():

    mutual_exclusive_args = [['command', 'shell']]
    required_one_of_args = [['command', 'shell']]
    module = AnsibleModule(
        argument_spec=dict(
            image=dict(required=True, type='str'),
            automount=dict(required=False, type='bool', default=True),
            network=dict(required=False, type='bool', default=True),
            selinux_relabel=dict(required=False, type='bool', default=False),
            command=dict(required=False, type='list'),
            shell=dict(required=False, type='list'),
            debug=dict(required=False, type='bool', default=False),
            force=dict(required=False, type='bool', default=False)
        ),
        mutually_exclusive=mutual_exclusive_args,
        required_one_of=required_one_of_args,
        supports_check_mode=True
    )

    g = guest(module)
    instance = g.bootstrap()
    results, err = execute(instance, module)
    g.close()

    if err:
        module.fail_json(**results)
    module.exit_json(**results)
def main():

    mutual_exclusive_args = [
            ['name', 'list'],
            ['list', 'state']
    ]
    required_togheter_args = [['name', 'state']]
    required_one_of_args = [['name', 'list']]

    module = AnsibleModule(
        argument_spec=dict(
            image=dict(required=True, type='str'),
            automount=dict(required=False, type='bool', default=True),
            network=dict(required=False, type='bool', default=True),
            selinux_relabel=dict(required=False, type='bool', default=False),
            name=dict(required=False, type='list'),
            state=dict(required=False, choices=['present', 'absent']),
            list=dict(required=False, type='str'),
            debug=dict(required=False, type='bool', default=False)
        ),
        mutually_exclusive=mutual_exclusive_args,
        required_one_of=required_one_of_args,
        required_together=required_togheter_args,
        supports_check_mode=True
    )

    g = guest(module)
    instance = g.bootstrap()
    results, err = packages(instance, module)
    g.close()

    if err:
        module.fail_json(**results)
    module.exit_json(**results)
예제 #8
0
def main():

    module = AnsibleModule(argument_spec=dict(
        image=dict(required=True, type='str'),
        src=dict(required=True, type='path'),
        dest=dict(required=True, type='path'),
        recursive=dict(required=False, type='bool', default=False),
        automount=dict(required=False, type='bool', default=True),
        network=dict(required=False, type='bool', default=True),
        selinux_relabel=dict(required=False, type='bool', default=False),
    ),
                           supports_check_mode=False)

    g = guest(module)
    instance = g.bootstrap()
    results, err = download(instance, module)
    g.close()

    if err:
        module.fail_json(**results)
    module.exit_json(**results)
def main():

    module = AnsibleModule(
        argument_spec=dict(
            image=dict(required=True, type='str'),
            src=dict(required=True, type='path'),
            dest=dict(required=True, type='path'),
            remote_src=dict(required=False, type='bool', default=False),
            recursive=dict(required=False, type='bool', default=False),
            automount=dict(required=False, type='bool', default=True),
            network=dict(required=False, type='bool', default=True),
            selinux_relabel=dict(required=False, type='bool', default=False),
        ),
        supports_check_mode=True
    )

    g = guest(module)
    instance = g.bootstrap()
    results, err = upload(instance, module)
    g.close()

    if err:
        module.fail_json(**results)
    module.exit_json(**results)