diff --git a/plugins/modules/cloud/profitbricks/profitbricks.py b/plugins/modules/cloud/profitbricks/profitbricks.py index 17b0aeb0f6..90798672c0 100644 --- a/plugins/modules/cloud/profitbricks/profitbricks.py +++ b/plugins/modules/cloud/profitbricks/profitbricks.py @@ -22,52 +22,63 @@ options: name: description: - The name of the virtual machine. - required: true + type: str image: description: - The system image ID for creating the virtual machine, e.g. a3eae284-a2fe-11e4-b187-5f1f641608c8. - required: true + type: str image_password: description: - Password set for the administrative user. + type: str ssh_keys: description: - Public SSH keys allowing access to the virtual machine. + type: list datacenter: description: - The datacenter to provision this virtual machine. + type: str cores: description: - The number of CPU cores to allocate to the virtual machine. default: 2 + type: int ram: description: - The amount of memory to allocate to the virtual machine. default: 2048 + type: int cpu_family: description: - The CPU family type to allocate to the virtual machine. + type: str default: AMD_OPTERON choices: [ "AMD_OPTERON", "INTEL_XEON" ] volume_size: description: - The size in GB of the boot volume. + type: int default: 10 bus: description: - The bus type for the volume. + type: str default: VIRTIO choices: [ "IDE", "VIRTIO"] instance_ids: description: - list of instance ids, currently only used when state='absent' to remove instances. + type: list count: description: - The number of virtual machines to create. + type: int default: 1 location: description: - The datacenter location. Use only if you want to create the Datacenter or else this value is ignored. + type: str default: us/las choices: [ "us/las", "de/fra", "de/fkb" ] assign_public_ip: @@ -78,13 +89,16 @@ options: lan: description: - The ID of the LAN you wish to add the servers to. + type: int default: 1 subscription_user: description: - The ProfitBricks username. Overrides the PB_SUBSCRIPTION_ID environment variable. + type: str subscription_password: description: - THe ProfitBricks password. Overrides the PB_PASSWORD environment variable. + type: str wait: description: - wait for the instance to be in state 'running' before returning @@ -93,6 +107,7 @@ options: wait_timeout: description: - how long before wait gives up, in seconds + type: int default: 600 remove_boot_volume: description: @@ -102,8 +117,15 @@ options: state: description: - create or terminate instances + - 'The choices available are: C(running), C(stopped), C(absent), C(present).' + type: str default: 'present' - choices: [ "running", "stopped", "absent", "present" ] + disk_type: + description: + - the type of disk to be allocated. + type: str + choices: [SSD, HDD] + default: HDD requirements: - "profitbricks" diff --git a/plugins/modules/cloud/profitbricks/profitbricks_datacenter.py b/plugins/modules/cloud/profitbricks/profitbricks_datacenter.py index c40cfd95d9..e3ba1d4950 100644 --- a/plugins/modules/cloud/profitbricks/profitbricks_datacenter.py +++ b/plugins/modules/cloud/profitbricks/profitbricks_datacenter.py @@ -17,24 +17,28 @@ options: name: description: - The name of the virtual datacenter. - required: true + type: str description: description: - The description of the virtual datacenter. + type: str required: false location: description: - The datacenter location. + type: str required: false default: us/las choices: [ "us/las", "de/fra", "de/fkb" ] subscription_user: description: - The ProfitBricks username. Overrides the PB_SUBSCRIPTION_ID environment variable. + type: str required: false subscription_password: description: - THe ProfitBricks password. Overrides the PB_PASSWORD environment variable. + type: str required: false wait: description: @@ -45,13 +49,15 @@ options: wait_timeout: description: - how long before wait gives up, in seconds + type: int default: 600 state: description: - - create or terminate datacenters + - Create or terminate datacenters. + - "The available choices are: C(present), C(absent)." + type: str required: false default: 'present' - choices: [ "present", "absent" ] requirements: [ "profitbricks" ] author: Matt Baldwin (@baldwinSPC) @@ -203,7 +209,7 @@ def main(): subscription_password=dict(no_log=True), wait=dict(type='bool', default=True), wait_timeout=dict(default=600, type='int'), - state=dict(default='present'), + state=dict(default='present'), # @TODO add choices ) ) if not HAS_PB_SDK: diff --git a/plugins/modules/cloud/profitbricks/profitbricks_nic.py b/plugins/modules/cloud/profitbricks/profitbricks_nic.py index 02f70b9549..cccf60cf62 100644 --- a/plugins/modules/cloud/profitbricks/profitbricks_nic.py +++ b/plugins/modules/cloud/profitbricks/profitbricks_nic.py @@ -16,26 +16,28 @@ options: datacenter: description: - The datacenter in which to operate. - required: true + type: str server: description: - The server name or ID. - required: true + type: str name: description: - The name or ID of the NIC. This is only required on deletes, but not on create. - required: true + type: str lan: description: - The LAN to place the NIC on. You can pass a LAN that doesn't exist and it will be created. Required on create. - required: true + type: str subscription_user: description: - The ProfitBricks username. Overrides the PB_SUBSCRIPTION_ID environment variable. + type: str required: false subscription_password: description: - THe ProfitBricks password. Overrides the PB_PASSWORD environment variable. + type: str required: false wait: description: @@ -46,13 +48,15 @@ options: wait_timeout: description: - how long before wait gives up, in seconds + type: int default: 600 state: description: - Indicate desired state of the resource + - "The available choices are: C(present), C(absent)." + type: str required: false default: 'present' - choices: ["present", "absent"] requirements: [ "profitbricks" ] author: Matt Baldwin (@baldwinSPC) @@ -228,7 +232,7 @@ def main(): argument_spec=dict( datacenter=dict(), server=dict(), - name=dict(default=str(uuid.uuid4()).replace('-', '')[:10]), + name=dict(default=str(uuid.uuid4()).replace('-', '')[:10]), # @FIXME please do not do that lan=dict(), subscription_user=dict(), subscription_password=dict(no_log=True), @@ -241,7 +245,7 @@ def main(): if not HAS_PB_SDK: module.fail_json(msg='profitbricks required for this module') - if not module.params.get('subscription_user'): + 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') @@ -275,7 +279,7 @@ def main(): try: (nic_dict) = create_nic(module, profitbricks) - module.exit_json(nics=nic_dict) + module.exit_json(nics=nic_dict) # @FIXME changed not calculated? except Exception as e: module.fail_json(msg='failed to set nic state: %s' % str(e)) diff --git a/plugins/modules/cloud/profitbricks/profitbricks_volume.py b/plugins/modules/cloud/profitbricks/profitbricks_volume.py index 5db0941aba..a63cbcdd3b 100644 --- a/plugins/modules/cloud/profitbricks/profitbricks_volume.py +++ b/plugins/modules/cloud/profitbricks/profitbricks_volume.py @@ -16,49 +16,56 @@ options: datacenter: description: - The datacenter in which to create the volumes. - required: true + type: str name: description: - The name of the volumes. You can enumerate the names using auto_increment. - required: true + type: str size: description: - The size of the volume. + type: int required: false default: 10 bus: description: - The bus type. + type: str required: false default: VIRTIO choices: [ "IDE", "VIRTIO"] image: description: - The system image ID for the volume, e.g. a3eae284-a2fe-11e4-b187-5f1f641608c8. This can also be a snapshot image ID. - required: true + type: str image_password: description: - Password set for the administrative user. + type: str required: false ssh_keys: description: - Public SSH keys allowing access to the virtual machine. + type: list required: false disk_type: description: - The disk type of the volume. + type: str required: false default: HDD choices: [ "HDD", "SSD" ] licence_type: description: - The licence type for the volume. This is used when the image is non-standard. + - "The available choices are: C(LINUX), C(WINDOWS), C(UNKNOWN), C(OTHER)." + type: str required: false default: UNKNOWN - choices: ["LINUX", "WINDOWS", "UNKNOWN" , "OTHER"] count: description: - The number of volumes you wish to create. + type: int required: false default: 1 auto_increment: @@ -69,14 +76,17 @@ options: instance_ids: description: - list of instance ids, currently only used when state='absent' to remove instances. + type: list required: false subscription_user: description: - The ProfitBricks username. Overrides the PB_SUBSCRIPTION_ID environment variable. + type: str required: false subscription_password: description: - THe ProfitBricks password. Overrides the PB_PASSWORD environment variable. + type: str required: false wait: description: @@ -87,13 +97,15 @@ options: wait_timeout: description: - how long before wait gives up, in seconds + type: int default: 600 state: description: - create or terminate datacenters + - "The available choices are: C(present), C(absent)." + type: str required: false default: 'present' - choices: ["present", "absent"] requirements: [ "profitbricks" ] author: Matt Baldwin (@baldwinSPC) diff --git a/plugins/modules/cloud/profitbricks/profitbricks_volume_attachments.py b/plugins/modules/cloud/profitbricks/profitbricks_volume_attachments.py index fea2d802d9..72f03e674a 100644 --- a/plugins/modules/cloud/profitbricks/profitbricks_volume_attachments.py +++ b/plugins/modules/cloud/profitbricks/profitbricks_volume_attachments.py @@ -16,22 +16,24 @@ options: datacenter: description: - The datacenter in which to operate. - required: true + type: str server: description: - The name of the server you wish to detach or attach the volume. - required: true + type: str volume: description: - The volume name or ID. - required: true + type: str subscription_user: description: - The ProfitBricks username. Overrides the PB_SUBSCRIPTION_ID environment variable. + type: str required: false subscription_password: description: - THe ProfitBricks password. Overrides the PB_PASSWORD environment variable. + type: str required: false wait: description: @@ -42,13 +44,15 @@ options: wait_timeout: description: - how long before wait gives up, in seconds + type: int default: 600 state: description: - Indicate desired state of the resource + - "The available choices are: C(present), C(absent)." + type: str required: false default: 'present' - choices: ["present", "absent"] requirements: [ "profitbricks" ] author: Matt Baldwin (@baldwinSPC) diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt index 3bdb7f1959..df094b8ce3 100644 --- a/tests/sanity/ignore-2.10.txt +++ b/tests/sanity/ignore-2.10.txt @@ -163,32 +163,11 @@ plugins/modules/cloud/packet/packet_sshkey.py validate-modules:parameter-type-no plugins/modules/cloud/packet/packet_sshkey.py validate-modules:undocumented-parameter plugins/modules/cloud/packet/packet_volume_attachment.py pylint:ansible-bad-function plugins/modules/cloud/packet/packet_volume_attachment.py validate-modules:doc-required-mismatch -plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:doc-default-does-not-match-spec -plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:doc-missing-type -plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:doc-required-mismatch plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:parameter-list-no-elements -plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:parameter-type-not-in-doc -plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:undocumented-parameter -plugins/modules/cloud/profitbricks/profitbricks_datacenter.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/cloud/profitbricks/profitbricks_datacenter.py validate-modules:doc-missing-type -plugins/modules/cloud/profitbricks/profitbricks_datacenter.py validate-modules:doc-required-mismatch -plugins/modules/cloud/profitbricks/profitbricks_datacenter.py validate-modules:parameter-type-not-in-doc -plugins/modules/cloud/profitbricks/profitbricks_nic.py validate-modules:doc-choices-do-not-match-spec plugins/modules/cloud/profitbricks/profitbricks_nic.py validate-modules:doc-default-does-not-match-spec -plugins/modules/cloud/profitbricks/profitbricks_nic.py validate-modules:doc-missing-type -plugins/modules/cloud/profitbricks/profitbricks_nic.py validate-modules:doc-required-mismatch -plugins/modules/cloud/profitbricks/profitbricks_nic.py validate-modules:parameter-type-not-in-doc -plugins/modules/cloud/profitbricks/profitbricks_volume.py validate-modules:doc-choices-do-not-match-spec plugins/modules/cloud/profitbricks/profitbricks_volume.py validate-modules:doc-missing-type -plugins/modules/cloud/profitbricks/profitbricks_volume.py validate-modules:doc-required-mismatch plugins/modules/cloud/profitbricks/profitbricks_volume.py validate-modules:parameter-list-no-elements -plugins/modules/cloud/profitbricks/profitbricks_volume.py validate-modules:parameter-type-not-in-doc plugins/modules/cloud/profitbricks/profitbricks_volume.py validate-modules:undocumented-parameter -plugins/modules/cloud/profitbricks/profitbricks_volume_attachments.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/cloud/profitbricks/profitbricks_volume_attachments.py validate-modules:doc-missing-type -plugins/modules/cloud/profitbricks/profitbricks_volume_attachments.py validate-modules:doc-required-mismatch -plugins/modules/cloud/profitbricks/profitbricks_volume_attachments.py validate-modules:parameter-type-not-in-doc plugins/modules/cloud/pubnub/pubnub_blocks.py validate-modules:parameter-list-no-elements plugins/modules/cloud/rackspace/rax.py use-argspec-type-path # fix needed plugins/modules/cloud/rackspace/rax.py validate-modules:doc-missing-type diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt index 3bdb7f1959..df094b8ce3 100644 --- a/tests/sanity/ignore-2.11.txt +++ b/tests/sanity/ignore-2.11.txt @@ -163,32 +163,11 @@ plugins/modules/cloud/packet/packet_sshkey.py validate-modules:parameter-type-no plugins/modules/cloud/packet/packet_sshkey.py validate-modules:undocumented-parameter plugins/modules/cloud/packet/packet_volume_attachment.py pylint:ansible-bad-function plugins/modules/cloud/packet/packet_volume_attachment.py validate-modules:doc-required-mismatch -plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:doc-default-does-not-match-spec -plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:doc-missing-type -plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:doc-required-mismatch plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:parameter-list-no-elements -plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:parameter-type-not-in-doc -plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:undocumented-parameter -plugins/modules/cloud/profitbricks/profitbricks_datacenter.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/cloud/profitbricks/profitbricks_datacenter.py validate-modules:doc-missing-type -plugins/modules/cloud/profitbricks/profitbricks_datacenter.py validate-modules:doc-required-mismatch -plugins/modules/cloud/profitbricks/profitbricks_datacenter.py validate-modules:parameter-type-not-in-doc -plugins/modules/cloud/profitbricks/profitbricks_nic.py validate-modules:doc-choices-do-not-match-spec plugins/modules/cloud/profitbricks/profitbricks_nic.py validate-modules:doc-default-does-not-match-spec -plugins/modules/cloud/profitbricks/profitbricks_nic.py validate-modules:doc-missing-type -plugins/modules/cloud/profitbricks/profitbricks_nic.py validate-modules:doc-required-mismatch -plugins/modules/cloud/profitbricks/profitbricks_nic.py validate-modules:parameter-type-not-in-doc -plugins/modules/cloud/profitbricks/profitbricks_volume.py validate-modules:doc-choices-do-not-match-spec plugins/modules/cloud/profitbricks/profitbricks_volume.py validate-modules:doc-missing-type -plugins/modules/cloud/profitbricks/profitbricks_volume.py validate-modules:doc-required-mismatch plugins/modules/cloud/profitbricks/profitbricks_volume.py validate-modules:parameter-list-no-elements -plugins/modules/cloud/profitbricks/profitbricks_volume.py validate-modules:parameter-type-not-in-doc plugins/modules/cloud/profitbricks/profitbricks_volume.py validate-modules:undocumented-parameter -plugins/modules/cloud/profitbricks/profitbricks_volume_attachments.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/cloud/profitbricks/profitbricks_volume_attachments.py validate-modules:doc-missing-type -plugins/modules/cloud/profitbricks/profitbricks_volume_attachments.py validate-modules:doc-required-mismatch -plugins/modules/cloud/profitbricks/profitbricks_volume_attachments.py validate-modules:parameter-type-not-in-doc plugins/modules/cloud/pubnub/pubnub_blocks.py validate-modules:parameter-list-no-elements plugins/modules/cloud/rackspace/rax.py use-argspec-type-path # fix needed plugins/modules/cloud/rackspace/rax.py validate-modules:doc-missing-type diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt index 72ad6eefd1..48a7662645 100644 --- a/tests/sanity/ignore-2.9.txt +++ b/tests/sanity/ignore-2.9.txt @@ -136,25 +136,9 @@ plugins/modules/cloud/packet/packet_device.py validate-modules:parameter-type-no plugins/modules/cloud/packet/packet_sshkey.py validate-modules:doc-missing-type plugins/modules/cloud/packet/packet_sshkey.py validate-modules:parameter-type-not-in-doc plugins/modules/cloud/packet/packet_sshkey.py validate-modules:undocumented-parameter -plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:doc-default-does-not-match-spec -plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:doc-missing-type -plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:parameter-type-not-in-doc -plugins/modules/cloud/profitbricks/profitbricks.py validate-modules:undocumented-parameter -plugins/modules/cloud/profitbricks/profitbricks_datacenter.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/cloud/profitbricks/profitbricks_datacenter.py validate-modules:doc-missing-type -plugins/modules/cloud/profitbricks/profitbricks_datacenter.py validate-modules:parameter-type-not-in-doc -plugins/modules/cloud/profitbricks/profitbricks_nic.py validate-modules:doc-choices-do-not-match-spec plugins/modules/cloud/profitbricks/profitbricks_nic.py validate-modules:doc-default-does-not-match-spec -plugins/modules/cloud/profitbricks/profitbricks_nic.py validate-modules:doc-missing-type -plugins/modules/cloud/profitbricks/profitbricks_nic.py validate-modules:parameter-type-not-in-doc -plugins/modules/cloud/profitbricks/profitbricks_volume.py validate-modules:doc-choices-do-not-match-spec plugins/modules/cloud/profitbricks/profitbricks_volume.py validate-modules:doc-missing-type -plugins/modules/cloud/profitbricks/profitbricks_volume.py validate-modules:parameter-type-not-in-doc plugins/modules/cloud/profitbricks/profitbricks_volume.py validate-modules:undocumented-parameter -plugins/modules/cloud/profitbricks/profitbricks_volume_attachments.py validate-modules:doc-choices-do-not-match-spec -plugins/modules/cloud/profitbricks/profitbricks_volume_attachments.py validate-modules:doc-missing-type -plugins/modules/cloud/profitbricks/profitbricks_volume_attachments.py validate-modules:parameter-type-not-in-doc plugins/modules/cloud/rackspace/rax.py use-argspec-type-path plugins/modules/cloud/rackspace/rax.py validate-modules:doc-missing-type plugins/modules/cloud/rackspace/rax.py validate-modules:undocumented-parameter