Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
Sanity fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
resmo committed Jul 3, 2020
1 parent 8d38384 commit 52c69f5
Show file tree
Hide file tree
Showing 25 changed files with 326 additions and 135 deletions.
2 changes: 2 additions & 0 deletions plugins/doc_fragments/vultr.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# Copyright (c) 2017 René Moser <[email protected]>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type


class ModuleDocFragment(object):
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/vultr_account_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
short_description: Get information about the Vultr account.
description:
- Get infos about account balance, charges and payments.
version_added: "1.0.0"
version_added: "0.1.0"
author: "René Moser (@resmo)"
extends_documentation_fragment:
- ngine_io.vultr.vultr
Expand Down
12 changes: 8 additions & 4 deletions plugins/modules/vultr_block_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,30 @@
description:
- Manage block storage volumes on Vultr.
author: "Yanis Guenane (@Spredzy)"
version_added: "1.0.0"
version_added: "0.1.0"
options:
name:
description:
- Name of the block storage volume.
required: true
aliases: [ description, label ]
type: str
size:
description:
- Size of the block storage volume in GB.
- Required if I(state) is present.
type: int
region:
description:
- Region the block storage volume is deployed into.
- Required if I(state) is present.
type: str
state:
description:
- State of the block storage volume.
default: present
choices: [ present, absent ]
type: str
extends_documentation_fragment:
- ngine_io.vultr.vultr
Expand Down Expand Up @@ -216,10 +220,10 @@ def absent_block_storage_volume(self):
def main():
argument_spec = vultr_argument_spec()
argument_spec.update(dict(
name=dict(required=True, aliases=['description', 'label']),
name=dict(type='str', required=True, aliases=['description', 'label']),
size=dict(type='int'),
region=dict(),
state=dict(choices=['present', 'absent'], default='present'),
region=dict(type='str'),
state=dict(type='str', choices=['present', 'absent'], default='present'),
))

module = AnsibleModule(
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/vultr_block_storage_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
short_description: Get information about the Vultr block storage volumes available.
description:
- Get infos about block storage volumes available in Vultr.
version_added: "1.0.0"
version_added: "0.1.0"
author:
- "Yanis Guenane (@Spredzy)"
- "René Moser (@resmo)"
Expand Down
11 changes: 7 additions & 4 deletions plugins/modules/vultr_dns_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,27 @@
short_description: Manages DNS domains on Vultr.
description:
- Create and remove DNS domains.
version_added: "1.0.0"
version_added: "0.1.0"
author: "René Moser (@resmo)"
options:
name:
description:
- The domain name.
required: true
aliases: [ domain ]
type: str
server_ip:
description:
- The default server IP.
- Use M(vultr_dns_record) to change it once the domain is created.
- Required if C(state=present).
type: str
state:
description:
- State of the DNS domain.
default: present
choices: [ present, absent ]
type: str
extends_documentation_fragment:
- ngine_io.vultr.vultr
Expand Down Expand Up @@ -172,9 +175,9 @@ def absent_domain(self):
def main():
argument_spec = vultr_argument_spec()
argument_spec.update(dict(
name=dict(required=True, aliases=['domain']),
server_ip=dict(),
state=dict(choices=['present', 'absent'], default='present'),
name=dict(type='str', required=True, aliases=['domain']),
server_ip=dict(type='str',),
state=dict(type='str', choices=['present', 'absent'], default='present'),
))

module = AnsibleModule(
Expand Down
20 changes: 12 additions & 8 deletions plugins/modules/vultr_dns_domain_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
short_description: Gather information about the Vultr DNS domains available.
description:
- Gather information about DNS domains available in Vultr.
version_added: "1.0.0"
version_added: "0.1.0"
author: "Yanis Guenane (@Spredzy)"
extends_documentation_fragment:
- ngine_io.vultr.vultr
Expand Down Expand Up @@ -66,13 +66,17 @@
description: Response from Vultr API
returned: success
type: complex
sample:
"vultr_dns_domain_info": [
{
"date_created": "2018-07-19 07:14:21",
"domain": "ansibletest.com"
}
]
contains:
domain:
description: Name of the DNS Domain.
returned: success
type: str
sample: example.com
date_created:
description: Date the DNS domain was created.
returned: success
type: str
sample: "2017-08-26 12:47:48"
'''

from ansible.module_utils.basic import AnsibleModule
Expand Down
19 changes: 13 additions & 6 deletions plugins/modules/vultr_dns_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@
short_description: Manages DNS records on Vultr.
description:
- Create, update and remove DNS records.
version_added: "1.0.0"
version_added: "0.1.0"
author: "René Moser (@resmo)"
options:
name:
description:
- The record name (subrecord).
default: ""
aliases: [ subrecord ]
type: str
domain:
description:
- The domain the record is related to.
type: str
required: true
record_type:
description:
Expand All @@ -41,14 +43,17 @@
- NS
- SSHFP
aliases: [ type ]
type: str
data:
description:
- Data of the record.
- Required if C(state=present) or C(multiple=yes).
type: str
ttl:
description:
- TTL of the record.
default: 300
type: int
multiple:
description:
- Whether to use more than one record with similar C(name) including no name and C(record_type).
Expand All @@ -60,11 +65,13 @@
description:
- Priority of the record.
default: 0
type: int
state:
description:
- State of the DNS record.
default: present
choices: [ present, absent ]
type: str
extends_documentation_fragment:
- ngine_io.vultr.vultr
Expand Down Expand Up @@ -335,14 +342,14 @@ def absent_record(self):
def main():
argument_spec = vultr_argument_spec()
argument_spec.update(dict(
domain=dict(required=True),
name=dict(default="", aliases=['subrecord']),
state=dict(choices=['present', 'absent'], default='present'),
domain=dict(type='str', required=True),
name=dict(type='str', default="", aliases=['subrecord']),
state=dict(type='str', choices=['present', 'absent'], default='present'),
ttl=dict(type='int', default=300),
record_type=dict(choices=RECORD_TYPES, default='A', aliases=['type']),
record_type=dict(type='str', choices=RECORD_TYPES, default='A', aliases=['type']),
multiple=dict(type='bool', default=False),
priority=dict(type='int', default=0),
data=dict()
data=dict(type='str',)
))

module = AnsibleModule(
Expand Down
8 changes: 5 additions & 3 deletions plugins/modules/vultr_firewall_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@
short_description: Manages firewall groups on Vultr.
description:
- Create and remove firewall groups.
version_added: "1.0.0"
version_added: "0.1.0"
author: "René Moser (@resmo)"
options:
name:
description:
- Name of the firewall group.
required: true
aliases: [ description ]
type: str
state:
description:
- State of the firewall group.
default: present
choices: [ present, absent ]
type: str
extends_documentation_fragment:
- ngine_io.vultr.vultr
Expand Down Expand Up @@ -176,8 +178,8 @@ def absent_firewall_group(self):
def main():
argument_spec = vultr_argument_spec()
argument_spec.update(dict(
name=dict(required=True, aliases=['description']),
state=dict(choices=['present', 'absent'], default='present'),
name=dict(type='str', required=True, aliases=['description']),
state=dict(type='str', choices=['present', 'absent'], default='present'),
))

module = AnsibleModule(
Expand Down
35 changes: 22 additions & 13 deletions plugins/modules/vultr_firewall_group_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
short_description: Gather information about the Vultr firewall groups available.
description:
- Gather information about firewall groups available in Vultr.
version_added: "1.0.0"
version_added: "0.1.0"
author: "Yanis Guenane (@Spredzy)"
extends_documentation_fragment:
- ngine_io.vultr.vultr
Expand Down Expand Up @@ -66,18 +66,27 @@
description: Response from Vultr API
returned: success
type: complex
sample:
"vultr_firewall_group_info": [
{
"date_created": "2018-07-12 10:27:14",
"date_modified": "2018-07-12 10:27:14",
"description": "test",
"id": "5e128ff0",
"instance_count": 0,
"max_rule_count": 50,
"rule_count": 0
}
]
contains:
id:
description: ID of the firewall group
returned: success
type: str
sample: 1234abcd
description:
description: Name of the firewall group
returned: success
type: str
sample: my firewall group
date_created:
description: Date the firewall group was created
returned: success
type: str
sample: "2017-08-26 12:47:48"
date_modified:
description: Date the firewall group was modified
returned: success
type: str
sample: "2017-08-26 12:47:48"
'''

from ansible.module_utils.basic import AnsibleModule
Expand Down
19 changes: 13 additions & 6 deletions plugins/modules/vultr_firewall_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,51 @@
short_description: Manages firewall rules on Vultr.
description:
- Create and remove firewall rules.
version_added: "1.0.0"
version_added: "0.1.0"
author: "René Moser (@resmo)"
options:
group:
description:
- Name of the firewall group.
required: true
type: str
ip_version:
description:
- IP address version
choices: [ v4, v6 ]
default: v4
aliases: [ ip_type ]
type: str
protocol:
description:
- Protocol of the firewall rule.
choices: [ icmp, tcp, udp, gre ]
default: tcp
type: str
cidr:
description:
- Network in CIDR format
- The CIDR format must match with the C(ip_version) value.
- Required if C(state=present).
- Defaulted to 0.0.0.0/0 or ::/0 depending on C(ip_version).
type: str
start_port:
description:
- Start port for the firewall rule.
- Required if C(protocol) is tcp or udp and I(state=present).
aliases: [ port ]
type: int
end_port:
description:
- End port for the firewall rule.
- Only considered if C(protocol) is tcp or udp and I(state=present).
type: int
state:
description:
- State of the firewall rule.
default: present
choices: [ present, absent ]
type: str
extends_documentation_fragment:
- ngine_io.vultr.vultr
Expand Down Expand Up @@ -349,13 +356,13 @@ def get_result(self, resource):
def main():
argument_spec = vultr_argument_spec()
argument_spec.update(dict(
group=dict(required=True),
group=dict(type='str', required=True),
start_port=dict(type='int', aliases=['port']),
end_port=dict(type='int'),
protocol=dict(choices=['tcp', 'udp', 'gre', 'icmp'], default='tcp'),
cidr=dict(),
ip_version=dict(choices=['v4', 'v6'], default='v4', aliases=['ip_type']),
state=dict(choices=['present', 'absent'], default='present'),
protocol=dict(type='str', choices=['tcp', 'udp', 'gre', 'icmp'], default='tcp'),
cidr=dict(type='str',),
ip_version=dict(type='str', choices=['v4', 'v6'], default='v4', aliases=['ip_type']),
state=dict(type='str', choices=['present', 'absent'], default='present'),
))

module = AnsibleModule(
Expand Down
Loading

0 comments on commit 52c69f5

Please sign in to comment.