mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-28 07:31:23 -07:00
ovirt: PEP8 compliancy fixes (#32316)
* ovirt: PEP8 compliancy fixes This PR includes: - PEP8 compliancy fixes Signed-off-by: Satyajit Bulage <sbulage@redhat.com> * Improve documentation * Update documentation * Update documentation * Update documentation * Fix legacy-files.txt * Update documentation * Fix PEP8 issue * Fix PEP8 issue * Fix another PEP8 issue * More typo fixes * Yet another PEP8 typo
This commit is contained in:
parent
a2d34e914e
commit
1857d11034
6 changed files with 669 additions and 772 deletions
|
@ -1,85 +1,67 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2016 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# Copyright: (c) 2017, Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: ovirt_affinity_group
|
||||
short_description: Module to manage affinity groups in oVirt/RHV
|
||||
version_added: "2.3"
|
||||
author: "Ondra Machacek (@machacekondra)"
|
||||
author:
|
||||
- Ondra Machacek (@machacekondra)
|
||||
description:
|
||||
- "This module manage affinity groups in oVirt/RHV. It can also manage assignments
|
||||
of those groups to VMs."
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
- "Name of the affinity group to manage."
|
||||
- Name of the affinity group to manage.
|
||||
required: true
|
||||
state:
|
||||
description:
|
||||
- "Should the affinity group be present or absent."
|
||||
choices: ['present', 'absent']
|
||||
- Should the affinity group be present or absent.
|
||||
choices: [ absent, present ]
|
||||
default: present
|
||||
cluster:
|
||||
description:
|
||||
- "Name of the cluster of the affinity group."
|
||||
- Name of the cluster of the affinity group.
|
||||
description:
|
||||
description:
|
||||
- "Description of the affinity group."
|
||||
- Description of the affinity group.
|
||||
host_enforcing:
|
||||
description:
|
||||
- "If I(true) VM cannot start on host if it does not satisfy the C(host_rule)."
|
||||
- "C(This parameter is support since oVirt/RHV 4.1 version.)"
|
||||
- If I(yes) VM cannot start on host if it does not satisfy the C(host_rule).
|
||||
- This parameter is support since oVirt/RHV 4.1 version.
|
||||
type: bool
|
||||
host_rule:
|
||||
description:
|
||||
- "If I(positive) I(all) VMs in this group should run on the this host."
|
||||
- "If I(negative) I(no) VMs in this group should run on the this host."
|
||||
- "C(This parameter is support since oVirt/RHV 4.1 version.)"
|
||||
choices:
|
||||
- positive
|
||||
- negative
|
||||
- If I(positive) I(all) VMs in this group should run on the this host.
|
||||
- If I(negative) I(no) VMs in this group should run on the this host.
|
||||
- This parameter is support since oVirt/RHV 4.1 version.
|
||||
choices: [ negative, positive ]
|
||||
vm_enforcing:
|
||||
description:
|
||||
- "If I(true) VM cannot start if it does not satisfy the C(vm_rule)."
|
||||
- If I(yes) VM cannot start if it does not satisfy the C(vm_rule).
|
||||
type: bool
|
||||
vm_rule:
|
||||
description:
|
||||
- "If I(positive) I(all) VMs in this group should run on the host defined by C(host_rule)."
|
||||
- "If I(negative) I(no) VMs in this group should run on the host defined by C(host_rule)."
|
||||
- "If I(disabled) this affinity group doesn't take effect."
|
||||
choices:
|
||||
- positive
|
||||
- negative
|
||||
- disabled
|
||||
- If I(positive) I(all) VMs in this group should run on the host defined by C(host_rule).
|
||||
- If I(negative) I(no) VMs in this group should run on the host defined by C(host_rule).
|
||||
- If I(disabled) this affinity group doesn't take effect.
|
||||
choices: [ disabled, negative, positive ]
|
||||
vms:
|
||||
description:
|
||||
- "List of the VMs names, which should have assigned this affinity group."
|
||||
- List of the VMs names, which should have assigned this affinity group.
|
||||
hosts:
|
||||
description:
|
||||
- "List of the hosts names, which should have assigned this affinity group."
|
||||
- "C(This parameter is support since oVirt/RHV 4.1 version.)"
|
||||
- List of the hosts names, which should have assigned this affinity group.
|
||||
- This parameter is support since oVirt/RHV 4.1 version.
|
||||
extends_documentation_fragment: ovirt
|
||||
'''
|
||||
|
||||
|
@ -87,8 +69,8 @@ EXAMPLES = '''
|
|||
# Examples don't contain auth parameter for simplicity,
|
||||
# look at ovirt_auth module to see how to reuse authentication:
|
||||
|
||||
# Create(if not exists) and assign affinity group to VMs vm1 and vm2 and host host1
|
||||
- ovirt_affinity_group:
|
||||
- name: Create(if not exists) and assign affinity group to VMs vm1 and vm2 and host host1
|
||||
ovirt_affinity_group:
|
||||
name: mygroup
|
||||
cluster: mycluster
|
||||
vm_enforcing: true
|
||||
|
@ -101,8 +83,8 @@ EXAMPLES = '''
|
|||
hosts:
|
||||
- host1
|
||||
|
||||
# Detach VMs from affinity group and disable VM rule:
|
||||
- ovirt_affinity_group:
|
||||
- name: Detach VMs from affinity group and disable VM rule
|
||||
ovirt_affinity_group:
|
||||
name: mygroup
|
||||
cluster: mycluster
|
||||
vm_enforcing: false
|
||||
|
@ -114,8 +96,8 @@ EXAMPLES = '''
|
|||
- host1
|
||||
- host2
|
||||
|
||||
# Remove affinity group
|
||||
- ovirt_affinity_group:
|
||||
- name: Remove affinity group
|
||||
ovirt_affinity_group:
|
||||
state: absent
|
||||
cluster: mycluster
|
||||
name: mygroup
|
||||
|
@ -245,13 +227,10 @@ class AffinityGroupsModule(BaseModule):
|
|||
def update_check(self, entity):
|
||||
assigned_vms = self.assigned_vms(entity)
|
||||
do_update = (
|
||||
equal(self.param('description'), entity.description)
|
||||
and equal(self.param('vm_enforcing'), entity.enforcing)
|
||||
and equal(
|
||||
equal(self.param('description'), entity.description) and equal(self.param('vm_enforcing'), entity.enforcing) and equal(
|
||||
self.param('vm_rule') == 'positive' if self.param('vm_rule') else None,
|
||||
entity.positive
|
||||
)
|
||||
and equal(self._vm_ids, assigned_vms)
|
||||
) and equal(self._vm_ids, assigned_vms)
|
||||
)
|
||||
# Following attributes is supported since 4.1,
|
||||
# so return if it doesn't exist:
|
||||
|
@ -262,32 +241,24 @@ class AffinityGroupsModule(BaseModule):
|
|||
return do_update and (
|
||||
equal(
|
||||
self.param('host_rule') == 'positive' if self.param('host_rule') else None,
|
||||
entity.hosts_rule.positive
|
||||
)
|
||||
and equal(self.param('host_enforcing'), entity.hosts_rule.enforcing)
|
||||
and equal(
|
||||
entity.hosts_rule.positive) and equal(self.param('host_enforcing'), entity.hosts_rule.enforcing) and equal(
|
||||
self.param('vm_rule') in ['negative', 'positive'] if self.param('vm_rule') else None,
|
||||
entity.vms_rule.enabled
|
||||
)
|
||||
and equal(self._host_ids, sorted([host.id for host in entity.hosts]))
|
||||
entity.vms_rule.enabled) and equal(self._host_ids, sorted([host.id for host in entity.hosts]))
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
argument_spec = ovirt_full_argument_spec(
|
||||
state=dict(
|
||||
choices=['present', 'absent'],
|
||||
default='present',
|
||||
),
|
||||
cluster=dict(default=None, required=True),
|
||||
name=dict(default=None, required=True),
|
||||
description=dict(default=None),
|
||||
vm_enforcing=dict(default=None, type='bool'),
|
||||
vm_rule=dict(default=None, choices=['positive', 'negative', 'disabled']),
|
||||
host_enforcing=dict(default=None, type='bool'),
|
||||
host_rule=dict(default=None, choices=['positive', 'negative']),
|
||||
vms=dict(default=None, type='list'),
|
||||
hosts=dict(default=None, type='list'),
|
||||
state=dict(type='str', default='present', choices=['absent', 'present']),
|
||||
cluster=dict(type='str', required=True),
|
||||
name=dict(type='str', required=True),
|
||||
description=dict(type='str'),
|
||||
vm_enforcing=dict(type='bool'),
|
||||
vm_rule=dict(type='str', choices=['disabled', 'negative', 'positive']),
|
||||
host_enforcing=dict(type='bool'),
|
||||
host_rule=dict(type='str', choices=['negative', 'positive']),
|
||||
vms=dict(type='list'),
|
||||
hosts=dict(type='list'),
|
||||
)
|
||||
module = AnsibleModule(
|
||||
argument_spec=argument_spec,
|
||||
|
|
|
@ -1,71 +1,56 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2016 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# Copyright: (c) 2017, Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: ovirt_nics
|
||||
short_description: Module to manage network interfaces of Virtual Machines in oVirt/RHV
|
||||
version_added: "2.3"
|
||||
author: "Ondra Machacek (@machacekondra)"
|
||||
author:
|
||||
- Ondra Machacek (@machacekondra)
|
||||
description:
|
||||
- "Module to manage network interfaces of Virtual Machines in oVirt/RHV."
|
||||
- Module to manage network interfaces of Virtual Machines in oVirt/RHV.
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
- "Name of the network interface to manage."
|
||||
- Name of the network interface to manage.
|
||||
required: true
|
||||
vm:
|
||||
description:
|
||||
- "Name of the Virtual Machine to manage."
|
||||
- "You must provide either C(vm) parameter or C(template) parameter."
|
||||
- Name of the Virtual Machine to manage.
|
||||
- You must provide either C(vm) parameter or C(template) parameter.
|
||||
template:
|
||||
description:
|
||||
- "Name of the template to manage."
|
||||
- "You must provide either C(vm) parameter or C(template) parameter."
|
||||
- Name of the template to manage.
|
||||
- You must provide either C(vm) parameter or C(template) parameter.
|
||||
version_added: "2.4"
|
||||
state:
|
||||
description:
|
||||
- "Should the Virtual Machine NIC be present/absent/plugged/unplugged."
|
||||
choices: ['present', 'absent', 'plugged', 'unplugged']
|
||||
- Should the Virtual Machine NIC be present/absent/plugged/unplugged.
|
||||
choices: [ absent, plugged, present, unplugged ]
|
||||
default: present
|
||||
network:
|
||||
description:
|
||||
- "Logical network to which the VM network interface should use,
|
||||
by default Empty network is used if network is not specified."
|
||||
- Logical network to which the VM network interface should use,
|
||||
by default Empty network is used if network is not specified.
|
||||
profile:
|
||||
description:
|
||||
- "Virtual network interface profile to be attached to VM network interface."
|
||||
- Virtual network interface profile to be attached to VM network interface.
|
||||
interface:
|
||||
description:
|
||||
- "Type of the network interface."
|
||||
choices: ['virtio', 'e1000', 'rtl8139', 'pci_passthrough', 'rtl8139_virtio', 'spapr_vlan']
|
||||
default: 'virtio'
|
||||
- Type of the network interface.
|
||||
choices: [ e1000, pci_passthrough, rtl8139, rtl8139_virtio, spapr_vlan, virtio ]
|
||||
default: virtio
|
||||
mac_address:
|
||||
description:
|
||||
- "Custom MAC address of the network interface, by default it's obtained from MAC pool."
|
||||
- Custom MAC address of the network interface, by default it's obtained from MAC pool.
|
||||
extends_documentation_fragment: ovirt
|
||||
'''
|
||||
|
||||
|
@ -73,8 +58,8 @@ EXAMPLES = '''
|
|||
# Examples don't contain auth parameter for simplicity,
|
||||
# look at ovirt_auth module to see how to reuse authentication:
|
||||
|
||||
# Add NIC to VM
|
||||
- ovirt_nics:
|
||||
- name: Add NIC to VM
|
||||
ovirt_nics:
|
||||
state: present
|
||||
vm: myvm
|
||||
name: mynic
|
||||
|
@ -83,21 +68,20 @@ EXAMPLES = '''
|
|||
profile: ovirtmgmt
|
||||
network: ovirtmgmt
|
||||
|
||||
# Plug NIC to VM
|
||||
- ovirt_nics:
|
||||
- name: Plug NIC to VM
|
||||
ovirt_nics:
|
||||
state: plugged
|
||||
vm: myvm
|
||||
name: mynic
|
||||
|
||||
# Unplug NIC from VM
|
||||
- ovirt_nics:
|
||||
- name: Unplug NIC from VM
|
||||
ovirt_nics:
|
||||
state: unplugged
|
||||
vm: myvm
|
||||
name: mynic
|
||||
|
||||
|
||||
# add NIC to template
|
||||
- ovirt_nics:
|
||||
- name: Add NIC to template
|
||||
ovirt_nics:
|
||||
auth: "{{ ovirt_auth }}"
|
||||
state: present
|
||||
template: my_template
|
||||
|
@ -106,13 +90,11 @@ EXAMPLES = '''
|
|||
profile: ovirtmgmt
|
||||
network: ovirtmgmt
|
||||
|
||||
|
||||
# Remove NIC from VM
|
||||
- ovirt_nics:
|
||||
- name: Remove NIC from VM
|
||||
ovirt_nics:
|
||||
state: absent
|
||||
vm: myvm
|
||||
name: mynic
|
||||
|
||||
'''
|
||||
|
||||
RETURN = '''
|
||||
|
@ -191,22 +173,19 @@ class EntityNicsModule(BaseModule):
|
|||
|
||||
def main():
|
||||
argument_spec = ovirt_full_argument_spec(
|
||||
state=dict(
|
||||
choices=['present', 'absent', 'plugged', 'unplugged'],
|
||||
default='present'
|
||||
),
|
||||
vm=dict(required=False),
|
||||
template=dict(required=False),
|
||||
name=dict(required=True),
|
||||
interface=dict(default=None),
|
||||
profile=dict(default=None),
|
||||
network=dict(default=None),
|
||||
mac_address=dict(default=None),
|
||||
state=dict(type='str', default='present', choices=['absent', 'plugged', 'present', 'unplugged']),
|
||||
vm=dict(type='str'),
|
||||
template=dict(type='str'),
|
||||
name=dict(type='str', required=True),
|
||||
interface=dict(type='str'),
|
||||
profile=dict(type='str'),
|
||||
network=dict(type='str'),
|
||||
mac_address=dict(type='str'),
|
||||
)
|
||||
module = AnsibleModule(
|
||||
argument_spec=argument_spec,
|
||||
supports_check_mode=True,
|
||||
required_one_of=[['vm', 'template']]
|
||||
required_one_of=[['vm', 'template']],
|
||||
)
|
||||
check_sdk(module)
|
||||
|
||||
|
@ -249,7 +228,7 @@ def main():
|
|||
networks_service = dcs_service.service(dc.id).networks_service()
|
||||
network = next(
|
||||
(n for n in networks_service.list()
|
||||
if n.name == module.params['network']),
|
||||
if n.name == module.params['network']),
|
||||
None
|
||||
)
|
||||
if network is None:
|
||||
|
|
|
@ -1,92 +1,75 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2016 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# Copyright: (c) 2017, Ansible Project
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: ovirt_permissions
|
||||
short_description: "Module to manage permissions of users/groups in oVirt/RHV"
|
||||
short_description: Module to manage permissions of users/groups in oVirt/RHV
|
||||
version_added: "2.3"
|
||||
author: "Ondra Machacek (@machacekondra)"
|
||||
author:
|
||||
- Ondra Machacek (@machacekondra)
|
||||
description:
|
||||
- "Module to manage permissions of users/groups in oVirt/RHV"
|
||||
- Module to manage permissions of users/groups in oVirt/RHV.
|
||||
options:
|
||||
role:
|
||||
description:
|
||||
- "Name of the role to be assigned to user/group on specific object."
|
||||
- Name of the role to be assigned to user/group on specific object.
|
||||
default: UserRole
|
||||
state:
|
||||
description:
|
||||
- "Should the permission be present/absent."
|
||||
choices: ['present', 'absent']
|
||||
- Should the permission be present/absent.
|
||||
choices: [ absent, present ]
|
||||
default: present
|
||||
object_id:
|
||||
description:
|
||||
- "ID of the object where the permissions should be managed."
|
||||
- ID of the object where the permissions should be managed.
|
||||
object_name:
|
||||
description:
|
||||
- "Name of the object where the permissions should be managed."
|
||||
- Name of the object where the permissions should be managed.
|
||||
object_type:
|
||||
description:
|
||||
- "The object where the permissions should be managed."
|
||||
default: 'vm'
|
||||
choices: [
|
||||
'data_center',
|
||||
'cluster',
|
||||
'host',
|
||||
'storage_domain',
|
||||
'network',
|
||||
'disk',
|
||||
'vm',
|
||||
'vm_pool',
|
||||
'template',
|
||||
'cpu_profile',
|
||||
'disk_profile',
|
||||
'vnic_profile',
|
||||
'system',
|
||||
]
|
||||
- The object where the permissions should be managed.
|
||||
choices:
|
||||
- cluster
|
||||
- cpu_profile
|
||||
- data_center
|
||||
- disk
|
||||
- disk_profile
|
||||
- host
|
||||
- network
|
||||
- storage_domain
|
||||
- system
|
||||
- template
|
||||
- vm
|
||||
- vm_pool
|
||||
- vnic_profile
|
||||
default: vm
|
||||
user_name:
|
||||
description:
|
||||
- "Username of the user to manage. In most LDAPs it's I(uid) of the user,
|
||||
but in Active Directory you must specify I(UPN) of the user."
|
||||
- "Note that if user don't exist in the system this module will fail,
|
||||
you should ensure the user exists by using M(ovirt_users) module."
|
||||
- Username of the user to manage. In most LDAPs it's I(uid) of the user,
|
||||
but in Active Directory you must specify I(UPN) of the user.
|
||||
- Note that if user does not exist in the system this module will fail,
|
||||
you should ensure the user exists by using M(ovirt_users) module.
|
||||
group_name:
|
||||
description:
|
||||
- "Name of the group to manage."
|
||||
- "Note that if group don't exist in the system this module will fail,
|
||||
you should ensure the group exists by using M(ovirt_groups) module."
|
||||
- Name of the group to manage.
|
||||
- Note that if group does not exist in the system this module will fail,
|
||||
you should ensure the group exists by using M(ovirt_groups) module.
|
||||
authz_name:
|
||||
description:
|
||||
- "Authorization provider of the user/group. In previous versions of oVirt/RHV known as domain."
|
||||
- Authorization provider of the user/group.
|
||||
required: true
|
||||
aliases: ['domain']
|
||||
aliases: [ domain ]
|
||||
namespace:
|
||||
description:
|
||||
- "Namespace of the authorization provider, where user/group resides."
|
||||
required: false
|
||||
- Namespace of the authorization provider, where user/group resides.
|
||||
extends_documentation_fragment: ovirt
|
||||
'''
|
||||
|
||||
|
@ -94,16 +77,16 @@ EXAMPLES = '''
|
|||
# Examples don't contain auth parameter for simplicity,
|
||||
# look at ovirt_auth module to see how to reuse authentication:
|
||||
|
||||
# Add user user1 from authorization provider example.com-authz
|
||||
- ovirt_permissions:
|
||||
- name: Add user user1 from authorization provider example.com-authz
|
||||
ovirt_permissions:
|
||||
user_name: user1
|
||||
authz_name: example.com-authz
|
||||
object_type: vm
|
||||
object_name: myvm
|
||||
role: UserVmManager
|
||||
|
||||
# Remove permission from user
|
||||
- ovirt_permissions:
|
||||
- name: Remove permission from user
|
||||
ovirt_permissions:
|
||||
state: absent
|
||||
user_name: user1
|
||||
authz_name: example.com-authz
|
||||
|
@ -241,35 +224,30 @@ class PermissionsModule(BaseModule):
|
|||
|
||||
def main():
|
||||
argument_spec = ovirt_full_argument_spec(
|
||||
state=dict(
|
||||
choices=['present', 'absent'],
|
||||
default='present',
|
||||
),
|
||||
role=dict(default='UserRole'),
|
||||
object_type=dict(
|
||||
default='vm',
|
||||
choices=[
|
||||
'data_center',
|
||||
'cluster',
|
||||
'host',
|
||||
'storage_domain',
|
||||
'network',
|
||||
'disk',
|
||||
'vm',
|
||||
'vm_pool',
|
||||
'template',
|
||||
'cpu_profile',
|
||||
'disk_profile',
|
||||
'vnic_profile',
|
||||
'system',
|
||||
]
|
||||
),
|
||||
authz_name=dict(required=True, aliases=['domain']),
|
||||
object_id=dict(default=None),
|
||||
object_name=dict(default=None),
|
||||
user_name=dict(rdefault=None),
|
||||
group_name=dict(default=None),
|
||||
namespace=dict(default=None),
|
||||
state=dict(type='str', default='present', choices=['absent', 'present']),
|
||||
role=dict(type='str', default='UserRole'),
|
||||
object_type=dict(type='str', default='vm',
|
||||
choices=[
|
||||
'cluster',
|
||||
'cpu_profile',
|
||||
'data_center',
|
||||
'disk',
|
||||
'disk_profile',
|
||||
'host',
|
||||
'network',
|
||||
'storage_domain',
|
||||
'system',
|
||||
'template',
|
||||
'vm',
|
||||
'vm_pool',
|
||||
'vnic_profile',
|
||||
]),
|
||||
authz_name=dict(type='str', required=True, aliases=['domain']),
|
||||
object_id=dict(type='str'),
|
||||
object_name=dict(type='str'),
|
||||
user_name=dict(type='str'),
|
||||
group_name=dict(type='str'),
|
||||
namespace=dict(type='str'),
|
||||
)
|
||||
module = AnsibleModule(
|
||||
argument_spec=argument_spec,
|
||||
|
@ -277,10 +255,7 @@ def main():
|
|||
)
|
||||
check_sdk(module)
|
||||
|
||||
if (
|
||||
(module.params['object_name'] is None and module.params['object_id'] is None)
|
||||
and module.params['object_type'] != 'system'
|
||||
):
|
||||
if (module.params['object_name'] is None and module.params['object_id'] is None) and module.params['object_type'] != 'system':
|
||||
module.fail_json(msg='"object_name" or "object_id" is required')
|
||||
|
||||
if module.params['user_name'] is None and module.params['group_name'] is None:
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue