1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-03-31 17:36:21 +00:00

Tidy up validate-modules:no-default-for-required-parameter and other cases (#1423) (#1429)

* Fixed validate-modules:mutually_exclusive-unknown for plugins/modules/packaging/os/redhat_subscription.py

* fixed validation-modules for plugins/modules/cloud/lxd/lxd_container.py

* fixed validation-modules for plugins/modules/web_infrastructure/sophos_utm/utm_network_interface_address.py

* fixed validation-modules for plugins/modules/cloud/opennebula/one_host.py

* fixed validation-modules for plugins/modules/cloud/opennebula/one_image_info.py

* fixed validation-modules for plugins/modules/cloud/opennebula/one_image.py

* fixed validation-modules for plugins/modules/cloud/opennebula/one_service.py

* fixed validation-modules for plugins/modules/cloud/opennebula/one_vm.py

* fixed validation-modules for plugins/modules/net_tools/cloudflare_dns.py

* fixed validation-modules for plugins/modules/net_tools/ip_netns.py

* fixed validation-modules for plugins/modules/net_tools/ipinfoio_facts.py

* fixed validation-modules for plugins/modules/net_tools/netcup_dns.py

* fixed validation-modules for plugins/modules/remote_management/wakeonlan.py

* added types to plugins/modules/remote_management/stacki/stacki_host.py but still cannot remove ignore line

* added a couple of FIXME comments

* fixed validation-modules for plugins/modules/remote_management/manageiq/manageiq_provider.py

* fixed validation-modules for plugins/modules/notification/rocketchat.py

* fixed validation-modules for plugins/modules/monitoring/bigpanda.py

* fixed validation-modules for plugins/modules/identity/keycloak/keycloak_client.py

* fixed validation-modules for plugins/modules/identity/keycloak/keycloak_clienttemplate.py

* fixed validation-modules for plugins/modules/cloud/univention/udm_user.py

* fixed validation-modules for plugins/modules/cloud/univention/udm_group.py

* fixed validation-modules for plugins/modules/cloud/spotinst/spotinst_aws_elastigroup.py

* fixed validation-modules for plugins/modules/cloud/smartos/imgadm.py

* fixed validation-modules for plugins/modules/cloud/profitbricks/profitbricks_nic.py

* fixed validation-modules for plugins/modules/cloud/ovirt/ovirt_external_provider_facts.py

* Tidy up validate-modules ignores no-default-for-required-parameter + couple of other cases

* Added changelog frag

* fixed validation-modules for plugins/modules/cloud/centurylink/clc_alert_policy.py

* fixed validation-modules for plugins/modules/cloud/centurylink/clc_firewall_policy.py

* fixed validation-modules for plugins/modules/cloud/lxd/lxd_profile.py

* Typos and small fixes

* fixed validation-modules for plugins/modules/net_tools/ldap/ldap_passwd.py

* Typos and small fixes, part 2

* Fixes from PR comments

* Update plugins/modules/cloud/profitbricks/profitbricks_nic.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Rolled back the mutually-exclusive-unknown in redhat_subscription

* Update changelogs/fragments/1423-valmod_multiple_cases.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit ae0d3cb090)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
Felix Fontein 2020-12-01 22:13:54 +01:00 committed by GitHub
parent 32ac93fb16
commit 6470d3defe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 411 additions and 279 deletions

View file

@ -217,18 +217,18 @@ class ClcAlertPolicy:
:return: argument spec dictionary
"""
argument_spec = dict(
name=dict(default=None), # @FIXME default=None is redundant - remove all
id=dict(default=None),
alias=dict(required=True, default=None),
alert_recipients=dict(type='list', default=None),
name=dict(),
id=dict(),
alias=dict(required=True),
alert_recipients=dict(type='list'),
metric=dict(
choices=[
'cpu',
'memory',
'disk'],
default=None),
duration=dict(type='str', default=None),
threshold=dict(type='int', default=None),
duration=dict(type='str'),
threshold=dict(type='int'),
state=dict(default='present', choices=['present', 'absent'])
)
mutually_exclusive = [

View file

@ -214,12 +214,12 @@ class ClcFirewallPolicy:
"""
argument_spec = dict(
location=dict(required=True),
source_account_alias=dict(required=True, default=None), # @FIXME remove default=None
destination_account_alias=dict(default=None),
firewall_policy_id=dict(default=None),
ports=dict(default=None, type='list'),
source=dict(default=None, type='list'),
destination=dict(default=None, type='list'),
source_account_alias=dict(required=True),
destination_account_alias=dict(),
firewall_policy_id=dict(),
ports=dict(type='list'),
source=dict(type='list'),
destination=dict(type='list'),
wait=dict(default=True), # @FIXME type=bool
state=dict(default='present', choices=['present', 'absent']),
enabled=dict(default=True, choices=[True, False])

View file

@ -19,11 +19,13 @@ options:
name:
description:
- Name of a container.
type: str
required: true
architecture:
description:
- The architecture for the container (e.g. "x86_64" or "i686").
See U(https://github.com/lxc/lxd/blob/master/doc/rest-api.md#post-1)
type: str
required: false
config:
description:
@ -37,12 +39,18 @@ options:
- The key starts with 'volatile.' are ignored for this comparison.
- Not all config values are supported to apply the existing container.
Maybe you need to delete and recreate a container.
type: dict
required: false
profiles:
description:
- Profile to be used by the container
type: list
devices:
description:
- 'The devices for the container
(e.g. { "rootfs": { "path": "/dev/kvm", "type": "unix-char" }).
See U(https://github.com/lxc/lxd/blob/master/doc/rest-api.md#post-1)'
type: dict
required: false
ephemeral:
description:
@ -61,6 +69,7 @@ options:
- 'See U(https://github.com/lxc/lxd/blob/master/doc/rest-api.md#post-1) for complete API documentation.'
- 'Note that C(protocol) accepts two choices: C(lxd) or C(simplestreams)'
required: false
type: dict
state:
choices:
- started
@ -72,6 +81,7 @@ options:
- Define the state of a container.
required: false
default: started
type: str
target:
description:
- For cluster deployments. Will attempt to create a container on a target node.
@ -88,6 +98,7 @@ options:
starting or restarting.
required: false
default: 30
type: int
wait_for_ipv4_addresses:
description:
- If this is true, the C(lxd_container) waits until IPv4 addresses
@ -108,23 +119,27 @@ options:
- The unix domain socket path or the https URL for the LXD server.
required: false
default: unix:/var/lib/lxd/unix.socket
type: str
snap_url:
description:
- The unix domain socket path when LXD is installed by snap package manager.
required: false
default: unix:/var/snap/lxd/common/lxd/unix.socket
type: str
client_key:
description:
- The client certificate key file path.
- If not specified, it defaults to C(${HOME}/.config/lxc/client.key).
required: false
default: '"{}/.config/lxc/client.key" .format(os.environ["HOME"])'
aliases: [ key_file ]
type: str
client_cert:
description:
- The client certificate file path.
- If not specified, it defaults to C(${HOME}/.config/lxc/client.crt).
required: false
default: '"{}/.config/lxc/client.crt" .format(os.environ["HOME"])'
aliases: [ cert_file ]
type: str
trust_password:
description:
- The client trusted password.
@ -135,6 +150,7 @@ options:
- If trust_password is set, this module send a request for
authentication before sending any requests.
required: false
type: str
notes:
- Containers must have a unique name. If you attempt to create a container
with a name that already existed in the users namespace the module will
@ -356,8 +372,12 @@ class LXDContainerManagement(object):
self.addresses = None
self.target = self.module.params['target']
self.key_file = self.module.params.get('client_key', None)
self.cert_file = self.module.params.get('client_cert', None)
self.key_file = self.module.params.get('client_key')
if self.key_file is None:
self.key_file = '{0}/.config/lxc/client.key'.format(os.environ['HOME'])
self.cert_file = self.module.params.get('client_cert')
if self.cert_file is None:
self.cert_file = '{0}/.config/lxc/client.crt'.format(os.environ['HOME'])
self.debug = self.module._verbosity >= 4
try:
@ -671,12 +691,10 @@ def main():
),
client_key=dict(
type='str',
default='{0}/.config/lxc/client.key'.format(os.environ['HOME']),
aliases=['key_file']
),
client_cert=dict(
type='str',
default='{0}/.config/lxc/client.crt'.format(os.environ['HOME']),
aliases=['cert_file']
),
trust_password=dict(type='str', no_log=True)

View file

@ -20,9 +20,11 @@ options:
description:
- Name of a profile.
required: true
type: str
description:
description:
- Description of the profile.
type: str
config:
description:
- 'The config for the container (e.g. {"limits.memory": "4GB"}).
@ -35,18 +37,21 @@ options:
- Not all config values are supported to apply the existing profile.
Maybe you need to delete and recreate a profile.
required: false
type: dict
devices:
description:
- 'The devices for the profile
(e.g. {"rootfs": {"path": "/dev/kvm", "type": "unix-char"}).
See U(https://github.com/lxc/lxd/blob/master/doc/rest-api.md#patch-3)'
required: false
type: dict
new_name:
description:
- A new name of a profile.
- If this parameter is specified a profile will be renamed to this name.
See U(https://github.com/lxc/lxd/blob/master/doc/rest-api.md#post-11)
required: false
type: str
state:
choices:
- present
@ -55,28 +60,33 @@ options:
- Define the state of a profile.
required: false
default: present
type: str
url:
description:
- The unix domain socket path or the https URL for the LXD server.
required: false
default: unix:/var/lib/lxd/unix.socket
type: str
snap_url:
description:
- The unix domain socket path when LXD is installed by snap package manager.
required: false
default: unix:/var/snap/lxd/common/lxd/unix.socket
type: str
client_key:
description:
- The client certificate key file path.
- If not specified, it defaults to C($HOME/.config/lxc/client.key).
required: false
default: '"{}/.config/lxc/client.key" .format(os.environ["HOME"])'
aliases: [ key_file ]
type: str
client_cert:
description:
- The client certificate file path.
- If not specified, it defaults to C($HOME/.config/lxc/client.crt).
required: false
default: '"{}/.config/lxc/client.crt" .format(os.environ["HOME"])'
aliases: [ cert_file ]
type: str
trust_password:
description:
- The client trusted password.
@ -87,6 +97,7 @@ options:
- If trust_password is set, this module send a request for
authentication before sending any requests.
required: false
type: str
notes:
- Profiles must have a unique name. If you attempt to create a profile
with a name that already existed in the users namespace the module will
@ -201,8 +212,12 @@ class LXDProfileManagement(object):
self.state = self.module.params['state']
self.new_name = self.module.params.get('new_name', None)
self.key_file = self.module.params.get('client_key', None)
self.cert_file = self.module.params.get('client_cert', None)
self.key_file = self.module.params.get('client_key')
if self.key_file is None:
self.key_file = '{0}/.config/lxc/client.key'.format(os.environ['HOME'])
self.cert_file = self.module.params.get('client_cert')
if self.cert_file is None:
self.cert_file = '{0}/.config/lxc/client.crt'.format(os.environ['HOME'])
self.debug = self.module._verbosity >= 4
try:
@ -370,12 +385,10 @@ def main():
),
client_key=dict(
type='str',
default='{0}/.config/lxc/client.key'.format(os.environ['HOME']),
aliases=['key_file']
),
client_cert=dict(
type='str',
default='{0}/.config/lxc/client.crt'.format(os.environ['HOME']),
aliases=['cert_file']
),
trust_password=dict(type='str', no_log=True)

View file

@ -26,6 +26,7 @@ options:
description:
- Hostname of the machine to manage.
required: true
type: str
state:
description:
- Takes the host to the desired lifecycle state.
@ -41,29 +42,36 @@ options:
- disabled
- offline
default: present
type: str
im_mad_name:
description:
- The name of the information manager, this values are taken from the oned.conf with the tag name IM_MAD (name)
default: kvm
type: str
vmm_mad_name:
description:
- The name of the virtual machine manager mad name, this values are taken from the oned.conf with the tag name VM_MAD (name)
default: kvm
type: str
cluster_id:
description:
- The cluster ID.
default: 0
type: int
cluster_name:
description:
- The cluster specified by name.
type: str
labels:
description:
- The labels for this host.
type: list
template:
description:
- The template or attribute changes to merge into the host template.
aliases:
- attributes
type: dict
extends_documentation_fragment:
- community.general.opennebula

View file

@ -39,20 +39,25 @@ options:
- It is recommended to use HTTPS so that the username/password are not
- transferred over the network unencrypted.
- If not set then the value of the C(ONE_URL) environment variable is used.
type: str
api_username:
description:
- Name of the user to login into the OpenNebula RPC server. If not set
- then the value of the C(ONE_USERNAME) environment variable is used.
type: str
api_password:
description:
- Password of the user to login into OpenNebula RPC server. If not set
- then the value of the C(ONE_PASSWORD) environment variable is used.
type: str
id:
description:
- A C(id) of the image you would like to manage.
type: int
name:
description:
- A C(name) of the image you would like to manage.
type: str
state:
description:
- C(present) - state that is used to manage the image
@ -61,6 +66,7 @@ options:
- C(renamed) - rename the image to the C(new_name)
choices: ["present", "absent", "cloned", "renamed"]
default: present
type: str
enabled:
description:
- Whether the image should be enabled or disabled.
@ -69,6 +75,7 @@ options:
description:
- A name that will be assigned to the existing or new image.
- In the case of cloning, by default C(new_name) will take the name of the origin image with the prefix 'Copy of'.
type: str
author:
- "Milan Ilic (@ilicmilan)"
'''

View file

@ -40,18 +40,22 @@ options:
- It is recommended to use HTTPS so that the username/password are not
- transferred over the network unencrypted.
- If not set then the value of the C(ONE_URL) environment variable is used.
type: str
api_username:
description:
- Name of the user to login into the OpenNebula RPC server. If not set
- then the value of the C(ONE_USERNAME) environment variable is used.
type: str
api_password:
description:
- Password of the user to login into OpenNebula RPC server. If not set
- then the value of the C(ONE_PASSWORD) environment variable is used.
type: str
ids:
description:
- A list of images ids whose facts you want to gather.
aliases: ['id']
type: list
name:
description:
- A C(name) of the image whose facts will be gathered.
@ -59,6 +63,7 @@ options:
- which restricts the list of images (whose facts will be returned) whose names match specified regex.
- Also, if the C(name) begins with '~*' case-insensitive matching will be performed.
- See examples for more details.
type: str
author:
- "Milan Ilic (@ilicmilan)"
- "Jan Meerkamp (@meerkampdvv)"

View file

@ -36,24 +36,31 @@ options:
- URL of the OpenNebula OneFlow API server.
- It is recommended to use HTTPS so that the username/password are not transferred over the network unencrypted.
- If not set then the value of the ONEFLOW_URL environment variable is used.
type: str
api_username:
description:
- Name of the user to login into the OpenNebula OneFlow API server. If not set then the value of the C(ONEFLOW_USERNAME) environment variable is used.
type: str
api_password:
description:
- Password of the user to login into OpenNebula OneFlow API server. If not set then the value of the C(ONEFLOW_PASSWORD) environment variable is used.
type: str
template_name:
description:
- Name of service template to use to create a new instance of a service
type: str
template_id:
description:
- ID of a service template to use to create a new instance of a service
type: int
service_id:
description:
- ID of a service instance that you would like to manage
type: int
service_name:
description:
- Name of a service instance that you would like to manage
type: str
unique:
description:
- Setting C(unique=yes) will make sure that there is only one service instance running with a name set with C(service_name) when
@ -66,15 +73,19 @@ options:
- C(absent) - terminate an instance of a service specified with C(service_id)/C(service_name).
choices: ["present", "absent"]
default: present
type: str
mode:
description:
- Set permission mode of a service instance in octet format, e.g. C(600) to give owner C(use) and C(manage) and nothing to group and others.
type: str
owner_id:
description:
- ID of the user which will be set as the owner of the service
type: int
group_id:
description:
- ID of the group which will be set as the group of the service
type: int
wait:
description:
- Wait for the instance to reach RUNNING state after DEPLOYING or COOLDOWN state after SCALING
@ -84,16 +95,20 @@ options:
description:
- How long before wait gives up, in seconds
default: 300
type: int
custom_attrs:
description:
- Dictionary of key/value custom attributes which will be used when instantiating a new service.
default: {}
type: dict
role:
description:
- Name of the role whose cardinality should be changed
type: str
cardinality:
description:
- Number of VMs for the specified role
type: int
force:
description:
- Force the new cardinality even if it is outside the limits

View file

@ -40,10 +40,12 @@ options:
- It is recommended to use HTTPS so that the username/password are not
- transferred over the network unencrypted.
- If not set then the value of the C(ONE_URL) environment variable is used.
type: str
api_username:
description:
- Name of the user to login into the OpenNebula RPC server. If not set
- then the value of the C(ONE_USERNAME) environment variable is used.
type: str
api_password:
description:
- Password of the user to login into OpenNebula RPC server. If not set
@ -51,20 +53,25 @@ options:
- if both I(api_username) or I(api_password) are not set, then it will try
- authenticate with ONE auth file. Default path is "~/.one/one_auth".
- Set environment variable C(ONE_AUTH) to override this path.
type: str
template_name:
description:
- Name of VM template to use to create a new instace
type: str
template_id:
description:
- ID of a VM template to use to create a new instance
type: int
vm_start_on_hold:
description:
- Set to true to put vm on hold while creating
default: False
type: bool
instance_ids:
description:
- A list of instance ids used for states':' C(absent), C(running), C(rebooted), C(poweredoff)
aliases: ['ids']
type: list
state:
description:
- C(present) - create instances from a template specified with C(template_id)/C(template_name).
@ -74,6 +81,7 @@ options:
- C(absent) - terminate instances
choices: ["present", "absent", "running", "rebooted", "poweredoff"]
default: present
type: str
hard:
description:
- Reboot, power-off or terminate instances C(hard)
@ -92,6 +100,7 @@ options:
description:
- How long before wait gives up, in seconds
default: 300
type: int
attributes:
description:
- A dictionary of key/value attributes to add to new instances, or for
@ -104,61 +113,75 @@ options:
- When used with C(count_attributes) and C(exact_count) the module will
- match the base name without the index part.
default: {}
type: dict
labels:
description:
- A list of labels to associate with new instances, or for setting
- C(state) of instances with these labels.
default: []
type: list
count_attributes:
description:
- A dictionary of key/value attributes that can only be used with
- C(exact_count) to determine how many nodes based on a specific
- attributes criteria should be deployed. This can be expressed in
- multiple ways and is shown in the EXAMPLES section.
type: dict
count_labels:
description:
- A list of labels that can only be used with C(exact_count) to determine
- how many nodes based on a specific labels criteria should be deployed.
- This can be expressed in multiple ways and is shown in the EXAMPLES
- section.
type: list
count:
description:
- Number of instances to launch
default: 1
type: int
exact_count:
description:
- Indicates how many instances that match C(count_attributes) and
- C(count_labels) parameters should be deployed. Instances are either
- created or terminated based on this value.
- NOTE':' Instances with the least IDs will be terminated first.
type: int
mode:
description:
- Set permission mode of the instance in octet format, e.g. C(600) to give owner C(use) and C(manage) and nothing to group and others.
type: str
owner_id:
description:
- ID of the user which will be set as the owner of the instance
type: int
group_id:
description:
- ID of the group which will be set as the group of the instance
type: int
memory:
description:
- The size of the memory for new instances (in MB, GB, ...)
type: str
disk_size:
description:
- The size of the disk created for new instances (in MB, GB, TB,...).
- NOTE':' If The Template hats Multiple Disks the Order of the Sizes is
- matched against the order specified in C(template_id)/C(template_name).
type: list
cpu:
description:
- Percentage of CPU divided by 100 required for the new instance. Half a
- processor is written 0.5.
type: float
vcpu:
description:
- Number of CPUs (cores) new VM will have.
type: int
networks:
description:
- A list of dictionaries with network parameters. See examples for more details.
default: []
type: list
disk_saveas:
description:
- Creates an image from a VM disk.
@ -167,6 +190,7 @@ options:
- I(NOTE)':' This operation will only be performed on the first VM (if more than one VM ID is passed)
- and the VM has to be in the C(poweredoff) state.
- Also this operation will fail if an image with specified C(name) already exists.
type: dict
persistent:
description:
- Create a private persistent copy of the template plus any image defined in DISK, and instantiate that copy.
@ -177,10 +201,12 @@ options:
description:
- Name of Datastore to use to create a new instace
version_added: '0.2.0'
type: int
datastore_name:
description:
- Name of Datastore to use to create a new instace
version_added: '0.2.0'
type: str
author:
- "Milan Ilic (@ilicmilan)"
- "Jan Meerkamp (@meerkampdvv)"

View file

@ -43,9 +43,11 @@ options:
- "Type of the external provider."
choices: ['os_image', 'os_network', 'os_volume', 'foreman']
required: true
type: str
name:
description:
- "Name of the external provider, can be used as glob expression."
type: str
extends_documentation_fragment:
- community.general.ovirt_facts
@ -110,11 +112,8 @@ def main():
argument_spec = ovirt_info_full_argument_spec(
name=dict(default=None, required=False),
type=dict(
default=None,
required=True,
choices=[
'os_image', 'os_network', 'os_volume', 'foreman',
],
choices=['os_image', 'os_network', 'os_volume', 'foreman'],
aliases=['provider'],
),
)

View file

@ -17,13 +17,16 @@ options:
description:
- The datacenter in which to operate.
type: str
required: true
server:
description:
- The server name or ID.
type: str
required: true
name:
description:
- The name or ID of the NIC. This is only required on deletes, but not on create.
- If not specified, it defaults to a value based on UUID4.
type: str
lan:
description:
@ -33,12 +36,12 @@ options:
description:
- The ProfitBricks username. Overrides the PB_SUBSCRIPTION_ID environment variable.
type: str
required: false
required: true
subscription_password:
description:
- THe ProfitBricks password. Overrides the PB_PASSWORD environment variable.
type: str
required: false
required: true
wait:
description:
- wait for the operation to complete before returning
@ -97,6 +100,10 @@ uuid_match = re.compile(
r'[\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12}', re.I)
def _make_default_name():
return str(uuid.uuid4()).replace('-', '')[:10]
def _wait_for_completion(profitbricks, promise, wait_timeout, msg):
if not promise:
return
@ -134,6 +141,8 @@ def create_nic(module, profitbricks):
server = module.params.get('server')
lan = module.params.get('lan')
name = module.params.get('name')
if name is None:
name = _make_default_name()
wait = module.params.get('wait')
wait_timeout = module.params.get('wait_timeout')
@ -184,6 +193,8 @@ def delete_nic(module, profitbricks):
datacenter = module.params.get('datacenter')
server = module.params.get('server')
name = module.params.get('name')
if name is None:
name = _make_default_name()
# Locate UUID for Datacenter
if not (uuid_match.match(datacenter)):
@ -230,30 +241,25 @@ def delete_nic(module, profitbricks):
def main():
module = AnsibleModule(
argument_spec=dict(
datacenter=dict(),
server=dict(),
name=dict(default=str(uuid.uuid4()).replace('-', '')[:10]), # @FIXME please do not do that
datacenter=dict(required=True),
server=dict(required=True),
name=dict(),
lan=dict(),
subscription_user=dict(),
subscription_password=dict(no_log=True),
subscription_user=dict(required=True),
subscription_password=dict(required=True, no_log=True),
wait=dict(type='bool', default=True),
wait_timeout=dict(type='int', default=600),
state=dict(default='present'),
),
required_if=(
('state', 'absent', ['name']),
('state', 'present', ['lan']),
)
)
if not HAS_PB_SDK:
module.fail_json(msg='profitbricks required for this module')
if not module.params.get('subscription_user'): # @ FIXME use required in argument_spec, same for lines below
module.fail_json(msg='subscription_user parameter is required')
if not module.params.get('subscription_password'):
module.fail_json(msg='subscription_password parameter is required')
if not module.params.get('datacenter'):
module.fail_json(msg='datacenter parameter is required')
if not module.params.get('server'):
module.fail_json(msg='server parameter is required')
subscription_user = module.params.get('subscription_user')
subscription_password = module.params.get('subscription_password')
@ -264,9 +270,6 @@ def main():
state = module.params.get('state')
if state == 'absent':
if not module.params.get('name'):
module.fail_json(msg='name parameter is required')
try:
(changed) = delete_nic(module, profitbricks)
module.exit_json(changed=changed)
@ -274,9 +277,6 @@ def main():
module.fail_json(msg='failed to set nic state: %s' % str(e))
elif state == 'present':
if not module.params.get('lan'):
module.fail_json(msg='lan parameter is required')
try:
(nic_dict) = create_nic(module, profitbricks)
module.exit_json(nics=nic_dict) # @FIXME changed not calculated?

View file

@ -26,10 +26,12 @@ options:
default: zones
description:
- zpool to import to or delete images from.
type: str
source:
required: false
description:
- URI for the image source.
type: str
state:
required: true
choices: [ present, absent, deleted, imported, updated, vacuumed ]
@ -37,16 +39,22 @@ options:
- State the object operated on should be in. C(imported) is an alias for
for C(present) and C(deleted) for C(absent). When set to C(vacuumed)
and C(uuid) to C(*), it will remove all unused images.
type: str
type:
required: false
choices: [ imgapi, docker, dsapi ]
default: imgapi
description:
- Type for image sources.
type: str
uuid:
required: false
description:
- Image UUID. Can either be a full UUID or C(*) for all images.
type: str
requirements:
- python >= 2.6
'''
@ -260,12 +268,12 @@ class Imgadm(object):
def main():
module = AnsibleModule(
argument_spec=dict(
force=dict(default=None, type='bool'),
force=dict(type='bool'),
pool=dict(default='zones'),
source=dict(default=None),
state=dict(default=None, required=True, choices=['present', 'absent', 'deleted', 'imported', 'updated', 'vacuumed']),
source=dict(),
state=dict(required=True, choices=['present', 'absent', 'deleted', 'imported', 'updated', 'vacuumed']),
type=dict(default='imgapi', choices=['imgapi', 'docker', 'dsapi']),
uuid=dict(default=None)
uuid=dict()
),
# This module relies largely on imgadm(1M) to enforce idempotency, which does not
# provide a "noop" (or equivalent) mode to do a dry-run.

View file

@ -23,19 +23,22 @@ options:
credentials_path:
description:
- (String) Optional parameter that allows to set a non-default credentials path.
Default is ~/.spotinst/credentials
- (Path) Optional parameter that allows to set a non-default credentials path.
default: ~/.spotinst/credentials
type: path
account_id:
description:
- (String) Optional parameter that allows to set an account-id inside the module configuration
By default this is retrieved from the credentials path
type: str
availability_vs_cost:
description:
- (String) The strategy orientation.
- "The choices available are: C(availabilityOriented), C(costOriented), C(balanced)."
required: true
type: str
availability_zones:
description:
@ -46,6 +49,7 @@ options:
subnet_id (String),
placement_group_name (String),
required: true
type: list
block_device_mappings:
description:
@ -63,6 +67,7 @@ options:
snapshot_id(Integer),
volume_type(String),
volume_size(Integer))
type: list
chef:
description:
@ -72,10 +77,12 @@ options:
user (String),
pem_key (String),
chef_version (String)
type: dict
draining_timeout:
description:
- (Integer) Time for instance to be drained from incoming requests and deregistered from ELB before termination.
type: int
ebs_optimized:
description:
@ -90,61 +97,72 @@ options:
keys allowed are -
volume_ids (List of Strings),
device_name (String)
type: list
ecs:
description:
- (Object) The ECS integration configuration.;
Expects the following key -
cluster_name (String)
type: dict
elastic_ips:
description:
- (List of Strings) List of ElasticIps Allocation Ids (Example C(eipalloc-9d4e16f8)) to associate to the group instances
type: list
fallback_to_od:
description:
- (Boolean) In case of no spots available, Elastigroup will launch an On-demand instance instead
type: bool
health_check_grace_period:
description:
- (Integer) The amount of time, in seconds, after the instance has launched to start and check its health.
default: 300
- If not specified, it defaults to C(300).
type: int
health_check_unhealthy_duration_before_replacement:
description:
- (Integer) Minimal mount of time instance should be unhealthy for us to consider it unhealthy.
type: int
health_check_type:
description:
- (String) The service to use for the health check.
- "The choices available are: C(ELB), C(HCS), C(TARGET_GROUP), C(MLB), C(EC2)."
type: str
iam_role_name:
description:
- (String) The instance profile iamRole name
- Only use iam_role_arn, or iam_role_name
type: str
iam_role_arn:
description:
- (String) The instance profile iamRole arn
- Only use iam_role_arn, or iam_role_name
type: str
id:
description:
- (String) The group id if it already exists and you want to update, or delete it.
This will not work unless the uniqueness_by field is set to id.
When this is set, and the uniqueness_by field is set, the group will either be updated or deleted, but not created.
type: str
image_id:
description:
- (String) The image Id used to launch the instance.;
In case of conflict between Instance type and image type, an error will be returned
required: true
type: str
key_pair:
description:
- (String) Specify a Key Pair to attach to the instances
type: str
kubernetes:
description:
@ -152,39 +170,47 @@ options:
Expects the following keys -
api_server (String),
token (String)
type: dict
lifetime_period:
description:
- (String) lifetime period
- (Integer) lifetime period
type: int
load_balancers:
description:
- (List of Strings) List of classic ELB names
type: list
max_size:
description:
- (Integer) The upper limit number of instances that you can scale up to
required: true
type: int
mesosphere:
description:
- (Object) The Mesosphere integration configuration.
Expects the following key -
api_server (String)
type: dict
min_size:
description:
- (Integer) The lower limit number of instances that you can scale down to
required: true
type: int
monitoring:
description:
- (Boolean) Describes whether instance Enhanced Monitoring is enabled
- (String) Describes whether instance Enhanced Monitoring is enabled
type: str
name:
description:
- (String) Unique name for elastigroup to be created, updated or deleted
required: true
type: str
network_interfaces:
description:
@ -202,22 +228,26 @@ options:
subnet_id (String),
associate_ipv6_address (Boolean),
private_ip_addresses (List of Objects, Keys are privateIpAddress (String, required) and primary (Boolean))
type: list
on_demand_count:
description:
- (Integer) Required if risk is not set
- Number of on demand instances to launch. All other instances will be spot instances.;
Either set this parameter or the risk parameter
type: int
on_demand_instance_type:
description:
- (String) On-demand instance type that will be provisioned
type: str
opsworks:
description:
- (Object) The elastigroup OpsWorks integration configration.;
Expects the following key -
layer_id (String)
type: dict
persistence:
description:
@ -226,12 +256,14 @@ options:
should_persist_root_device (Boolean),
should_persist_block_devices (Boolean),
should_persist_private_ip (Boolean)
type: dict
product:
description:
- (String) Operation system type.
- "Available choices are: C(Linux/UNIX), C(SUSE Linux), C(Windows), C(Linux/UNIX (Amazon VPC)), C(SUSE Linux (Amazon VPC))."
required: true
type: str
rancher:
description:
@ -241,6 +273,7 @@ options:
access_key (String),
secret_key (String),
master_host (String)
type: dict
right_scale:
description:
@ -248,10 +281,12 @@ options:
Expects the following keys -
account_id (String),
refresh_token (String)
type: dict
risk:
description:
- (Integer) required if on demand is not set. The percentage of Spot instances to launch (0 - 100).
type: int
roll_config:
description:
@ -261,6 +296,7 @@ options:
batch_size_percentage(Integer, Required),
grace_period - (Integer, Required),
health_check_type(String, Optional)
type: dict
scheduled_tasks:
description:
@ -278,17 +314,20 @@ options:
grace_period (Integer),
task_type (String, required),
is_enabled (Boolean)
type: list
security_group_ids:
description:
- (List of Strings) One or more security group IDs. ;
In case of update it will override the existing Security Group with the new given array
required: true
type: list
shutdown_script:
description:
- (String) The Base64-encoded shutdown script that executes prior to instance termination.
Encode before setting.
type: str
signals:
description:
@ -296,15 +335,18 @@ options:
keys allowed are -
name (String, required),
timeout (Integer)
type: list
spin_up_time:
description:
- (Integer) spin up time, in seconds, for the instance
type: int
spot_instance_types:
description:
- (List of Strings) Spot instance type that will be provisioned.
required: true
type: list
state:
choices:
@ -312,33 +354,41 @@ options:
- absent
description:
- (String) create or delete the elastigroup
default: present
type: str
tags:
description:
- (List of tagKey:tagValue paris) a list of tags to configure in the elastigroup. Please specify list of keys and values (key colon value);
- (List of tagKey:tagValue pairs) a list of tags to configure in the elastigroup. Please specify list of keys and values (key colon value);
type: list
target:
description:
- (Integer) The number of instances to launch
required: true
type: int
target_group_arns:
description:
- (List of Strings) List of target group arns instances should be registered to
type: list
tenancy:
description:
- (String) dedicated vs shared tenancy.
- "The available choices are: C(default), C(dedicated)."
type: str
terminate_at_end_of_billing_hour:
description:
- (Boolean) terminate at the end of billing hour
type: bool
unit:
description:
- (String) The capacity unit to launch instances by.
- "The available choices are: C(instance), C(weight)."
type: str
up_scaling_policies:
description:
@ -362,7 +412,7 @@ options:
target (String),
maximum (String),
minimum (String)
type: list
down_scaling_policies:
description:
@ -386,6 +436,7 @@ options:
target (String),
maximum (String),
minimum (String)
type: list
target_tracking_policies:
description:
@ -400,6 +451,7 @@ options:
unit (String, required),
cooldown (String, required),
target (String, required)
type: list
uniqueness_by:
choices:
@ -408,12 +460,13 @@ options:
description:
- (String) If your group names are not unique, you may use this feature to update or delete a specific group.
Whenever this property is set, you must set a group_id in order to update or delete a group, otherwise a group will be created.
default: name
type: str
user_data:
description:
- (String) Base64-encoded MIME user data. Encode before setting the value.
type: str
utilize_reserved_instances:
description:
@ -430,6 +483,7 @@ options:
description:
- (Integer) How long the module should wait for instances before failing the action.;
Only works if wait_for_instances is True.
type: int
'''
EXAMPLES = '''
@ -877,7 +931,6 @@ multai_fields = ('multai_token',)
def handle_elastigroup(client, module):
has_changed = False
should_create = False
group_id = None
message = 'None'
@ -970,7 +1023,7 @@ def retrieve_group_instances(client, module, group_id):
healthy_instances = client.get_instance_healthiness(group_id=group_id)
for healthy_instance in healthy_instances:
if(healthy_instance.get('healthStatus') == 'HEALTHY'):
if healthy_instance.get('healthStatus') == 'HEALTHY':
amount_of_fulfilled_instances += 1
instances.append(healthy_instance)

View file

@ -27,27 +27,34 @@ options:
choices: [ present, absent ]
description:
- Whether the group is present or not.
type: str
name:
required: true
description:
- Name of the posix group.
type: str
description:
required: false
description:
- Group description.
type: str
position:
required: false
description:
- define the whole ldap position of the group, e.g.
C(cn=g123m-1A,cn=classes,cn=schueler,cn=groups,ou=schule,dc=example,dc=com).
type: str
ou:
required: false
description:
- LDAP OU, e.g. school for LDAP OU C(ou=school,dc=example,dc=com).
type: str
subpath:
required: false
description:
- Subpath inside the OU, e.g. C(cn=classes,cn=students,cn=groups).
type: str
default: "cn=groups"
'''

View file

@ -27,203 +27,250 @@ options:
choices: [ present, absent ]
description:
- Whether the user is present or not.
type: str
username:
required: true
description:
- User name
aliases: ['name']
type: str
firstname:
description:
- First name. Required if C(state=present).
type: str
lastname:
description:
- Last name. Required if C(state=present).
type: str
password:
description:
- Password. Required if C(state=present).
type: str
birthday:
description:
- Birthday
type: str
city:
description:
- City of users business address.
type: str
country:
description:
- Country of users business address.
type: str
department_number:
description:
- Department number of users business address.
aliases: [ departmentNumber ]
type: str
description:
description:
- Description (not gecos)
type: str
display_name:
description:
- Display name (not gecos)
aliases: [ displayName ]
type: str
email:
default: []
default: ['']
description:
- A list of e-mail addresses.
type: list
employee_number:
description:
- Employee number
aliases: [ employeeNumber ]
type: str
employee_type:
description:
- Employee type
aliases: [ employeeType ]
type: str
gecos:
description:
- GECOS
type: str
groups:
default: []
description:
- "POSIX groups, the LDAP DNs of the groups will be found with the
LDAP filter for each group as $GROUP:
C((&(objectClass=posixGroup)(cn=$GROUP)))."
type: list
home_share:
description:
- "Home NFS share. Must be a LDAP DN, e.g.
C(cn=home,cn=shares,ou=school,dc=example,dc=com)."
aliases: [ homeShare ]
type: str
home_share_path:
description:
- Path to home NFS share, inside the homeShare.
aliases: [ homeSharePath ]
type: str
home_telephone_number:
default: []
description:
- List of private telephone numbers.
aliases: [ homeTelephoneNumber ]
type: list
homedrive:
description:
- Windows home drive, e.g. C("H:").
type: str
mail_alternative_address:
default: []
description:
- List of alternative e-mail addresses.
aliases: [ mailAlternativeAddress ]
type: list
mail_home_server:
description:
- FQDN of mail server
aliases: [ mailHomeServer ]
type: str
mail_primary_address:
description:
- Primary e-mail address
aliases: [ mailPrimaryAddress ]
type: str
mobile_telephone_number:
default: []
description:
- Mobile phone number
aliases: [ mobileTelephoneNumber ]
type: list
organisation:
description:
- Organisation
aliases: [ organization ]
override_pw_history:
type: str
overridePWHistory:
type: bool
default: 'no'
description:
- Override password history
aliases: [ overridePWHistory ]
override_pw_length:
aliases: [ override_pw_history ]
overridePWLength:
type: bool
default: 'no'
description:
- Override password check
aliases: [ overridePWLength ]
aliases: [ override_pw_length ]
pager_telephonenumber:
default: []
description:
- List of pager telephone numbers.
aliases: [ pagerTelephonenumber ]
type: list
phone:
description:
- List of telephone numbers.
type: list
postcode:
description:
- Postal code of users business address.
type: str
primary_group:
default: cn=Domain Users,cn=groups,$LDAP_BASE_DN
description:
- Primary group. This must be the group LDAP DN.
- If not specified, it defaults to C(cn=Domain Users,cn=groups,$LDAP_BASE_DN).
aliases: [ primaryGroup ]
type: str
profilepath:
description:
- Windows profile directory
type: str
pwd_change_next_login:
choices: [ '0', '1' ]
description:
- Change password on next login.
aliases: [ pwdChangeNextLogin ]
type: str
room_number:
description:
- Room number of users business address.
aliases: [ roomNumber ]
type: str
samba_privileges:
description:
- "Samba privilege, like allow printer administration, do domain
join."
aliases: [ sambaPrivileges ]
type: list
samba_user_workstations:
description:
- Allow the authentication only on this Microsoft Windows host.
aliases: [ sambaUserWorkstations ]
type: list
sambahome:
description:
- Windows home path, e.g. C('\\$FQDN\$USERNAME').
type: str
scriptpath:
description:
- Windows logon script.
type: str
secretary:
default: []
description:
- A list of superiors as LDAP DNs.
type: list
serviceprovider:
default: []
default: ['']
description:
- Enable user for the following service providers.
type: list
shell:
default: '/bin/bash'
description:
- Login shell
type: str
street:
description:
- Street of users business address.
type: str
title:
description:
- Title, e.g. C(Prof.).
type: str
unixhome:
default: '/home/$USERNAME'
description:
- Unix home directory
- If not specified, it defaults to C(/home/$USERNAME).
type: str
userexpiry:
default: Today + 1 year
description:
- Account expiry date, e.g. C(1999-12-31).
- If not specified, it defaults to the current day plus one year.
type: str
position:
default: ''
description:
- "Define the whole position of users object inside the LDAP tree,
e.g. C(cn=employee,cn=users,ou=school,dc=example,dc=com)."
type: str
update_password:
default: always
choices: [ always, on_create ]
description:
- "C(always) will update passwords if they differ.
C(on_create) will only set the password for newly created users."
type: str
ou:
default: ''
description:
- "Organizational Unit inside the LDAP Base DN, e.g. C(school) for
LDAP OU C(ou=school,dc=example,dc=com)."
type: str
subpath:
default: 'cn=users'
description:
- "LDAP subpath inside the organizational unit, e.g.
C(cn=teachers,cn=users) for LDAP container
C(cn=teachers,cn=users,dc=example,dc=com)."
type: str
'''
@ -273,61 +320,44 @@ def main():
expiry = date.strftime(date.today() + timedelta(days=365), "%Y-%m-%d")
module = AnsibleModule(
argument_spec=dict(
birthday=dict(default=None,
type='str'),
city=dict(default=None,
type='str'),
country=dict(default=None,
type='str'),
department_number=dict(default=None,
type='str',
birthday=dict(type='str'),
city=dict(type='str'),
country=dict(type='str'),
department_number=dict(type='str',
aliases=['departmentNumber']),
description=dict(default=None,
type='str'),
display_name=dict(default=None,
type='str',
description=dict(type='str'),
display_name=dict(type='str',
aliases=['displayName']),
email=dict(default=[''],
type='list'),
employee_number=dict(default=None,
type='str',
employee_number=dict(type='str',
aliases=['employeeNumber']),
employee_type=dict(default=None,
type='str',
employee_type=dict(type='str',
aliases=['employeeType']),
firstname=dict(default=None,
type='str'),
gecos=dict(default=None,
type='str'),
firstname=dict(type='str'),
gecos=dict(type='str'),
groups=dict(default=[],
type='list'),
home_share=dict(default=None,
type='str',
home_share=dict(type='str',
aliases=['homeShare']),
home_share_path=dict(default=None,
type='str',
home_share_path=dict(type='str',
aliases=['homeSharePath']),
home_telephone_number=dict(default=[],
type='list',
aliases=['homeTelephoneNumber']),
homedrive=dict(default=None,
type='str'),
lastname=dict(default=None,
type='str'),
homedrive=dict(type='str'),
lastname=dict(type='str'),
mail_alternative_address=dict(default=[],
type='list',
aliases=['mailAlternativeAddress']),
mail_home_server=dict(default=None,
type='str',
mail_home_server=dict(type='str',
aliases=['mailHomeServer']),
mail_primary_address=dict(default=None,
type='str',
mail_primary_address=dict(type='str',
aliases=['mailPrimaryAddress']),
mobile_telephone_number=dict(default=[],
type='list',
aliases=['mobileTelephoneNumber']),
organisation=dict(default=None,
type='str',
organisation=dict(type='str',
aliases=['organization']),
overridePWHistory=dict(default=False,
type='bool',
@ -338,24 +368,18 @@ def main():
pager_telephonenumber=dict(default=[],
type='list',
aliases=['pagerTelephonenumber']),
password=dict(default=None,
type='str',
password=dict(type='str',
no_log=True),
phone=dict(default=[],
type='list'),
postcode=dict(default=None,
type='str'),
primary_group=dict(default=None,
type='str',
postcode=dict(type='str'),
primary_group=dict(type='str',
aliases=['primaryGroup']),
profilepath=dict(default=None,
type='str'),
pwd_change_next_login=dict(default=None,
type='str',
profilepath=dict(type='str'),
pwd_change_next_login=dict(type='str',
choices=['0', '1'],
aliases=['pwdChangeNextLogin']),
room_number=dict(default=None,
type='str',
room_number=dict(type='str',
aliases=['roomNumber']),
samba_privileges=dict(default=[],
type='list',
@ -363,24 +387,18 @@ def main():
samba_user_workstations=dict(default=[],
type='list',
aliases=['sambaUserWorkstations']),
sambahome=dict(default=None,
type='str'),
scriptpath=dict(default=None,
type='str'),
sambahome=dict(type='str'),
scriptpath=dict(type='str'),
secretary=dict(default=[],
type='list'),
serviceprovider=dict(default=[''],
type='list'),
shell=dict(default='/bin/bash',
type='str'),
street=dict(default=None,
type='str'),
title=dict(default=None,
type='str'),
unixhome=dict(default=None,
type='str'),
userexpiry=dict(default=expiry,
type='str'),
street=dict(type='str'),
title=dict(type='str'),
unixhome=dict(type='str'),
userexpiry=dict(type='str'),
username=dict(required=True,
aliases=['name'],
type='str'),
@ -451,6 +469,8 @@ def main():
obj[k] = module.params[k]
# handle some special values
obj['e-mail'] = module.params['email']
if 'userexpiry' in obj and obj.get('userexpiry') is None:
obj['userexpiry'] = expiry
password = module.params['password']
if obj['password'] is None:
obj['password'] = password