vultr: rename prefix vr_to vultr_ (#43994)
* vultr: rename modules * replace string vr_ with vultr_ * add deprecation warning * fix sanity tests * add changelog
This commit is contained in:
parent
ffa720c0f1
commit
1fb0e11b56
67 changed files with 543 additions and 537 deletions
4
changelogs/fragments/vultr_modules_renamed.yml
Normal file
4
changelogs/fragments/vultr_modules_renamed.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
minor_changes:
|
||||
- "Changed the prefix of all Vultr modules from vr to vultr
|
||||
(https://github.com/ansible/ansible/issues/42942)."
|
|
@ -30,6 +30,10 @@ def vultr_argument_spec():
|
|||
class Vultr:
|
||||
|
||||
def __init__(self, module, namespace):
|
||||
|
||||
if module._name.startswith('vr_'):
|
||||
module.deprecate("The Vultr modules were renamed. The prefix of the modules changed from vr_ to vultr_", version='2.11')
|
||||
|
||||
self.module = module
|
||||
|
||||
# Namespace use for returns
|
||||
|
|
1
lib/ansible/modules/cloud/vultr/_vr_account_facts.py
Symbolic link
1
lib/ansible/modules/cloud/vultr/_vr_account_facts.py
Symbolic link
|
@ -0,0 +1 @@
|
|||
vultr_account_facts.py
|
1
lib/ansible/modules/cloud/vultr/_vr_dns_domain.py
Symbolic link
1
lib/ansible/modules/cloud/vultr/_vr_dns_domain.py
Symbolic link
|
@ -0,0 +1 @@
|
|||
vultr_dns_domain.py
|
1
lib/ansible/modules/cloud/vultr/_vr_dns_record.py
Symbolic link
1
lib/ansible/modules/cloud/vultr/_vr_dns_record.py
Symbolic link
|
@ -0,0 +1 @@
|
|||
vultr_dns_record.py
|
1
lib/ansible/modules/cloud/vultr/_vr_firewall_group.py
Symbolic link
1
lib/ansible/modules/cloud/vultr/_vr_firewall_group.py
Symbolic link
|
@ -0,0 +1 @@
|
|||
vultr_firewall_group.py
|
1
lib/ansible/modules/cloud/vultr/_vr_firewall_rule.py
Symbolic link
1
lib/ansible/modules/cloud/vultr/_vr_firewall_rule.py
Symbolic link
|
@ -0,0 +1 @@
|
|||
vultr_firewall_rule.py
|
1
lib/ansible/modules/cloud/vultr/_vr_server.py
Symbolic link
1
lib/ansible/modules/cloud/vultr/_vr_server.py
Symbolic link
|
@ -0,0 +1 @@
|
|||
vultr_server.py
|
1
lib/ansible/modules/cloud/vultr/_vr_ssh_key.py
Symbolic link
1
lib/ansible/modules/cloud/vultr/_vr_ssh_key.py
Symbolic link
|
@ -0,0 +1 @@
|
|||
vultr_ssh_key.py
|
1
lib/ansible/modules/cloud/vultr/_vr_startup_script.py
Symbolic link
1
lib/ansible/modules/cloud/vultr/_vr_startup_script.py
Symbolic link
|
@ -0,0 +1 @@
|
|||
vultr_startup_script.py
|
1
lib/ansible/modules/cloud/vultr/_vr_user.py
Symbolic link
1
lib/ansible/modules/cloud/vultr/_vr_user.py
Symbolic link
|
@ -0,0 +1 @@
|
|||
vultr_user.py
|
|
@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: vr_account_facts
|
||||
module: vultr_account_facts
|
||||
short_description: Gather facts about the Vultr account.
|
||||
description:
|
||||
- Gather facts about account balance, charges and payments.
|
||||
|
@ -25,7 +25,7 @@ extends_documentation_fragment: vultr
|
|||
EXAMPLES = r'''
|
||||
- name: Gather Vultr account facts
|
||||
local_action:
|
||||
module: vr_account_facts
|
||||
module: vultr_account_facts
|
||||
|
||||
- name: Print the gathered facts
|
||||
debug:
|
|
@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: vr_dns_domain
|
||||
module: vultr_dns_domain
|
||||
short_description: Manages DNS domains on Vultr.
|
||||
description:
|
||||
- Create and remove DNS domains.
|
||||
|
@ -28,7 +28,7 @@ options:
|
|||
server_ip:
|
||||
description:
|
||||
- The default server IP.
|
||||
- Use M(vr_dns_record) to change it once the domain is created.
|
||||
- Use M(vultr_dns_record) to change it once the domain is created.
|
||||
- Required if C(state=present).
|
||||
state:
|
||||
description:
|
||||
|
@ -41,13 +41,13 @@ extends_documentation_fragment: vultr
|
|||
EXAMPLES = r'''
|
||||
- name: Ensure a domain exists
|
||||
local_action:
|
||||
module: vr_dns_domain
|
||||
module: vultr_dns_domain
|
||||
name: example.com
|
||||
server_ip: 10.10.10.10
|
||||
|
||||
- name: Ensure a domain is absent
|
||||
local_action:
|
||||
module: vr_dns_domain
|
||||
module: vultr_dns_domain
|
||||
name: example.com
|
||||
state: absent
|
||||
'''
|
||||
|
@ -170,7 +170,7 @@ class AnsibleVultrDnsDomain(Vultr):
|
|||
def main():
|
||||
argument_spec = vultr_argument_spec()
|
||||
argument_spec.update(dict(
|
||||
name=dict(required=True),
|
||||
name=dict(required=True, aliases=['domain']),
|
||||
server_ip=dict(),
|
||||
state=dict(choices=['present', 'absent'], default='present'),
|
||||
))
|
||||
|
@ -183,13 +183,13 @@ def main():
|
|||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
vr_domain = AnsibleVultrDnsDomain(module)
|
||||
vultr_domain = AnsibleVultrDnsDomain(module)
|
||||
if module.params.get('state') == "absent":
|
||||
domain = vr_domain.absent_domain()
|
||||
domain = vultr_domain.absent_domain()
|
||||
else:
|
||||
domain = vr_domain.present_domain()
|
||||
domain = vultr_domain.present_domain()
|
||||
|
||||
result = vr_domain.get_result(domain)
|
||||
result = vultr_domain.get_result(domain)
|
||||
module.exit_json(**result)
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: vr_dns_domain_facts
|
||||
module: vultr_dns_domain_facts
|
||||
short_description: Gather facts about the Vultr DNS domains available.
|
||||
description:
|
||||
- Gather facts about DNS domains available in Vultr.
|
||||
|
@ -24,7 +24,7 @@ extends_documentation_fragment: vultr
|
|||
EXAMPLES = r'''
|
||||
- name: Gather Vultr DNS domains facts
|
||||
local_action:
|
||||
module: vr_dns_domains_facts
|
||||
module: vultr_dns_domains_facts
|
||||
|
||||
- name: Print the gathered facts
|
||||
debug:
|
|
@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: vr_dns_record
|
||||
module: vultr_dns_record
|
||||
short_description: Manages DNS records on Vultr.
|
||||
description:
|
||||
- Create, update and remove DNS records.
|
||||
|
@ -39,10 +39,10 @@ options:
|
|||
- CNAME
|
||||
- MX
|
||||
- SRV
|
||||
- ALIAS
|
||||
- SPF
|
||||
- CAA
|
||||
- TXT
|
||||
- NS
|
||||
- SSHFP
|
||||
aliases: [ type ]
|
||||
data:
|
||||
description:
|
||||
|
@ -73,14 +73,14 @@ extends_documentation_fragment: vultr
|
|||
|
||||
EXAMPLES = '''
|
||||
- name: Ensure an A record exists
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: www
|
||||
domain: example.com
|
||||
data: 10.10.10.10
|
||||
ttl: 3600
|
||||
|
||||
- name: Ensure a second A record exists for round robin LB
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: www
|
||||
domain: example.com
|
||||
data: 10.10.10.11
|
||||
|
@ -88,14 +88,14 @@ EXAMPLES = '''
|
|||
multiple: yes
|
||||
|
||||
- name: Ensure a CNAME record exists
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: web
|
||||
record_type: CNAME
|
||||
domain: example.com
|
||||
data: www.example.com
|
||||
|
||||
- name: Ensure MX record exists
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
record_type: MX
|
||||
domain: example.com
|
||||
data: "{{ item.data }}"
|
||||
|
@ -108,13 +108,13 @@ EXAMPLES = '''
|
|||
|
||||
- name: Ensure a record is absent
|
||||
local_action:
|
||||
module: vr_dns_record
|
||||
module: vultr_dns_record
|
||||
name: www
|
||||
domain: example.com
|
||||
state: absent
|
||||
|
||||
- name: Ensure MX record is absent in case multiple exists
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
record_type: MX
|
||||
domain: example.com
|
||||
data: mx1.example.com
|
||||
|
@ -342,13 +342,13 @@ def main():
|
|||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
vr_record = AnsibleVultrDnsRecord(module)
|
||||
vultr_record = AnsibleVultrDnsRecord(module)
|
||||
if module.params.get('state') == "absent":
|
||||
record = vr_record.absent_record()
|
||||
record = vultr_record.absent_record()
|
||||
else:
|
||||
record = vr_record.present_record()
|
||||
record = vultr_record.present_record()
|
||||
|
||||
result = vr_record.get_result(record)
|
||||
result = vultr_record.get_result(record)
|
||||
module.exit_json(**result)
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: vr_firewall_group
|
||||
module: vultr_firewall_group
|
||||
short_description: Manages firewall groups on Vultr.
|
||||
description:
|
||||
- Create and remove firewall groups.
|
||||
|
@ -36,12 +36,12 @@ extends_documentation_fragment: vultr
|
|||
EXAMPLES = '''
|
||||
- name: ensure a firewall group is present
|
||||
local_action:
|
||||
module: vr_firewall_group
|
||||
module: vultr_firewall_group
|
||||
name: my http firewall
|
||||
|
||||
- name: ensure a firewall group is absent
|
||||
local_action:
|
||||
module: vr_firewall_group
|
||||
module: vultr_firewall_group
|
||||
name: my http firewall
|
||||
state: absent
|
||||
'''
|
||||
|
@ -183,13 +183,13 @@ def main():
|
|||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
vr_firewall_group = AnsibleVultrFirewallGroup(module)
|
||||
vultr_firewall_group = AnsibleVultrFirewallGroup(module)
|
||||
if module.params.get('state') == "absent":
|
||||
firewall_group = vr_firewall_group.absent_firewall_group()
|
||||
firewall_group = vultr_firewall_group.absent_firewall_group()
|
||||
else:
|
||||
firewall_group = vr_firewall_group.present_firewall_group()
|
||||
firewall_group = vultr_firewall_group.present_firewall_group()
|
||||
|
||||
result = vr_firewall_group.get_result(firewall_group)
|
||||
result = vultr_firewall_group.get_result(firewall_group)
|
||||
module.exit_json(**result)
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: vr_firewall_group_facts
|
||||
module: vultr_firewall_group_facts
|
||||
short_description: Gather facts about the Vultr firewall groups available.
|
||||
description:
|
||||
- Gather facts about firewall groups available in Vultr.
|
||||
|
@ -24,7 +24,7 @@ extends_documentation_fragment: vultr
|
|||
EXAMPLES = r'''
|
||||
- name: Gather Vultr firewall groups facts
|
||||
local_action:
|
||||
module: vr_firewall_group_facts
|
||||
module: vultr_firewall_group_facts
|
||||
|
||||
- name: Print the gathered facts
|
||||
debug:
|
|
@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: vr_firewall_rule
|
||||
module: vultr_firewall_rule
|
||||
short_description: Manages firewall rules on Vultr.
|
||||
description:
|
||||
- Create and remove firewall rules.
|
||||
|
@ -38,18 +38,18 @@ options:
|
|||
cidr:
|
||||
description:
|
||||
- Network in CIDR format
|
||||
- The CIDR format must match with the C(ip_type) value.
|
||||
- The CIDR format must match with the C(ip_version) value.
|
||||
- Required if C(state=present).
|
||||
default: 0.0.0.0/0 or ::/0 depending on C(ip_version)
|
||||
- Defaulted to 0.0.0.0/0 or ::/0 depending on C(ip_version).
|
||||
start_port:
|
||||
description:
|
||||
- Start port for the firewall rule.
|
||||
- Required if C(protocol) is tcp or udp and C(state=present).
|
||||
- Required if C(protocol) is tcp or udp and I(state=present).
|
||||
aliases: [ port ]
|
||||
end_port:
|
||||
description:
|
||||
- End port for the firewall rule.
|
||||
- Only considered if C(protocol) is tcp or udp and C(state=present).
|
||||
- Only considered if C(protocol) is tcp or udp and I(state=present).
|
||||
state:
|
||||
description:
|
||||
- State of the firewall rule.
|
||||
|
@ -61,7 +61,7 @@ extends_documentation_fragment: vultr
|
|||
EXAMPLES = '''
|
||||
- name: ensure a firewall rule is present
|
||||
local_action:
|
||||
module: vr_firewall_rule
|
||||
module: vultr_firewall_rule
|
||||
group: application
|
||||
protocol: tcp
|
||||
start_port: 8000
|
||||
|
@ -70,7 +70,7 @@ EXAMPLES = '''
|
|||
|
||||
- name: open DNS port for all ipv4 and ipv6
|
||||
local_action:
|
||||
module: vr_firewall_rule
|
||||
module: vultr_firewall_rule
|
||||
group: dns
|
||||
protocol: udp
|
||||
port: 53
|
||||
|
@ -79,13 +79,13 @@ EXAMPLES = '''
|
|||
|
||||
- name: allow ping
|
||||
local_action:
|
||||
module: vr_firewall_rule
|
||||
module: vultr_firewall_rule
|
||||
group: web
|
||||
protocol: icmp
|
||||
|
||||
- name: ensure a firewall rule is absent
|
||||
local_action:
|
||||
module: vr_firewall_rule
|
||||
module: vultr_firewall_rule
|
||||
group: application
|
||||
protocol: tcp
|
||||
start_port: 8000
|
||||
|
@ -354,7 +354,7 @@ def main():
|
|||
end_port=dict(type='int'),
|
||||
protocol=dict(choices=['tcp', 'udp', 'gre', 'icmp'], default='tcp'),
|
||||
cidr=dict(),
|
||||
ip_version=dict(choices=['v4', 'v6'], default='v4'),
|
||||
ip_version=dict(choices=['v4', 'v6'], default='v4', aliases=['ip_type']),
|
||||
state=dict(choices=['present', 'absent'], default='present'),
|
||||
))
|
||||
|
||||
|
@ -363,13 +363,13 @@ def main():
|
|||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
vr_firewall_rule = AnsibleVultrFirewallRule(module)
|
||||
vultr_firewall_rule = AnsibleVultrFirewallRule(module)
|
||||
if module.params.get('state') == "absent":
|
||||
firewall_rule = vr_firewall_rule.absent_firewall_rule()
|
||||
firewall_rule = vultr_firewall_rule.absent_firewall_rule()
|
||||
else:
|
||||
firewall_rule = vr_firewall_rule.present_firewall_rule()
|
||||
firewall_rule = vultr_firewall_rule.present_firewall_rule()
|
||||
|
||||
result = vr_firewall_rule.get_result(firewall_rule)
|
||||
result = vultr_firewall_rule.get_result(firewall_rule)
|
||||
module.exit_json(**result)
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: vr_os_facts
|
||||
module: vultr_os_facts
|
||||
short_description: Gather facts about the Vultr OSes available.
|
||||
description:
|
||||
- Gather facts about OSes available to boot servers.
|
||||
|
@ -25,7 +25,7 @@ extends_documentation_fragment: vultr
|
|||
EXAMPLES = r'''
|
||||
- name: Gather Vultr OSes facts
|
||||
local_action:
|
||||
module: vr_os_facts
|
||||
module: vultr_os_facts
|
||||
|
||||
- name: Print the gathered facts
|
||||
debug:
|
|
@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: vr_plan_facts
|
||||
module: vultr_plan_facts
|
||||
short_description: Gather facts about the Vultr plans available.
|
||||
description:
|
||||
- Gather facts about plans available to boot servers.
|
||||
|
@ -25,7 +25,7 @@ extends_documentation_fragment: vultr
|
|||
EXAMPLES = r'''
|
||||
- name: Gather Vultr plans facts
|
||||
local_action:
|
||||
module: vr_plan_facts
|
||||
module: vultr_plan_facts
|
||||
|
||||
- name: Print the gathered facts
|
||||
debug:
|
|
@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: vr_region_facts
|
||||
module: vultr_region_facts
|
||||
short_description: Gather facts about the Vultr regions available.
|
||||
description:
|
||||
- Gather facts about regions available to boot servers.
|
||||
|
@ -25,7 +25,7 @@ extends_documentation_fragment: vultr
|
|||
EXAMPLES = r'''
|
||||
- name: Gather Vultr regions facts
|
||||
local_action:
|
||||
module: vr_region_facts
|
||||
module: vultr_region_facts
|
||||
|
||||
- name: Print the gathered facts
|
||||
debug:
|
|
@ -14,7 +14,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: vr_server
|
||||
module: vultr_server
|
||||
short_description: Manages virtual servers on Vultr.
|
||||
description:
|
||||
- Deploy, start, stop, update, restart, reinstall servers.
|
||||
|
@ -44,6 +44,7 @@ options:
|
|||
description:
|
||||
- Force stop/start the server if required to apply changes
|
||||
- Otherwise a running server will not be changed.
|
||||
type: bool
|
||||
notify_activate:
|
||||
description:
|
||||
- Whether to send an activation email when the server is ready or not.
|
||||
|
@ -94,8 +95,8 @@ extends_documentation_fragment: vultr
|
|||
EXAMPLES = '''
|
||||
- name: create server
|
||||
local_action:
|
||||
module: vr_server
|
||||
name: "{{ vr_server_name }}"
|
||||
module: vultr_server
|
||||
name: "{{ vultr_server_name }}"
|
||||
os: CentOS 7 x64
|
||||
plan: 1024 MB RAM,25 GB SSD,1.00 TB BW
|
||||
region: Amsterdam
|
||||
|
@ -103,8 +104,8 @@ EXAMPLES = '''
|
|||
|
||||
- name: ensure a server is present and started
|
||||
local_action:
|
||||
module: vr_server
|
||||
name: "{{ vr_server_name }}"
|
||||
module: vultr_server
|
||||
name: "{{ vultr_server_name }}"
|
||||
os: CentOS 7 x64
|
||||
plan: 1024 MB RAM,25 GB SSD,1.00 TB BW
|
||||
region: Amsterdam
|
||||
|
@ -112,8 +113,8 @@ EXAMPLES = '''
|
|||
|
||||
- name: ensure a server is present and stopped
|
||||
local_action:
|
||||
module: vr_server
|
||||
name: "{{ vr_server_name }}"
|
||||
module: vultr_server
|
||||
name: "{{ vultr_server_name }}"
|
||||
os: CentOS 7 x64
|
||||
plan: 1024 MB RAM,25 GB SSD,1.00 TB BW
|
||||
region: Amsterdam
|
||||
|
@ -121,20 +122,20 @@ EXAMPLES = '''
|
|||
|
||||
- name: ensure an existing server is stopped
|
||||
local_action:
|
||||
module: vr_server
|
||||
name: "{{ vr_server_name }}"
|
||||
module: vultr_server
|
||||
name: "{{ vultr_server_name }}"
|
||||
state: stopped
|
||||
|
||||
- name: ensure an existing server is started
|
||||
local_action:
|
||||
module: vr_server
|
||||
name: "{{ vr_server_name }}"
|
||||
module: vultr_server
|
||||
name: "{{ vultr_server_name }}"
|
||||
state: started
|
||||
|
||||
- name: ensure a server is absent
|
||||
local_action:
|
||||
module: vr_server
|
||||
name: "{{ vr_server_name }}"
|
||||
module: vultr_server
|
||||
name: "{{ vultr_server_name }}"
|
||||
state: absent
|
||||
'''
|
||||
|
||||
|
@ -851,25 +852,25 @@ def main():
|
|||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
vr_server = AnsibleVultrServer(module)
|
||||
vultr_server = AnsibleVultrServer(module)
|
||||
if module.params.get('state') == "absent":
|
||||
server = vr_server.absent_server()
|
||||
server = vultr_server.absent_server()
|
||||
else:
|
||||
if module.params.get('state') == "started":
|
||||
server = vr_server.present_server()
|
||||
server = vr_server.start_server()
|
||||
server = vultr_server.present_server()
|
||||
server = vultr_server.start_server()
|
||||
elif module.params.get('state') == "stopped":
|
||||
server = vr_server.present_server(start_server=False)
|
||||
server = vr_server.stop_server()
|
||||
server = vultr_server.present_server(start_server=False)
|
||||
server = vultr_server.stop_server()
|
||||
elif module.params.get('state') == "restarted":
|
||||
server = vr_server.present_server()
|
||||
server = vr_server.restart_server()
|
||||
server = vultr_server.present_server()
|
||||
server = vultr_server.restart_server()
|
||||
elif module.params.get('state') == "reinstalled":
|
||||
server = vr_server.reinstall_server()
|
||||
server = vultr_server.reinstall_server()
|
||||
else:
|
||||
server = vr_server.present_server()
|
||||
server = vultr_server.present_server()
|
||||
|
||||
result = vr_server.get_result(server)
|
||||
result = vultr_server.get_result(server)
|
||||
module.exit_json(**result)
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: vr_ssh_key
|
||||
module: vultr_ssh_key
|
||||
short_description: Manages ssh keys on Vultr.
|
||||
description:
|
||||
- Create, update and remove ssh keys.
|
||||
|
@ -40,13 +40,13 @@ extends_documentation_fragment: vultr
|
|||
EXAMPLES = '''
|
||||
- name: ensure an SSH key is present
|
||||
local_action:
|
||||
module: vr_ssh_key
|
||||
module: vultr_ssh_key
|
||||
name: my ssh key
|
||||
ssh_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
|
||||
|
||||
- name: ensure an SSH key is absent
|
||||
local_action:
|
||||
module: vr_ssh_key
|
||||
module: vultr_ssh_key
|
||||
name: my ssh key
|
||||
state: absent
|
||||
'''
|
||||
|
@ -218,13 +218,13 @@ def main():
|
|||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
vr_ssh_key = AnsibleVultrSshKey(module)
|
||||
vultr_ssh_key = AnsibleVultrSshKey(module)
|
||||
if module.params.get('state') == "absent":
|
||||
ssh_key = vr_ssh_key.absent_ssh_key()
|
||||
ssh_key = vultr_ssh_key.absent_ssh_key()
|
||||
else:
|
||||
ssh_key = vr_ssh_key.present_ssh_key()
|
||||
ssh_key = vultr_ssh_key.present_ssh_key()
|
||||
|
||||
result = vr_ssh_key.get_result(ssh_key)
|
||||
result = vultr_ssh_key.get_result(ssh_key)
|
||||
module.exit_json(**result)
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: vr_ssh_key_facts
|
||||
module: vultr_ssh_key_facts
|
||||
short_description: Gather facts about the Vultr SSH keys available.
|
||||
description:
|
||||
- Gather facts about SSH keys available.
|
||||
|
@ -25,7 +25,7 @@ extends_documentation_fragment: vultr
|
|||
EXAMPLES = r'''
|
||||
- name: Gather Vultr SSH keys facts
|
||||
local_action:
|
||||
module: vr_ssh_key_facts
|
||||
module: vultr_ssh_key_facts
|
||||
|
||||
- name: Print the gathered facts
|
||||
debug:
|
|
@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: vr_startup_script
|
||||
module: vultr_startup_script
|
||||
short_description: Manages startup scripts on Vultr.
|
||||
description:
|
||||
- Create, update and remove startup scripts.
|
||||
|
@ -45,20 +45,20 @@ extends_documentation_fragment: vultr
|
|||
EXAMPLES = r'''
|
||||
- name: ensure a pxe script exists, source from a file
|
||||
local_action:
|
||||
module: vr_startup_script
|
||||
module: vultr_startup_script
|
||||
name: my_web_script
|
||||
script_type: pxe
|
||||
script: "{{ lookup('file', 'path/to/script') }}"
|
||||
|
||||
- name: ensure a boot script exists
|
||||
local_action:
|
||||
module: vr_startup_script
|
||||
name: vr_startup_script
|
||||
module: vultr_startup_script
|
||||
name: vultr_startup_script
|
||||
script: "#!/bin/bash\necho Hello World > /root/hello"
|
||||
|
||||
- name: ensure a script is absent
|
||||
local_action:
|
||||
module: vr_startup_script
|
||||
module: vultr_startup_script
|
||||
name: my_web_script
|
||||
state: absent
|
||||
'''
|
||||
|
@ -246,13 +246,13 @@ def main():
|
|||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
vr_script = AnsibleVultrStartupScript(module)
|
||||
vultr_script = AnsibleVultrStartupScript(module)
|
||||
if module.params.get('state') == "absent":
|
||||
script = vr_script.absent_script()
|
||||
script = vultr_script.absent_script()
|
||||
else:
|
||||
script = vr_script.present_script()
|
||||
script = vultr_script.present_script()
|
||||
|
||||
result = vr_script.get_result(script)
|
||||
result = vultr_script.get_result(script)
|
||||
module.exit_json(**result)
|
||||
|
||||
|
|
@ -13,10 +13,10 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: vr_startup_script_facts
|
||||
module: vultr_startup_script_facts
|
||||
short_description: Gather facts about the Vultr startup scripts available.
|
||||
description:
|
||||
- Gather facts about vr_startup_scripts available.
|
||||
- Gather facts about vultr_startup_scripts available.
|
||||
version_added: "2.7"
|
||||
author: "Yanis Guenane (@Spredzy)"
|
||||
extends_documentation_fragment: vultr
|
||||
|
@ -25,7 +25,7 @@ extends_documentation_fragment: vultr
|
|||
EXAMPLES = r'''
|
||||
- name: Gather Vultr startup scripts facts
|
||||
local_action:
|
||||
module: vr_startup_script_facts
|
||||
module: vultr_startup_script_facts
|
||||
|
||||
- name: Print the gathered facts
|
||||
debug:
|
|
@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: vr_user
|
||||
module: vultr_user
|
||||
short_description: Manages users on Vultr.
|
||||
description:
|
||||
- Create, update and remove users.
|
||||
|
@ -56,6 +56,7 @@ options:
|
|||
- abuse
|
||||
- dns
|
||||
- upgrade
|
||||
aliases: [ acl ]
|
||||
state:
|
||||
description:
|
||||
- State of the user.
|
||||
|
@ -67,7 +68,7 @@ extends_documentation_fragment: vultr
|
|||
EXAMPLES = r'''
|
||||
- name: Ensure a user exists
|
||||
local_action:
|
||||
module: vr_user
|
||||
module: vultr_user
|
||||
name: john
|
||||
email: john.doe@example.com
|
||||
password: s3cr3t
|
||||
|
@ -80,7 +81,7 @@ EXAMPLES = r'''
|
|||
|
||||
- name: Remove a user
|
||||
local_action:
|
||||
module: vr_user
|
||||
module: vultr_user
|
||||
name: john
|
||||
state: absent
|
||||
'''
|
||||
|
@ -199,12 +200,6 @@ class AnsibleVultrUser(Vultr):
|
|||
return {}
|
||||
|
||||
def present_user(self):
|
||||
# Choices with list
|
||||
acls = self.module.params.get('acls')
|
||||
for acl in acls or []:
|
||||
if acl not in ACLS:
|
||||
self.fail_json(msg='value of acls must be one or more of: %s, got: %s' % (ACLS, acls))
|
||||
|
||||
user = self.get_user()
|
||||
if not user:
|
||||
user = self._create_user(user)
|
||||
|
@ -297,7 +292,7 @@ def main():
|
|||
password=dict(no_log=True),
|
||||
force=dict(type='bool', default=False),
|
||||
api_enabled=dict(type='bool', default=True),
|
||||
acls=dict(type='list', aliases=['acl']),
|
||||
acls=dict(type='list', choices=ACLS, aliases=['acl']),
|
||||
state=dict(choices=['present', 'absent'], default='present'),
|
||||
))
|
||||
|
||||
|
@ -309,13 +304,13 @@ def main():
|
|||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
vr_user = AnsibleVultrUser(module)
|
||||
vultr_user = AnsibleVultrUser(module)
|
||||
if module.params.get('state') == "absent":
|
||||
user = vr_user.absent_user()
|
||||
user = vultr_user.absent_user()
|
||||
else:
|
||||
user = vr_user.present_user()
|
||||
user = vultr_user.present_user()
|
||||
|
||||
result = vr_user.get_result(user)
|
||||
result = vultr_user.get_result(user)
|
||||
module.exit_json(**result)
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
|
|||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: vr_user_facts
|
||||
module: vultr_user_facts
|
||||
short_description: Gather facts about the Vultr user available.
|
||||
description:
|
||||
- Gather facts about users available in Vultr.
|
||||
|
@ -24,7 +24,7 @@ extends_documentation_fragment: vultr
|
|||
EXAMPLES = r'''
|
||||
- name: Gather Vultr user facts
|
||||
local_action:
|
||||
module: vr_user_facts
|
||||
module: vultr_user_facts
|
||||
|
||||
- name: Print the gathered facts
|
||||
debug:
|
|
@ -1,6 +0,0 @@
|
|||
# Copyright (c) 2018, René Moser <mail@renemoser.net>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
vr_ssh_key_name: ansible-ssh-key
|
||||
vr_ssh_key: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAyWYItY+3w5b8PdGRoz0oY5mufqydW96naE+VM3JSvJFAUS08rAjQQpQ03ymoALeHQy6JVZbcgecxn6p0pAOINQdqufn4udPtOPCtMjNiPGpkSM9ah/6X5+kvyWMNrvlf+Ld4OOoszP5sAkgQzIbrFQAm41XknBUha0zkewZwfrVhain4pnDjV7wCcChId/Q/Gbi4xMtXkisznWcAJcueBs3EEZDKhJ5q0VeWSJEhYJDLFN1sOxF0AIUnMrOhfKQ/LjgREXPB6uCl899INUTXRNNjRpeMXyJ2wMMmOAbua2qEd1r13Bu1n+6A823Hzb33fyMXuqWnJwBJ4DCvMlGuEsfuOK+xk7DaBfLHbcM6fsPk0/4psTE6YLgC41remr6+u5ZWsY/faMtSnNPie8Z8Ov0DIYGdhbJjUXk1HomxRV9+ZfZ2Ob8iCwlaAQAyEUM6fs3Kxt8pBD8dx1HOkhsfBWPvuDr5y+kqE7H8/MuPDTc0QgH2pjUMpmw/XBwNDHshVEjrZvtICOjOLUJxcowLO1ivNYwPwowQxfisMy56LfYdjsOslBiqsrkAqvNGm1zu8wKHeqVN9w5l3yUELpvubfm9NKIvYcl6yWF36T0c5vE+g0DU/Jy4XpTj0hZG9QV2mRQcLJnd2pxQtJT7cPFtrn/+tgRxzjEtbDXummDV4sE= ansible@example.com"
|
||||
vr_ssh_key2: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCoQ9S7V+CufAgwoehnf2TqsJ9LTsu8pUA3FgpS2mdVwcMcTs++8P5sQcXHLtDmNLpWN4k7NQgxaY1oXy5e25x/4VhXaJXWEt3luSw+Phv/PB2+aGLvqCUirsLTAD2r7ieMhd/pcVf/HlhNUQgnO1mupdbDyqZoGD/uCcJiYav8i/V7nJWJouHA8yq31XS2yqXp9m3VC7UZZHzUsVJA9Us5YqF0hKYeaGruIHR2bwoDF9ZFMss5t6/pzxMljU/ccYwvvRDdI7WX4o4+zLuZ6RWvsU6LGbbb0pQdB72tlV41fSefwFsk4JRdKbyV3Xjf25pV4IXOTcqhy+4JTB/jXxrF torwalds@github.com"
|
|
@ -1,6 +0,0 @@
|
|||
# Copyright (c) 2018, René Moser <mail@renemoser.net>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
vr_startup_script_name: ansible_test_script
|
||||
vr_startup_script: "#!/bin/bash\necho Hello World > /root/hello"
|
||||
vr_startup_script2: "#!/bin/bash\necho Hello to my World > /root/hello"
|
|
@ -2,7 +2,7 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: test gather vultr account facts in check mode
|
||||
vr_account_facts:
|
||||
vultr_account_facts:
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather vultr account facts in check mode
|
||||
|
@ -14,7 +14,7 @@
|
|||
- ansible_facts.vultr_account_facts.last_payment_amount is defined
|
||||
|
||||
- name: test gather vultr account fact
|
||||
vr_account_facts:
|
||||
vultr_account_facts:
|
||||
- name: verify test gather vultr account facts
|
||||
assert:
|
||||
that:
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2018, René Moser <mail@renemoser.net>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
vr_dns_domain_name: example-ansible.com
|
||||
vultr_dns_domain_name: example-ansible.com
|
|
@ -2,8 +2,8 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: setup
|
||||
vr_dns_domain:
|
||||
name: "{{ vr_dns_domain_name }}"
|
||||
vultr_dns_domain:
|
||||
name: "{{ vultr_dns_domain_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify setup
|
||||
|
@ -12,7 +12,7 @@
|
|||
- result is success
|
||||
|
||||
- name: test fail if missing name
|
||||
vr_dns_domain:
|
||||
vultr_dns_domain:
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
- name: verify test fail if missing name
|
||||
|
@ -22,8 +22,8 @@
|
|||
- 'result.msg == "missing required arguments: name"'
|
||||
|
||||
- name: test fail if missing params for state=present
|
||||
vr_dns_domain:
|
||||
name: "{{ vr_dns_domain_name }}"
|
||||
vultr_dns_domain:
|
||||
name: "{{ vultr_dns_domain_name }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
- name: verify fail if missing params for state=present
|
||||
|
@ -33,8 +33,8 @@
|
|||
- 'result.msg == "state is present but all of the following are missing: server_ip"'
|
||||
|
||||
- name: test create dns domain in check mode
|
||||
vr_dns_domain:
|
||||
name: "{{ vr_dns_domain_name }}"
|
||||
vultr_dns_domain:
|
||||
name: "{{ vultr_dns_domain_name }}"
|
||||
server_ip: 10.10.10.10
|
||||
register: result
|
||||
check_mode: yes
|
||||
|
@ -44,30 +44,30 @@
|
|||
- result is changed
|
||||
|
||||
- name: test create dns domain
|
||||
vr_dns_domain:
|
||||
name: "{{ vr_dns_domain_name }}"
|
||||
vultr_dns_domain:
|
||||
name: "{{ vultr_dns_domain_name }}"
|
||||
server_ip: 10.10.10.10
|
||||
register: result
|
||||
- name: verify test create dns domain
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_dns_domain.name == '{{ vr_dns_domain_name }}'
|
||||
- result.vultr_dns_domain.name == '{{ vultr_dns_domain_name }}'
|
||||
|
||||
- name: test create dns domain idempotence
|
||||
vr_dns_domain:
|
||||
name: "{{ vr_dns_domain_name }}"
|
||||
vultr_dns_domain:
|
||||
name: "{{ vultr_dns_domain_name }}"
|
||||
server_ip: 10.10.10.10
|
||||
register: result
|
||||
- name: verify test create dns domain idempotence
|
||||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
- result.vultr_dns_domain.name == '{{ vr_dns_domain_name }}'
|
||||
- result.vultr_dns_domain.name == '{{ vultr_dns_domain_name }}'
|
||||
|
||||
- name: test absent dns domain in check mode
|
||||
vr_dns_domain:
|
||||
name: "{{ vr_dns_domain_name }}"
|
||||
vultr_dns_domain:
|
||||
name: "{{ vultr_dns_domain_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
check_mode: yes
|
||||
|
@ -75,22 +75,22 @@
|
|||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_dns_domain.name == '{{ vr_dns_domain_name }}'
|
||||
- result.vultr_dns_domain.name == '{{ vultr_dns_domain_name }}'
|
||||
|
||||
- name: test absent dns domain
|
||||
vr_dns_domain:
|
||||
name: "{{ vr_dns_domain_name }}"
|
||||
vultr_dns_domain:
|
||||
name: "{{ vultr_dns_domain_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify test absent dns domain
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_dns_domain.name == '{{ vr_dns_domain_name }}'
|
||||
- result.vultr_dns_domain.name == '{{ vultr_dns_domain_name }}'
|
||||
|
||||
- name: test absent dns domain idempotence
|
||||
vr_dns_domain:
|
||||
name: "{{ vr_dns_domain_name }}"
|
||||
vultr_dns_domain:
|
||||
name: "{{ vultr_dns_domain_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify test absent dns domain idempotence
|
|
@ -2,12 +2,12 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: Create the record
|
||||
vr_dns_domain:
|
||||
vultr_dns_domain:
|
||||
name: '{{ dns_domain_name }}'
|
||||
server_ip: '{{ dns_domain_server_ip }}'
|
||||
|
||||
- name: test gather vultr dns domain facts in check mode
|
||||
vr_dns_domain_facts:
|
||||
vultr_dns_domain_facts:
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather vultr dns domain facts in check mode
|
||||
|
@ -16,7 +16,7 @@
|
|||
- ansible_facts.vultr_dns_domain_facts|selectattr('domain','equalto','{{ dns_domain_name }}') | list | count == 1
|
||||
|
||||
- name: test gather vultr dns domain facts
|
||||
vr_dns_domain_facts:
|
||||
vultr_dns_domain_facts:
|
||||
|
||||
- name: verify test gather vultr dns domain facts
|
||||
assert:
|
||||
|
@ -24,7 +24,7 @@
|
|||
- ansible_facts.vultr_dns_domain_facts|selectattr('domain','equalto','{{ dns_domain_name }}') | list | count == 1
|
||||
|
||||
- name: Delete the record
|
||||
vr_dns_domain:
|
||||
vultr_dns_domain:
|
||||
name: '{{ dns_domain_name }}'
|
||||
server_ip: '{{ dns_domain_server_ip }}'
|
||||
state: absent
|
|
@ -1,8 +1,8 @@
|
|||
# Copyright (c) 2018, René Moser <mail@renemoser.net>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
vr_dns_domain_name: example-ansible.com
|
||||
vr_dns_record_items:
|
||||
vultr_dns_domain_name: example-ansible.com
|
||||
vultr_dns_record_items:
|
||||
# Single A record
|
||||
- name: test-www
|
||||
data: 10.10.10.10
|
|
@ -2,9 +2,9 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: test setup dns record
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: "{{ item.name | default(omit) }}"
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
record_type: "{{ item.record_type | default(omit) }}"
|
||||
state: absent
|
||||
register: result
|
||||
|
@ -14,9 +14,9 @@
|
|||
- result is successful
|
||||
|
||||
- name: test create a dns record in check mode
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: "{{ item.name | default(omit) }}"
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
data: "{{ item.data }}"
|
||||
ttl: "{{ item.ttl | default(omit) }}"
|
||||
record_type: "{{ item.record_type | default(omit) }}"
|
||||
|
@ -29,9 +29,9 @@
|
|||
- result is changed
|
||||
|
||||
- name: test create a dns record
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: "{{ item.name | default(omit) }}"
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
data: "{{ item.data }}"
|
||||
ttl: "{{ item.ttl | default(omit) }}"
|
||||
record_type: "{{ item.record_type | default(omit) }}"
|
||||
|
@ -48,9 +48,9 @@
|
|||
- result.vultr_dns_record.priority == {{ item.priority | default(0) }}
|
||||
|
||||
- name: test create a dns record idempotence
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: "{{ item.name | default(omit) }}"
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
data: "{{ item.data }}"
|
||||
ttl: "{{ item.ttl | default(omit) }}"
|
||||
record_type: "{{ item.record_type | default(omit) }}"
|
|
@ -2,8 +2,8 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: setup dns domain
|
||||
vr_dns_domain:
|
||||
name: "{{ vr_dns_domain_name }}"
|
||||
vultr_dns_domain:
|
||||
name: "{{ vultr_dns_domain_name }}"
|
||||
server_ip: 10.10.10.10
|
||||
register: result
|
||||
- name: verify setup dns domain
|
||||
|
@ -14,4 +14,4 @@
|
|||
- include_tasks: test_fail_multiple.yml
|
||||
|
||||
- include_tasks: record.yml
|
||||
with_items: "{{ vr_dns_record_items }}"
|
||||
with_items: "{{ vultr_dns_record_items }}"
|
|
@ -2,9 +2,9 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: test remove a dns record in check mode
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: "{{ item.name | default(omit) }}"
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
data: "{{ item.update_data | default(item.data) }}"
|
||||
record_type: "{{ item.record_type | default(omit) }}"
|
||||
multiple: "{{ item.multiple | default(omit) }}"
|
||||
|
@ -22,9 +22,9 @@
|
|||
- result.vultr_dns_record.priority == {{ item.update_priority | default(item.priority | default(0)) }}
|
||||
|
||||
- name: test remove second dns record in check mode
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: "{{ item.name | default(omit) }}"
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
data: "{{ item.data | default(item.data) }}"
|
||||
record_type: "{{ item.record_type | default(omit) }}"
|
||||
multiple: "{{ item.multiple | default(omit) }}"
|
||||
|
@ -44,9 +44,9 @@
|
|||
when: item.multiple is defined and item.multiple == true
|
||||
|
||||
- name: test remove a dns record
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: "{{ item.name | default(omit) }}"
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
data: "{{ item.update_data | default(item.data) }}"
|
||||
record_type: "{{ item.record_type | default(omit) }}"
|
||||
multiple: "{{ item.multiple | default(omit) }}"
|
||||
|
@ -63,9 +63,9 @@
|
|||
- result.vultr_dns_record.priority == {{ item.update_priority | default(item.priority | default(0)) }}
|
||||
|
||||
- name: test remove second dns record
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: "{{ item.name | default(omit) }}"
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
data: "{{ item.data }}"
|
||||
record_type: "{{ item.record_type | default(omit) }}"
|
||||
multiple: "{{ item.multiple | default(omit) }}"
|
||||
|
@ -84,9 +84,9 @@
|
|||
when: item.multiple is defined and item.multiple == true
|
||||
|
||||
- name: test remove a dns record idempotence
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: "{{ item.name | default(omit) }}"
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
data: "{{ item.update_data | default(item.data) }}"
|
||||
record_type: "{{ item.record_type | default(omit) }}"
|
||||
multiple: "{{ item.multiple | default(omit) }}"
|
||||
|
@ -98,9 +98,9 @@
|
|||
- result is not changed
|
||||
|
||||
- name: test remove second dns record idempotence
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: "{{ item.name | default(omit) }}"
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
data: "{{ item.data }}"
|
||||
record_type: "{{ item.record_type | default(omit) }}"
|
||||
multiple: "{{ item.multiple | default(omit) }}"
|
|
@ -2,9 +2,9 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: setup first dns record
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: test-multiple
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
data: 1.2.3.4
|
||||
multiple: yes
|
||||
register: result
|
||||
|
@ -14,9 +14,9 @@
|
|||
- result is successful
|
||||
|
||||
- name: setup second dns record
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: test-multiple
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
data: 1.2.3.5
|
||||
multiple: yes
|
||||
register: result
|
||||
|
@ -26,9 +26,9 @@
|
|||
- result is successful
|
||||
|
||||
- name: test-multiple fail multiple identical records found
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: test-multiple
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
|
@ -38,9 +38,9 @@
|
|||
- result is failed
|
||||
|
||||
- name: test-multiple fail absent multiple identical records but not data
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: test-multiple
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
state: absent
|
||||
multiple: yes
|
||||
register: result
|
||||
|
@ -52,9 +52,9 @@
|
|||
- "result.msg == 'multiple is True but all of the following are missing: data'"
|
||||
|
||||
- name: test-multiple success absent multiple identical records second found
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: test-multiple
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
data: 1.2.3.5
|
||||
state: absent
|
||||
multiple: yes
|
||||
|
@ -65,9 +65,9 @@
|
|||
- result is changed
|
||||
|
||||
- name: test-multiple success absent multiple identical records first found
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: test-multiple
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
data: 1.2.3.4
|
||||
state: absent
|
||||
multiple: yes
|
|
@ -2,9 +2,9 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: test update or add another dns record in check mode
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: "{{ item.name | default(omit) }}"
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
data: "{{ item.update_data | default(item.data) }}"
|
||||
ttl: "{{ item.update_ttl | default(omit) }}"
|
||||
record_type: "{{ item.record_type | default(omit) }}"
|
||||
|
@ -30,9 +30,9 @@
|
|||
when: item.multiple is defined and item.multiple == true
|
||||
|
||||
- name: test update or add another dns record
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: "{{ item.name | default(omit) }}"
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
data: "{{ item.update_data | default(item.data) }}"
|
||||
ttl: "{{ item.update_ttl | default(omit) }}"
|
||||
record_type: "{{ item.record_type | default(omit) }}"
|
||||
|
@ -50,9 +50,9 @@
|
|||
- result.vultr_dns_record.priority == {{ item.update_priority | default(0) }}
|
||||
|
||||
- name: test update or add another dns record idempotence
|
||||
vr_dns_record:
|
||||
vultr_dns_record:
|
||||
name: "{{ item.name | default(omit) }}"
|
||||
domain: "{{ vr_dns_domain_name }}"
|
||||
domain: "{{ vultr_dns_domain_name }}"
|
||||
data: "{{ item.update_data | default(item.data) }}"
|
||||
ttl: "{{ item.update_ttl | default(omit) }}"
|
||||
record_type: "{{ item.record_type | default(omit) }}"
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2018, René Moser <mail@renemoser.net>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
vr_firewall_group_name: ansible-firewall-group
|
||||
vultr_firewall_group_name: ansible-firewall-group
|
|
@ -2,8 +2,8 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: setup
|
||||
vr_firewall_group:
|
||||
name: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_group:
|
||||
name: "{{ vultr_firewall_group_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify setup
|
||||
|
@ -12,7 +12,7 @@
|
|||
- result is success
|
||||
|
||||
- name: test fail if missing name
|
||||
vr_firewall_group:
|
||||
vultr_firewall_group:
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
- name: verify test fail if missing name
|
||||
|
@ -22,8 +22,8 @@
|
|||
- 'result.msg == "missing required arguments: name"'
|
||||
|
||||
- name: test create firewall group in check mode
|
||||
vr_firewall_group:
|
||||
name: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_group:
|
||||
name: "{{ vultr_firewall_group_name }}"
|
||||
register: result
|
||||
check_mode: yes
|
||||
- name: verify test create firewall group in check mode
|
||||
|
@ -32,29 +32,29 @@
|
|||
- result is changed
|
||||
|
||||
- name: test create firewall group
|
||||
vr_firewall_group:
|
||||
name: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_group:
|
||||
name: "{{ vultr_firewall_group_name }}"
|
||||
register: result
|
||||
- name: verify test create firewall group
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_firewall_group.name == '{{ vr_firewall_group_name }}'
|
||||
- result.vultr_firewall_group.name == '{{ vultr_firewall_group_name }}'
|
||||
|
||||
- name: test create firewall group idempotence
|
||||
vr_firewall_group:
|
||||
name: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_group:
|
||||
name: "{{ vultr_firewall_group_name }}"
|
||||
|
||||
register: result
|
||||
- name: verify test create firewall group idempotence
|
||||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
- result.vultr_firewall_group.name == '{{ vr_firewall_group_name }}'
|
||||
- result.vultr_firewall_group.name == '{{ vultr_firewall_group_name }}'
|
||||
|
||||
- name: test absent firewall group in check mode
|
||||
vr_firewall_group:
|
||||
name: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_group:
|
||||
name: "{{ vultr_firewall_group_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
check_mode: yes
|
||||
|
@ -62,22 +62,22 @@
|
|||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_firewall_group.name == '{{ vr_firewall_group_name }}'
|
||||
- result.vultr_firewall_group.name == '{{ vultr_firewall_group_name }}'
|
||||
|
||||
- name: test absent firewall group
|
||||
vr_firewall_group:
|
||||
name: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_group:
|
||||
name: "{{ vultr_firewall_group_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify test absent firewall group
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_firewall_group.name == '{{ vr_firewall_group_name }}'
|
||||
- result.vultr_firewall_group.name == '{{ vultr_firewall_group_name }}'
|
||||
|
||||
- name: test absent firewall group idempotence
|
||||
vr_firewall_group:
|
||||
name: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_group:
|
||||
name: "{{ vultr_firewall_group_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify test absent firewall group idempotence
|
|
@ -2,14 +2,14 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: test gather vultr firewall group facts - empty resources
|
||||
vr_firewall_group_facts:
|
||||
vultr_firewall_group_facts:
|
||||
|
||||
- name: Create the firewall group
|
||||
vr_firewall_group:
|
||||
vultr_firewall_group:
|
||||
name: '{{ firewall_group_name }}'
|
||||
|
||||
- name: test gather vultr firewall group facts in check mode
|
||||
vr_firewall_group_facts:
|
||||
vultr_firewall_group_facts:
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather vultr firewall group facts in check mode
|
||||
|
@ -18,7 +18,7 @@
|
|||
- ansible_facts.vultr_firewall_group_facts|selectattr('description','equalto','{{ firewall_group_name }}') | list | count == 1
|
||||
|
||||
- name: test gather vultr firewall group facts
|
||||
vr_firewall_group_facts:
|
||||
vultr_firewall_group_facts:
|
||||
|
||||
- name: verify test gather vultr firewall group facts
|
||||
assert:
|
||||
|
@ -26,6 +26,6 @@
|
|||
- ansible_facts.vultr_firewall_group_facts|selectattr('description','equalto','{{ firewall_group_name }}') | list | count == 1
|
||||
|
||||
- name: Delete the firewall group
|
||||
vr_firewall_group:
|
||||
vultr_firewall_group:
|
||||
name: '{{ firewall_group_name }}'
|
||||
state: absent
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2018, René Moser <mail@renemoser.net>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
vr_firewall_group_name: ansible-firewall-group
|
||||
vultr_firewall_group_name: ansible-firewall-group
|
|
@ -2,8 +2,8 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: setup firewall group
|
||||
vr_firewall_group:
|
||||
name: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_group:
|
||||
name: "{{ vultr_firewall_group_name }}"
|
||||
register: result
|
||||
- name: verify setup firewall group
|
||||
assert:
|
||||
|
@ -11,8 +11,8 @@
|
|||
- result is success
|
||||
|
||||
- name: setup firewall rule tcp
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
port: 53
|
||||
state: absent
|
||||
register: result
|
||||
|
@ -22,8 +22,8 @@
|
|||
- result is success
|
||||
|
||||
- name: setup firewall rule udp
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
port: 53
|
||||
protocol: udp
|
||||
state: absent
|
||||
|
@ -34,8 +34,8 @@
|
|||
- result is success
|
||||
|
||||
- name: setup firewall rule udp v6
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
port: 53
|
||||
protocol: udp
|
||||
ip_version: v6
|
||||
|
@ -47,8 +47,8 @@
|
|||
- result is success
|
||||
|
||||
- name: setup firewall rule port range
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
start_port: 8000
|
||||
end_port: 8080
|
||||
protocol: tcp
|
||||
|
@ -62,8 +62,8 @@
|
|||
- result is success
|
||||
|
||||
- name: setup firewall rule icmp
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
protocol: icmp
|
||||
state: absent
|
||||
register: result
|
||||
|
@ -73,7 +73,7 @@
|
|||
- result is success
|
||||
|
||||
- name: test fail if missing group
|
||||
vr_firewall_rule:
|
||||
vultr_firewall_rule:
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
- name: verify test fail if missing group
|
||||
|
@ -83,8 +83,8 @@
|
|||
- 'result.msg == "missing required arguments: group"'
|
||||
|
||||
- name: test create firewall rule tcp in check mode
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
port: 53
|
||||
register: result
|
||||
check_mode: true
|
||||
|
@ -94,8 +94,8 @@
|
|||
- result is changed
|
||||
|
||||
- name: test create firewall rule tcp
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
port: 53
|
||||
register: result
|
||||
- name: verify test create firewall rule tcp
|
||||
|
@ -108,8 +108,8 @@
|
|||
- result.vultr_firewall_rule.cidr == "0.0.0.0/0"
|
||||
|
||||
- name: test create firewall rule tcp idempotence
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
port: 53
|
||||
register: result
|
||||
- name: verify test create firewall rule tcp idempotence
|
||||
|
@ -122,8 +122,8 @@
|
|||
- result.vultr_firewall_rule.cidr == "0.0.0.0/0"
|
||||
|
||||
- name: test create firewall rule udp in check mode
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
port: 53
|
||||
protocol: udp
|
||||
register: result
|
||||
|
@ -134,8 +134,8 @@
|
|||
- result is changed
|
||||
|
||||
- name: test create firewall rule udp
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
port: 53
|
||||
protocol: udp
|
||||
register: result
|
||||
|
@ -149,8 +149,8 @@
|
|||
- result.vultr_firewall_rule.cidr == "0.0.0.0/0"
|
||||
|
||||
- name: test create firewall rule udp idempotence
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
port: 53
|
||||
protocol: udp
|
||||
register: result
|
||||
|
@ -164,8 +164,8 @@
|
|||
- result.vultr_firewall_rule.cidr == "0.0.0.0/0"
|
||||
|
||||
- name: test create firewall rule udp v6 in check mode
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
port: 53
|
||||
protocol: udp
|
||||
ip_version: v6
|
||||
|
@ -177,8 +177,8 @@
|
|||
- result is changed
|
||||
|
||||
- name: test create firewall rule udp v6
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
port: 53
|
||||
protocol: udp
|
||||
ip_version: v6
|
||||
|
@ -193,8 +193,8 @@
|
|||
- result.vultr_firewall_rule.cidr == "::/0"
|
||||
|
||||
- name: test create firewall rule udp v6 idempotence
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
port: 53
|
||||
protocol: udp
|
||||
ip_version: v6
|
||||
|
@ -209,8 +209,8 @@
|
|||
- result.vultr_firewall_rule.cidr == "::/0"
|
||||
|
||||
- name: test create firewall rule port range in check mode
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
start_port: 8000
|
||||
end_port: 8080
|
||||
protocol: tcp
|
||||
|
@ -223,8 +223,8 @@
|
|||
- result is changed
|
||||
|
||||
- name: test create firewall rule port range
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
start_port: 8000
|
||||
end_port: 8080
|
||||
protocol: tcp
|
||||
|
@ -241,8 +241,8 @@
|
|||
- result.vultr_firewall_rule.cidr == "10.100.12.0/24"
|
||||
|
||||
- name: test create firewall rule port range idempotence
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
start_port: 8000
|
||||
end_port: 8080
|
||||
protocol: tcp
|
||||
|
@ -259,8 +259,8 @@
|
|||
- result.vultr_firewall_rule.cidr == "10.100.12.0/24"
|
||||
|
||||
- name: test create firewall rule icmp in check mode
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
protocol: icmp
|
||||
register: result
|
||||
check_mode: true
|
||||
|
@ -270,8 +270,8 @@
|
|||
- result is changed
|
||||
|
||||
- name: test create firewall rule icmp
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
protocol: icmp
|
||||
register: result
|
||||
- name: test create firewall rule icmp
|
||||
|
@ -282,8 +282,8 @@
|
|||
- result.vultr_firewall_rule.protocol == "icmp"
|
||||
|
||||
- name: test create firewall rule icmp idempotence
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
protocol: icmp
|
||||
register: result
|
||||
- name: test create firewall rule icmp idempotence
|
||||
|
@ -294,8 +294,8 @@
|
|||
- result.vultr_firewall_rule.protocol == "icmp"
|
||||
|
||||
- name: test remove firewall rule icmp in check mode
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
protocol: icmp
|
||||
state: absent
|
||||
register: result
|
||||
|
@ -308,8 +308,8 @@
|
|||
- result.vultr_firewall_rule.protocol == "icmp"
|
||||
|
||||
- name: test remove firewall rule icmp
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
protocol: icmp
|
||||
state: absent
|
||||
register: result
|
||||
|
@ -321,8 +321,8 @@
|
|||
- result.vultr_firewall_rule.protocol == "icmp"
|
||||
|
||||
- name: test remove firewall rule icmp idempotence
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
protocol: icmp
|
||||
state: absent
|
||||
register: result
|
||||
|
@ -332,8 +332,8 @@
|
|||
- result is not changed
|
||||
|
||||
- name: test remove firewall rule tcp in check mode
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
port: 53
|
||||
state: absent
|
||||
register: result
|
||||
|
@ -348,8 +348,8 @@
|
|||
- result.vultr_firewall_rule.cidr == "0.0.0.0/0"
|
||||
|
||||
- name: test remove firewall rule tcp
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
port: 53
|
||||
state: absent
|
||||
register: result
|
||||
|
@ -363,8 +363,8 @@
|
|||
- result.vultr_firewall_rule.cidr == "0.0.0.0/0"
|
||||
|
||||
- name: test remove firewall rule tcp idempotence
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
port: 53
|
||||
state: absent
|
||||
register: result
|
||||
|
@ -374,8 +374,8 @@
|
|||
- result is not changed
|
||||
|
||||
- name: test remove firewall rule udp v6 in check mode
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
port: 53
|
||||
protocol: udp
|
||||
ip_version: v6
|
||||
|
@ -392,8 +392,8 @@
|
|||
- result.vultr_firewall_rule.cidr == "::/0"
|
||||
|
||||
- name: test remove firewall rule udp v6
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
port: 53
|
||||
protocol: udp
|
||||
ip_version: v6
|
||||
|
@ -409,8 +409,8 @@
|
|||
- result.vultr_firewall_rule.cidr == "::/0"
|
||||
|
||||
- name: test remove firewall rule udp v6 idempotence
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
port: 53
|
||||
protocol: udp
|
||||
ip_version: v6
|
||||
|
@ -422,8 +422,8 @@
|
|||
- result is not changed
|
||||
|
||||
- name: test remove firewall rule port range in check mode
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
start_port: 8000
|
||||
end_port: 8080
|
||||
protocol: tcp
|
||||
|
@ -442,8 +442,8 @@
|
|||
- result.vultr_firewall_rule.cidr == "10.100.12.0/24"
|
||||
|
||||
- name: test remove firewall rule port range
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
start_port: 8000
|
||||
end_port: 8080
|
||||
protocol: tcp
|
||||
|
@ -461,8 +461,8 @@
|
|||
- result.vultr_firewall_rule.cidr == "10.100.12.0/24"
|
||||
|
||||
- name: test remove firewall rule port range idempotence
|
||||
vr_firewall_rule:
|
||||
group: "{{ vr_firewall_group_name }}"
|
||||
vultr_firewall_rule:
|
||||
group: "{{ vultr_firewall_group_name }}"
|
||||
start_port: 8000
|
||||
end_port: 8080
|
||||
protocol: tcp
|
|
@ -2,7 +2,7 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: test gather vultr os facts in check mode
|
||||
vr_os_facts:
|
||||
vultr_os_facts:
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather vultr os facts in check mode
|
||||
|
@ -11,7 +11,7 @@
|
|||
- ansible_facts.vultr_os_facts|selectattr('name','equalto', 'CentOS 7 x64') | list | count == 1
|
||||
|
||||
- name: test gather vultr os fact
|
||||
vr_os_facts:
|
||||
vultr_os_facts:
|
||||
|
||||
- name: verify test gather vultr os facts
|
||||
assert:
|
|
@ -2,7 +2,7 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: test gather vultr plan facts in check mode
|
||||
vr_plan_facts:
|
||||
vultr_plan_facts:
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather vultr plan facts in check mode
|
||||
|
@ -11,7 +11,7 @@
|
|||
- ansible_facts.vultr_plan_facts|selectattr('name','equalto','16384 MB RAM,110 GB SSD,20.00 TB BW') | list | count == 1
|
||||
|
||||
- name: test gather vultr plan fact
|
||||
vr_plan_facts:
|
||||
vultr_plan_facts:
|
||||
|
||||
- name: verify test gather vultr plan facts
|
||||
assert:
|
|
@ -2,7 +2,7 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: test gather vultr region facts in check mode
|
||||
vr_region_facts:
|
||||
vultr_region_facts:
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather vultr region facts in check mode
|
||||
|
@ -11,7 +11,7 @@
|
|||
- ansible_facts.vultr_region_facts|selectattr('name','equalto','Atlanta') | list | count == 1
|
||||
|
||||
- name: test gather vultr region facts
|
||||
vr_region_facts:
|
||||
vultr_region_facts:
|
||||
|
||||
- name: verify test gather vultr region facts
|
||||
assert:
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2018, René Moser <mail@renemoser.net>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
vr_server_name: ansible-test-vm1
|
||||
vultr_server_name: ansible-test-vm1
|
|
@ -2,8 +2,8 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: setup
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify setup
|
||||
|
@ -12,7 +12,7 @@
|
|||
- result is success
|
||||
|
||||
- name: test fail if missing name
|
||||
vr_server:
|
||||
vultr_server:
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
- name: verify test fail if missing name
|
||||
|
@ -22,8 +22,8 @@
|
|||
- 'result.msg == "missing required arguments: name"'
|
||||
|
||||
- name: test fail if missing params for state=present
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
- name: verify fail if missing params for state=present
|
||||
|
@ -33,8 +33,8 @@
|
|||
- 'result.msg == "missing required arguments: os, plan, region"'
|
||||
|
||||
- name: test create server in check mode
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
os: CentOS 6 x64
|
||||
plan: 1024 MB RAM,25 GB SSD,1.00 TB BW
|
||||
region: Amsterdam
|
||||
|
@ -47,8 +47,8 @@
|
|||
- result is changed
|
||||
|
||||
- name: test create server
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
os: CentOS 6 x64
|
||||
plan: 1024 MB RAM,25 GB SSD,1.00 TB BW
|
||||
region: Amsterdam
|
||||
|
@ -58,15 +58,15 @@
|
|||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.plan == '1024 MB RAM,25 GB SSD,1.00 TB BW'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
- result.vultr_server.power_status == 'running'
|
||||
|
||||
- name: test create server idempotence
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
os: CentOS 6 x64
|
||||
plan: 1024 MB RAM,25 GB SSD,1.00 TB BW
|
||||
region: Amsterdam
|
||||
|
@ -77,14 +77,14 @@
|
|||
that:
|
||||
- result is not changed
|
||||
- result.vultr_server.power_status == 'running'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.plan == '1024 MB RAM,25 GB SSD,1.00 TB BW'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
|
||||
- name: test stop an existing server in check mode
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
state: stopped
|
||||
register: result
|
||||
check_mode: yes
|
||||
|
@ -93,13 +93,13 @@
|
|||
that:
|
||||
- result is changed
|
||||
- result.vultr_server.power_status == 'running'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
|
||||
- name: test stop an existing server
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
state: stopped
|
||||
register: result
|
||||
- name: verify test stop an existing server
|
||||
|
@ -107,13 +107,13 @@
|
|||
that:
|
||||
- result is changed
|
||||
- result.vultr_server.power_status == 'stopped'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
|
||||
- name: test stop an existing server idempotence
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
state: stopped
|
||||
register: result
|
||||
- name: verify test stop an existing server idempotence
|
||||
|
@ -121,13 +121,13 @@
|
|||
that:
|
||||
- result is not changed
|
||||
- result.vultr_server.power_status == 'stopped'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
|
||||
- name: test start an existing server in check mode
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
state: started
|
||||
register: result
|
||||
check_mode: yes
|
||||
|
@ -136,13 +136,13 @@
|
|||
that:
|
||||
- result is changed
|
||||
- result.vultr_server.power_status == 'stopped'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
|
||||
- name: test start an existing server
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
state: started
|
||||
register: result
|
||||
- name: verify test start an existing server
|
||||
|
@ -150,13 +150,13 @@
|
|||
that:
|
||||
- result is changed
|
||||
- result.vultr_server.power_status == 'running'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
|
||||
- name: test start an existing server idempotence
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
state: started
|
||||
register: result
|
||||
- name: verify test start an existing server idempotence
|
||||
|
@ -164,13 +164,13 @@
|
|||
that:
|
||||
- result is not changed
|
||||
- result.vultr_server.power_status == 'running'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
|
||||
- name: test update plan for server in check mode without force
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
os: CentOS 6 x64
|
||||
plan: 2048 MB RAM,40 GB SSD,2.00 TB BW
|
||||
region: Amsterdam
|
||||
|
@ -181,14 +181,14 @@
|
|||
that:
|
||||
- result is not changed
|
||||
- result.vultr_server.power_status == 'running'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.plan == '1024 MB RAM,25 GB SSD,1.00 TB BW'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
|
||||
- name: test update plan for server without force
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
os: CentOS 6 x64
|
||||
plan: 2048 MB RAM,40 GB SSD,2.00 TB BW
|
||||
region: Amsterdam
|
||||
|
@ -198,13 +198,13 @@
|
|||
that:
|
||||
- result is not changed
|
||||
- result.vultr_server.power_status == 'running'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.plan == '1024 MB RAM,25 GB SSD,1.00 TB BW'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
|
||||
- name: setup firewall group
|
||||
vr_firewall_group:
|
||||
vultr_firewall_group:
|
||||
name: test_firewall_group
|
||||
register: result
|
||||
- name: verify test create firewall group
|
||||
|
@ -213,8 +213,8 @@
|
|||
- result is success
|
||||
|
||||
- name: test fail with unknown firewall group
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
os: CentOS 6 x64
|
||||
region: Amsterdam
|
||||
firewall_group: does not exist
|
||||
|
@ -229,8 +229,8 @@
|
|||
- result.msg.startswith('Could not find')
|
||||
|
||||
- name: test update tag, firewall group for server in check mode without force
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
os: CentOS 6 x64
|
||||
region: Amsterdam
|
||||
firewall_group: test_firewall_group
|
||||
|
@ -242,7 +242,7 @@
|
|||
that:
|
||||
- result is changed
|
||||
- result.vultr_server.power_status == 'running'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.plan == '1024 MB RAM,25 GB SSD,1.00 TB BW'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
|
@ -250,8 +250,8 @@
|
|||
- result.vultr_server.firewall_group != 'test_firewall_group'
|
||||
|
||||
- name: test update tag, firewall group for server without force
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
os: CentOS 6 x64
|
||||
region: Amsterdam
|
||||
firewall_group: test_firewall_group
|
||||
|
@ -262,15 +262,15 @@
|
|||
that:
|
||||
- result is changed
|
||||
- result.vultr_server.power_status == 'running'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
- result.vultr_server.tag == 'test_tag'
|
||||
- result.vultr_server.firewall_group == 'test_firewall_group'
|
||||
|
||||
- name: test update tag, firewall group for server without force idempotence
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
os: CentOS 6 x64
|
||||
region: Amsterdam
|
||||
firewall_group: test_firewall_group
|
||||
|
@ -281,15 +281,15 @@
|
|||
that:
|
||||
- result is not changed
|
||||
- result.vultr_server.power_status == 'running'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
- result.vultr_server.tag == 'test_tag'
|
||||
- result.vultr_server.firewall_group == 'test_firewall_group'
|
||||
|
||||
- name: test update server in check mode with force
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
os: CentOS 6 x64
|
||||
plan: 2048 MB RAM,40 GB SSD,2.00 TB BW
|
||||
auto_backup_enabled: yes
|
||||
|
@ -302,15 +302,15 @@
|
|||
that:
|
||||
- result is changed
|
||||
- result.vultr_server.power_status == 'running'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.plan == '1024 MB RAM,25 GB SSD,1.00 TB BW'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
- result.vultr_server.auto_backup_enabled == false
|
||||
|
||||
- name: test update server with force
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
os: CentOS 6 x64
|
||||
plan: 2048 MB RAM,40 GB SSD,2.00 TB BW
|
||||
auto_backup_enabled: yes
|
||||
|
@ -322,15 +322,15 @@
|
|||
that:
|
||||
- result is changed
|
||||
- result.vultr_server.power_status == 'running'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.plan == '2048 MB RAM,40 GB SSD,2.00 TB BW'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
- result.vultr_server.auto_backup_enabled == true
|
||||
|
||||
- name: test update server idempotence with force
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
os: CentOS 6 x64
|
||||
plan: 2048 MB RAM,40 GB SSD,2.00 TB BW
|
||||
auto_backup_enabled: true
|
||||
|
@ -342,15 +342,15 @@
|
|||
that:
|
||||
- result is not changed
|
||||
- result.vultr_server.power_status == 'running'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.plan == '2048 MB RAM,40 GB SSD,2.00 TB BW'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
- result.vultr_server.auto_backup_enabled == true
|
||||
|
||||
- name: test update server to stopped in check mode
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
os: CentOS 6 x64
|
||||
plan: 2048 MB RAM,40 GB SSD,2.00 TB BW
|
||||
ipv6_enabled: true
|
||||
|
@ -363,15 +363,15 @@
|
|||
that:
|
||||
- result is changed
|
||||
- result.vultr_server.power_status == 'running'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.plan == '2048 MB RAM,40 GB SSD,2.00 TB BW'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
- result.vultr_server.v6_main_ip == ''
|
||||
|
||||
- name: test update server to stopped
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
os: CentOS 6 x64
|
||||
plan: 2048 MB RAM,40 GB SSD,2.00 TB BW
|
||||
ipv6_enabled: true
|
||||
|
@ -383,15 +383,15 @@
|
|||
that:
|
||||
- result is changed
|
||||
- result.vultr_server.power_status == 'stopped'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.plan == '2048 MB RAM,40 GB SSD,2.00 TB BW'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
- result.vultr_server.v6_main_ip != ''
|
||||
|
||||
- name: test update server to stopped idempotence
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
os: CentOS 6 x64
|
||||
plan: 2048 MB RAM,40 GB SSD,2.00 TB BW
|
||||
region: Amsterdam
|
||||
|
@ -402,15 +402,15 @@
|
|||
that:
|
||||
- result is not changed
|
||||
- result.vultr_server.power_status == 'stopped'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.plan == '2048 MB RAM,40 GB SSD,2.00 TB BW'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
- result.vultr_server.v6_main_ip != ''
|
||||
|
||||
- name: test restart an existing server in check mode
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
state: restarted
|
||||
register: result
|
||||
check_mode: yes
|
||||
|
@ -419,13 +419,13 @@
|
|||
that:
|
||||
- result is changed
|
||||
- result.vultr_server.power_status == 'stopped'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
|
||||
- name: test restart an existing server
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
state: restarted
|
||||
register: result
|
||||
- name: verify test restart an existing server
|
||||
|
@ -433,13 +433,13 @@
|
|||
that:
|
||||
- result is changed
|
||||
- result.vultr_server.power_status == 'running'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
|
||||
- name: test absent server in check mode
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
check_mode: yes
|
||||
|
@ -448,7 +448,7 @@
|
|||
that:
|
||||
- result is changed
|
||||
- result.vultr_server.power_status == 'running'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
|
||||
|
@ -457,8 +457,8 @@
|
|||
local_action: wait_for
|
||||
|
||||
- name: test absent server
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify test absent server
|
||||
|
@ -466,13 +466,13 @@
|
|||
that:
|
||||
- result is changed
|
||||
- result.vultr_server.power_status == 'running'
|
||||
- result.vultr_server.name == '{{ vr_server_name }}'
|
||||
- result.vultr_server.name == '{{ vultr_server_name }}'
|
||||
- result.vultr_server.os == 'CentOS 6 x64'
|
||||
- result.vultr_server.region == 'Amsterdam'
|
||||
|
||||
- name: test absent server idempotence
|
||||
vr_server:
|
||||
name: "{{ vr_server_name }}"
|
||||
vultr_server:
|
||||
name: "{{ vultr_server_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify test absent server idempotence
|
6
test/legacy/roles/vultr_ssh_key/defaults/main.yml
Normal file
6
test/legacy/roles/vultr_ssh_key/defaults/main.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Copyright (c) 2018, René Moser <mail@renemoser.net>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
vultr_ssh_key_name: ansible-ssh-key
|
||||
vultr_ssh_key: "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAyWYItY+3w5b8PdGRoz0oY5mufqydW96naE+VM3JSvJFAUS08rAjQQpQ03ymoALeHQy6JVZbcgecxn6p0pAOINQdqufn4udPtOPCtMjNiPGpkSM9ah/6X5+kvyWMNrvlf+Ld4OOoszP5sAkgQzIbrFQAm41XknBUha0zkewZwfrVhain4pnDjV7wCcChId/Q/Gbi4xMtXkisznWcAJcueBs3EEZDKhJ5q0VeWSJEhYJDLFN1sOxF0AIUnMrOhfKQ/LjgREXPB6uCl899INUTXRNNjRpeMXyJ2wMMmOAbua2qEd1r13Bu1n+6A823Hzb33fyMXuqWnJwBJ4DCvMlGuEsfuOK+xk7DaBfLHbcM6fsPk0/4psTE6YLgC41remr6+u5ZWsY/faMtSnNPie8Z8Ov0DIYGdhbJjUXk1HomxRV9+ZfZ2Ob8iCwlaAQAyEUM6fs3Kxt8pBD8dx1HOkhsfBWPvuDr5y+kqE7H8/MuPDTc0QgH2pjUMpmw/XBwNDHshVEjrZvtICOjOLUJxcowLO1ivNYwPwowQxfisMy56LfYdjsOslBiqsrkAqvNGm1zu8wKHeqVN9w5l3yUELpvubfm9NKIvYcl6yWF36T0c5vE+g0DU/Jy4XpTj0hZG9QV2mRQcLJnd2pxQtJT7cPFtrn/+tgRxzjEtbDXummDV4sE= ansible@example.com"
|
||||
vultr_ssh_key2: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCoQ9S7V+CufAgwoehnf2TqsJ9LTsu8pUA3FgpS2mdVwcMcTs++8P5sQcXHLtDmNLpWN4k7NQgxaY1oXy5e25x/4VhXaJXWEt3luSw+Phv/PB2+aGLvqCUirsLTAD2r7ieMhd/pcVf/HlhNUQgnO1mupdbDyqZoGD/uCcJiYav8i/V7nJWJouHA8yq31XS2yqXp9m3VC7UZZHzUsVJA9Us5YqF0hKYeaGruIHR2bwoDF9ZFMss5t6/pzxMljU/ccYwvvRDdI7WX4o4+zLuZ6RWvsU6LGbbb0pQdB72tlV41fSefwFsk4JRdKbyV3Xjf25pV4IXOTcqhy+4JTB/jXxrF torwalds@github.com"
|
|
@ -2,8 +2,8 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: setup
|
||||
vr_ssh_key:
|
||||
name: "{{ vr_ssh_key_name }}"
|
||||
vultr_ssh_key:
|
||||
name: "{{ vultr_ssh_key_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify setup
|
||||
|
@ -12,7 +12,7 @@
|
|||
- result is success
|
||||
|
||||
- name: test fail if missing name
|
||||
vr_ssh_key:
|
||||
vultr_ssh_key:
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
- name: verify test fail if missing name
|
||||
|
@ -22,8 +22,8 @@
|
|||
- 'result.msg == "missing required arguments: name"'
|
||||
|
||||
- name: test fail if missing params for state=present
|
||||
vr_ssh_key:
|
||||
name: "{{ vr_ssh_key_name }}"
|
||||
vultr_ssh_key:
|
||||
name: "{{ vultr_ssh_key_name }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
- name: verify fail if missing params for state=present
|
||||
|
@ -33,9 +33,9 @@
|
|||
- 'result.msg == "state is present but all of the following are missing: ssh_key"'
|
||||
|
||||
- name: test create ssh key in check mode
|
||||
vr_ssh_key:
|
||||
name: "{{ vr_ssh_key_name }}"
|
||||
ssh_key: "{{ vr_ssh_key }}"
|
||||
vultr_ssh_key:
|
||||
name: "{{ vultr_ssh_key_name }}"
|
||||
ssh_key: "{{ vultr_ssh_key }}"
|
||||
register: result
|
||||
check_mode: yes
|
||||
- name: verify test create ssh key in check mode
|
||||
|
@ -44,69 +44,69 @@
|
|||
- result is changed
|
||||
|
||||
- name: test create ssh key
|
||||
vr_ssh_key:
|
||||
name: "{{ vr_ssh_key_name }}"
|
||||
ssh_key: "{{ vr_ssh_key }}"
|
||||
vultr_ssh_key:
|
||||
name: "{{ vultr_ssh_key_name }}"
|
||||
ssh_key: "{{ vultr_ssh_key }}"
|
||||
register: result
|
||||
- name: verify test create ssh key
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_ssh_key.name == '{{ vr_ssh_key_name }}'
|
||||
- result.vultr_ssh_key.ssh_key == '{{ vr_ssh_key }}'
|
||||
- result.vultr_ssh_key.name == '{{ vultr_ssh_key_name }}'
|
||||
- result.vultr_ssh_key.ssh_key == '{{ vultr_ssh_key }}'
|
||||
|
||||
- name: test create ssh key idempotence
|
||||
vr_ssh_key:
|
||||
name: "{{ vr_ssh_key_name }}"
|
||||
ssh_key: "{{ vr_ssh_key }}"
|
||||
vultr_ssh_key:
|
||||
name: "{{ vultr_ssh_key_name }}"
|
||||
ssh_key: "{{ vultr_ssh_key }}"
|
||||
register: result
|
||||
- name: verify test create ssh key idempotence
|
||||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
- result.vultr_ssh_key.name == '{{ vr_ssh_key_name }}'
|
||||
- result.vultr_ssh_key.ssh_key == '{{ vr_ssh_key }}'
|
||||
- result.vultr_ssh_key.name == '{{ vultr_ssh_key_name }}'
|
||||
- result.vultr_ssh_key.ssh_key == '{{ vultr_ssh_key }}'
|
||||
|
||||
- name: test update ssh key in check mode
|
||||
vr_ssh_key:
|
||||
name: "{{ vr_ssh_key_name }}"
|
||||
ssh_key: "{{ vr_ssh_key2 }}"
|
||||
vultr_ssh_key:
|
||||
name: "{{ vultr_ssh_key_name }}"
|
||||
ssh_key: "{{ vultr_ssh_key2 }}"
|
||||
register: result
|
||||
check_mode: yes
|
||||
- name: verify test update ssh key in check mode
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_ssh_key.name == '{{ vr_ssh_key_name }}'
|
||||
- result.vultr_ssh_key.ssh_key == '{{ vr_ssh_key }}'
|
||||
- result.vultr_ssh_key.name == '{{ vultr_ssh_key_name }}'
|
||||
- result.vultr_ssh_key.ssh_key == '{{ vultr_ssh_key }}'
|
||||
|
||||
- name: test update ssh key
|
||||
vr_ssh_key:
|
||||
name: "{{ vr_ssh_key_name }}"
|
||||
ssh_key: "{{ vr_ssh_key2 }}"
|
||||
vultr_ssh_key:
|
||||
name: "{{ vultr_ssh_key_name }}"
|
||||
ssh_key: "{{ vultr_ssh_key2 }}"
|
||||
register: result
|
||||
- name: verify test update ssh key
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_ssh_key.name == '{{ vr_ssh_key_name }}'
|
||||
- result.vultr_ssh_key.ssh_key == '{{ vr_ssh_key2 }}'
|
||||
- result.vultr_ssh_key.name == '{{ vultr_ssh_key_name }}'
|
||||
- result.vultr_ssh_key.ssh_key == '{{ vultr_ssh_key2 }}'
|
||||
|
||||
- name: test update ssh key idempotence
|
||||
vr_ssh_key:
|
||||
name: "{{ vr_ssh_key_name }}"
|
||||
ssh_key: "{{ vr_ssh_key2 }}"
|
||||
vultr_ssh_key:
|
||||
name: "{{ vultr_ssh_key_name }}"
|
||||
ssh_key: "{{ vultr_ssh_key2 }}"
|
||||
register: result
|
||||
- name: verify test update ssh key idempotence
|
||||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
- result.vultr_ssh_key.name == '{{ vr_ssh_key_name }}'
|
||||
- result.vultr_ssh_key.ssh_key == '{{ vr_ssh_key2 }}'
|
||||
- result.vultr_ssh_key.name == '{{ vultr_ssh_key_name }}'
|
||||
- result.vultr_ssh_key.ssh_key == '{{ vultr_ssh_key2 }}'
|
||||
|
||||
- name: test absent ssh key in check mode
|
||||
vr_ssh_key:
|
||||
name: "{{ vr_ssh_key_name }}"
|
||||
vultr_ssh_key:
|
||||
name: "{{ vultr_ssh_key_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
check_mode: yes
|
||||
|
@ -114,24 +114,24 @@
|
|||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_ssh_key.name == '{{ vr_ssh_key_name }}'
|
||||
- result.vultr_ssh_key.ssh_key == '{{ vr_ssh_key2 }}'
|
||||
- result.vultr_ssh_key.name == '{{ vultr_ssh_key_name }}'
|
||||
- result.vultr_ssh_key.ssh_key == '{{ vultr_ssh_key2 }}'
|
||||
|
||||
- name: test absent ssh key
|
||||
vr_ssh_key:
|
||||
name: "{{ vr_ssh_key_name }}"
|
||||
vultr_ssh_key:
|
||||
name: "{{ vultr_ssh_key_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify test absent ssh key
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_ssh_key.name == '{{ vr_ssh_key_name }}'
|
||||
- result.vultr_ssh_key.ssh_key == '{{ vr_ssh_key2 }}'
|
||||
- result.vultr_ssh_key.name == '{{ vultr_ssh_key_name }}'
|
||||
- result.vultr_ssh_key.ssh_key == '{{ vultr_ssh_key2 }}'
|
||||
|
||||
- name: test absent ssh key idempotence
|
||||
vr_ssh_key:
|
||||
name: "{{ vr_ssh_key_name }}"
|
||||
vultr_ssh_key:
|
||||
name: "{{ vultr_ssh_key_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify test absent ssh key idempotence
|
|
@ -2,15 +2,15 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: test gather vultr ssh key fact - empty resources
|
||||
vr_ssh_key_facts:
|
||||
vultr_ssh_key_facts:
|
||||
|
||||
- name: Upload an ssh key
|
||||
vr_ssh_key:
|
||||
vultr_ssh_key:
|
||||
name: '{{ ssh_key_name }}'
|
||||
ssh_key: '{{ ssh_key_content }}'
|
||||
|
||||
- name: test gather vultr ssh key facts in check mode
|
||||
vr_ssh_key_facts:
|
||||
vultr_ssh_key_facts:
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather vultr ssh key facts in check mode
|
||||
|
@ -20,7 +20,7 @@
|
|||
- ansible_facts.vultr_ssh_key_facts|selectattr('ssh_key','equalto','{{ ssh_key_content }}') | list | count == 1
|
||||
|
||||
- name: test gather vultr ssh key fact
|
||||
vr_ssh_key_facts:
|
||||
vultr_ssh_key_facts:
|
||||
|
||||
- name: verify test gather vultr ssh key facts
|
||||
assert:
|
||||
|
@ -29,6 +29,6 @@
|
|||
- ansible_facts.vultr_ssh_key_facts|selectattr('ssh_key','equalto','{{ ssh_key_content }}') | list | count == 1
|
||||
|
||||
- name: Destroy the ssh key
|
||||
vr_ssh_key:
|
||||
vultr_ssh_key:
|
||||
name: ansibletest-sshkey
|
||||
state: absent
|
6
test/legacy/roles/vultr_startup_script/defaults/main.yml
Normal file
6
test/legacy/roles/vultr_startup_script/defaults/main.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Copyright (c) 2018, René Moser <mail@renemoser.net>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
vultr_startup_script_name: ansible_test_script
|
||||
vultr_startup_script: "#!/bin/bash\necho Hello World > /root/hello"
|
||||
vultr_startup_script2: "#!/bin/bash\necho Hello to my World > /root/hello"
|
|
@ -2,8 +2,8 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: setup
|
||||
vr_startup_script:
|
||||
name: "{{ vr_startup_script_name }}"
|
||||
vultr_startup_script:
|
||||
name: "{{ vultr_startup_script_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify setup
|
||||
|
@ -12,7 +12,7 @@
|
|||
- result is success
|
||||
|
||||
- name: test fail if missing name
|
||||
vr_startup_script:
|
||||
vultr_startup_script:
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
- name: verify test fail if missing name
|
||||
|
@ -22,8 +22,8 @@
|
|||
- 'result.msg == "missing required arguments: name"'
|
||||
|
||||
- name: test fail if missing params for state=present
|
||||
vr_startup_script:
|
||||
name: "{{ vr_startup_script_name }}"
|
||||
vultr_startup_script:
|
||||
name: "{{ vultr_startup_script_name }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
- name: verify fail if missing params for state=present
|
||||
|
@ -33,9 +33,9 @@
|
|||
- 'result.msg == "state is present but all of the following are missing: script"'
|
||||
|
||||
- name: test create startup script in check mode
|
||||
vr_startup_script:
|
||||
name: "{{ vr_startup_script_name }}"
|
||||
script: "{{ vr_startup_script }}"
|
||||
vultr_startup_script:
|
||||
name: "{{ vultr_startup_script_name }}"
|
||||
script: "{{ vultr_startup_script }}"
|
||||
register: result
|
||||
check_mode: yes
|
||||
- name: verify test create startup script in check mode
|
||||
|
@ -44,69 +44,69 @@
|
|||
- result is changed
|
||||
|
||||
- name: test create startup script
|
||||
vr_startup_script:
|
||||
name: "{{ vr_startup_script_name }}"
|
||||
script: "{{ vr_startup_script }}"
|
||||
vultr_startup_script:
|
||||
name: "{{ vultr_startup_script_name }}"
|
||||
script: "{{ vultr_startup_script }}"
|
||||
register: result
|
||||
- name: verify test create startup script
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_startup_script.name == '{{ vr_startup_script_name }}'
|
||||
- result.vultr_startup_script.script == '{{ vr_startup_script }}'
|
||||
- result.vultr_startup_script.name == '{{ vultr_startup_script_name }}'
|
||||
- result.vultr_startup_script.script == '{{ vultr_startup_script }}'
|
||||
|
||||
- name: test create startup script idempotence
|
||||
vr_startup_script:
|
||||
name: "{{ vr_startup_script_name }}"
|
||||
script: "{{ vr_startup_script }}"
|
||||
vultr_startup_script:
|
||||
name: "{{ vultr_startup_script_name }}"
|
||||
script: "{{ vultr_startup_script }}"
|
||||
register: result
|
||||
- name: verify test create startup script idempotence
|
||||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
- result.vultr_startup_script.name == '{{ vr_startup_script_name }}'
|
||||
- result.vultr_startup_script.script == '{{ vr_startup_script }}'
|
||||
- result.vultr_startup_script.name == '{{ vultr_startup_script_name }}'
|
||||
- result.vultr_startup_script.script == '{{ vultr_startup_script }}'
|
||||
|
||||
- name: test update startup script in check mode
|
||||
vr_startup_script:
|
||||
name: "{{ vr_startup_script_name }}"
|
||||
script: "{{ vr_startup_script2 }}"
|
||||
vultr_startup_script:
|
||||
name: "{{ vultr_startup_script_name }}"
|
||||
script: "{{ vultr_startup_script2 }}"
|
||||
register: result
|
||||
check_mode: yes
|
||||
- name: verify test update startup script in check mode
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_startup_script.name == '{{ vr_startup_script_name }}'
|
||||
- result.vultr_startup_script.script == '{{ vr_startup_script }}'
|
||||
- result.vultr_startup_script.name == '{{ vultr_startup_script_name }}'
|
||||
- result.vultr_startup_script.script == '{{ vultr_startup_script }}'
|
||||
|
||||
- name: test update startup script
|
||||
vr_startup_script:
|
||||
name: "{{ vr_startup_script_name }}"
|
||||
script: "{{ vr_startup_script2 }}"
|
||||
vultr_startup_script:
|
||||
name: "{{ vultr_startup_script_name }}"
|
||||
script: "{{ vultr_startup_script2 }}"
|
||||
register: result
|
||||
- name: verify test update startup script
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_startup_script.name == '{{ vr_startup_script_name }}'
|
||||
- result.vultr_startup_script.script == '{{ vr_startup_script2 }}'
|
||||
- result.vultr_startup_script.name == '{{ vultr_startup_script_name }}'
|
||||
- result.vultr_startup_script.script == '{{ vultr_startup_script2 }}'
|
||||
|
||||
- name: test update startup script idempotence
|
||||
vr_startup_script:
|
||||
name: "{{ vr_startup_script_name }}"
|
||||
script: "{{ vr_startup_script2 }}"
|
||||
vultr_startup_script:
|
||||
name: "{{ vultr_startup_script_name }}"
|
||||
script: "{{ vultr_startup_script2 }}"
|
||||
register: result
|
||||
- name: verify test update startup script idempotence
|
||||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
- result.vultr_startup_script.name == '{{ vr_startup_script_name }}'
|
||||
- result.vultr_startup_script.script == '{{ vr_startup_script2 }}'
|
||||
- result.vultr_startup_script.name == '{{ vultr_startup_script_name }}'
|
||||
- result.vultr_startup_script.script == '{{ vultr_startup_script2 }}'
|
||||
|
||||
- name: test absent startup script in check mode
|
||||
vr_startup_script:
|
||||
name: "{{ vr_startup_script_name }}"
|
||||
vultr_startup_script:
|
||||
name: "{{ vultr_startup_script_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
check_mode: yes
|
||||
|
@ -114,24 +114,24 @@
|
|||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_startup_script.name == '{{ vr_startup_script_name }}'
|
||||
- result.vultr_startup_script.script == '{{ vr_startup_script2 }}'
|
||||
- result.vultr_startup_script.name == '{{ vultr_startup_script_name }}'
|
||||
- result.vultr_startup_script.script == '{{ vultr_startup_script2 }}'
|
||||
|
||||
- name: test absent startup script
|
||||
vr_startup_script:
|
||||
name: "{{ vr_startup_script_name }}"
|
||||
vultr_startup_script:
|
||||
name: "{{ vultr_startup_script_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify test absent startup script
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_startup_script.name == '{{ vr_startup_script_name }}'
|
||||
- result.vultr_startup_script.script == '{{ vr_startup_script2 }}'
|
||||
- result.vultr_startup_script.name == '{{ vultr_startup_script_name }}'
|
||||
- result.vultr_startup_script.script == '{{ vultr_startup_script2 }}'
|
||||
|
||||
- name: test absent startup script idempotence
|
||||
vr_startup_script:
|
||||
name: "{{ vr_startup_script_name }}"
|
||||
vultr_startup_script:
|
||||
name: "{{ vultr_startup_script_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify test absent startup script idempotence
|
|
@ -2,16 +2,16 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: test gather vultr startup script facts - empty resources
|
||||
vr_startup_script_facts:
|
||||
vultr_startup_script_facts:
|
||||
|
||||
- name: Create the script
|
||||
vr_startup_script:
|
||||
vultr_startup_script:
|
||||
name: '{{ startup_script_name }}'
|
||||
script_type: '{{ startup_script_type }}'
|
||||
script: '{{ startup_script_content }}'
|
||||
|
||||
- name: test gather vultr startup script facts in check mode
|
||||
vr_startup_script_facts:
|
||||
vultr_startup_script_facts:
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather vultr startup script facts in check mode
|
||||
|
@ -20,7 +20,7 @@
|
|||
- ansible_facts.vultr_startup_script_facts|selectattr('name','equalto','{{ startup_script_name }}') | list | count == 1
|
||||
|
||||
- name: test gather vultr startup script facts
|
||||
vr_startup_script_facts:
|
||||
vultr_startup_script_facts:
|
||||
|
||||
- name: verify test gather vultr startup script facts
|
||||
assert:
|
||||
|
@ -28,6 +28,6 @@
|
|||
- ansible_facts.vultr_startup_script_facts|selectattr('name','equalto','{{ startup_script_name }}') | list | count == 1
|
||||
|
||||
- name: Delete the script
|
||||
vr_startup_script:
|
||||
vultr_startup_script:
|
||||
name: '{{ startup_script_name }}'
|
||||
state: absent
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2018, René Moser <mail@renemoser.net>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
vr_user_name: john
|
||||
vultr_user_name: john
|
|
@ -2,8 +2,8 @@
|
|||
# Copyright (c) 2018, René Moser <mail@renemoser.net>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
- name: setup
|
||||
vr_user:
|
||||
name: "{{ vr_user_name }}"
|
||||
vultr_user:
|
||||
name: "{{ vultr_user_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify setup
|
||||
|
@ -12,7 +12,7 @@
|
|||
- result is success
|
||||
|
||||
- name: test fail if missing name
|
||||
vr_user:
|
||||
vultr_user:
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
- name: verify test fail if missing name
|
||||
|
@ -22,8 +22,8 @@
|
|||
- 'result.msg == "missing required arguments: name"'
|
||||
|
||||
- name: test fail if missing params for state=present
|
||||
vr_user:
|
||||
name: "{{ vr_user_name }}"
|
||||
vultr_user:
|
||||
name: "{{ vultr_user_name }}"
|
||||
register: result
|
||||
ignore_errors: yes
|
||||
- name: verify fail if missing params for state=present
|
||||
|
@ -33,8 +33,8 @@
|
|||
- 'result.msg.startswith("state is present but all of the following are missing")'
|
||||
|
||||
- name: test fail param not in choices
|
||||
vr_user:
|
||||
name: "{{ vr_user_name }}"
|
||||
vultr_user:
|
||||
name: "{{ vultr_user_name }}"
|
||||
email: john.doe@example.com
|
||||
password: s3cr3t
|
||||
acls:
|
||||
|
@ -50,8 +50,8 @@
|
|||
- 'result.msg.startswith("value of acls must be one or more of")'
|
||||
|
||||
- name: test create user in check mode
|
||||
vr_user:
|
||||
name: "{{ vr_user_name }}"
|
||||
vultr_user:
|
||||
name: "{{ vultr_user_name }}"
|
||||
email: john.doe@example.com
|
||||
password: s3cr3t
|
||||
acls:
|
||||
|
@ -66,8 +66,8 @@
|
|||
- result is changed
|
||||
|
||||
- name: test create user
|
||||
vr_user:
|
||||
name: "{{ vr_user_name }}"
|
||||
vultr_user:
|
||||
name: "{{ vultr_user_name }}"
|
||||
email: john.doe@example.com
|
||||
password: s3cr3t
|
||||
acls:
|
||||
|
@ -79,7 +79,7 @@
|
|||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_user.name == '{{ vr_user_name }}'
|
||||
- result.vultr_user.name == '{{ vultr_user_name }}'
|
||||
- result.vultr_user.email == 'john.doe@example.com'
|
||||
- result.vultr_user.api_enabled == true
|
||||
- "'upgrade' in result.vultr_user.acls"
|
||||
|
@ -88,8 +88,8 @@
|
|||
- result.vultr_user.api_key is defined
|
||||
|
||||
- name: test create user idempotence
|
||||
vr_user:
|
||||
name: "{{ vr_user_name }}"
|
||||
vultr_user:
|
||||
name: "{{ vultr_user_name }}"
|
||||
email: john.doe@example.com
|
||||
password: s3cr3t
|
||||
acls:
|
||||
|
@ -101,7 +101,7 @@
|
|||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
- result.vultr_user.name == '{{ vr_user_name }}'
|
||||
- result.vultr_user.name == '{{ vultr_user_name }}'
|
||||
- result.vultr_user.email == 'john.doe@example.com'
|
||||
- result.vultr_user.api_enabled == true
|
||||
- "'upgrade' in result.vultr_user.acls"
|
||||
|
@ -110,8 +110,8 @@
|
|||
- result.vultr_user.api_key is not defined
|
||||
|
||||
- name: test update user in check mode
|
||||
vr_user:
|
||||
name: "{{ vr_user_name }}"
|
||||
vultr_user:
|
||||
name: "{{ vultr_user_name }}"
|
||||
email: jimmy@example.com
|
||||
password: s3cr3t
|
||||
api_enabled: false
|
||||
|
@ -125,7 +125,7 @@
|
|||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_user.name == '{{ vr_user_name }}'
|
||||
- result.vultr_user.name == '{{ vultr_user_name }}'
|
||||
- result.vultr_user.email == 'john.doe@example.com'
|
||||
- "'upgrade' in result.vultr_user.acls"
|
||||
- "'manage_users' in result.vultr_user.acls"
|
||||
|
@ -134,8 +134,8 @@
|
|||
- result.vultr_user.api_key is not defined
|
||||
|
||||
- name: test update user
|
||||
vr_user:
|
||||
name: "{{ vr_user_name }}"
|
||||
vultr_user:
|
||||
name: "{{ vultr_user_name }}"
|
||||
email: jimmy@example.com
|
||||
password: s3cr3t
|
||||
api_enabled: false
|
||||
|
@ -148,7 +148,7 @@
|
|||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_user.name == '{{ vr_user_name }}'
|
||||
- result.vultr_user.name == '{{ vultr_user_name }}'
|
||||
- result.vultr_user.email == 'jimmy@example.com'
|
||||
- "'upgrade' in result.vultr_user.acls"
|
||||
- "'manage_users' in result.vultr_user.acls"
|
||||
|
@ -157,8 +157,8 @@
|
|||
- result.vultr_user.api_key is not defined
|
||||
|
||||
- name: test update user idempotence
|
||||
vr_user:
|
||||
name: "{{ vr_user_name }}"
|
||||
vultr_user:
|
||||
name: "{{ vultr_user_name }}"
|
||||
email: jimmy@example.com
|
||||
password: s3cr3t
|
||||
api_enabled: false
|
||||
|
@ -171,7 +171,7 @@
|
|||
assert:
|
||||
that:
|
||||
- result is not changed
|
||||
- result.vultr_user.name == '{{ vr_user_name }}'
|
||||
- result.vultr_user.name == '{{ vultr_user_name }}'
|
||||
- result.vultr_user.email == 'jimmy@example.com'
|
||||
- "'upgrade' in result.vultr_user.acls"
|
||||
- "'manage_users' in result.vultr_user.acls"
|
||||
|
@ -180,8 +180,8 @@
|
|||
- result.vultr_user.api_key is not defined
|
||||
|
||||
- name: test absent user in check mode
|
||||
vr_user:
|
||||
name: "{{ vr_user_name }}"
|
||||
vultr_user:
|
||||
name: "{{ vultr_user_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
check_mode: yes
|
||||
|
@ -189,7 +189,7 @@
|
|||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_user.name == '{{ vr_user_name }}'
|
||||
- result.vultr_user.name == '{{ vultr_user_name }}'
|
||||
- result.vultr_user.email == 'jimmy@example.com'
|
||||
- "'upgrade' in result.vultr_user.acls"
|
||||
- "'manage_users' in result.vultr_user.acls"
|
||||
|
@ -198,15 +198,15 @@
|
|||
- result.vultr_user.api_key is not defined
|
||||
|
||||
- name: test absent user
|
||||
vr_user:
|
||||
name: "{{ vr_user_name }}"
|
||||
vultr_user:
|
||||
name: "{{ vultr_user_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify test absent user
|
||||
assert:
|
||||
that:
|
||||
- result is changed
|
||||
- result.vultr_user.name == '{{ vr_user_name }}'
|
||||
- result.vultr_user.name == '{{ vultr_user_name }}'
|
||||
- result.vultr_user.email == 'jimmy@example.com'
|
||||
- "'upgrade' in result.vultr_user.acls"
|
||||
- "'manage_users' in result.vultr_user.acls"
|
||||
|
@ -215,8 +215,8 @@
|
|||
- result.vultr_user.api_key is not defined
|
||||
|
||||
- name: test absent user idempotence
|
||||
vr_user:
|
||||
name: "{{ vr_user_name }}"
|
||||
vultr_user:
|
||||
name: "{{ vultr_user_name }}"
|
||||
state: absent
|
||||
register: result
|
||||
- name: verify test absent user idempotence
|
|
@ -2,14 +2,14 @@
|
|||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
---
|
||||
- name: Create the user
|
||||
vr_user:
|
||||
vultr_user:
|
||||
name: '{{ user_name }}'
|
||||
email: '{{ user_email }}'
|
||||
password: '{{ user_password }}'
|
||||
acls: '{{ user_acls }}'
|
||||
|
||||
- name: test gather vultr user facts in check mode
|
||||
vr_user_facts:
|
||||
vultr_user_facts:
|
||||
check_mode: yes
|
||||
|
||||
- name: verify test gather vultr user facts in check mode
|
||||
|
@ -18,7 +18,7 @@
|
|||
- ansible_facts.vultr_user_facts|selectattr('name','equalto','{{ user_name }}') | list | count == 1
|
||||
|
||||
- name: test gather vultr user facts
|
||||
vr_user_facts:
|
||||
vultr_user_facts:
|
||||
|
||||
- name: verify test gather vultr user facts
|
||||
assert:
|
||||
|
@ -26,6 +26,6 @@
|
|||
- ansible_facts.vultr_user_facts|selectattr('name','equalto','{{ user_name }}') | list | count == 1
|
||||
|
||||
- name: Delete the user
|
||||
vr_user:
|
||||
vultr_user:
|
||||
name: '{{ user_name }}'
|
||||
state: absent
|
|
@ -5,20 +5,20 @@
|
|||
gather_facts: no
|
||||
connection: local
|
||||
roles:
|
||||
- { role: vr_account_facts, tags: test_vr_account_facts }
|
||||
- { role: vr_dns_domain, tags: test_vr_dns_domain }
|
||||
- { role: vr_dns_domain_facts, tags: test_vr_dns_domain_facts }
|
||||
- { role: vr_dns_record, tags: test_vr_dns_record }
|
||||
- { role: vr_firewall_group, tags: test_vr_firewall_group }
|
||||
- { role: vr_firewall_group_facts, tags: test_vr_firewall_group_facts }
|
||||
- { role: vr_firewall_rule, tags: test_vr_firewall_rule }
|
||||
- { role: vr_os_facts, tags: test_vr_os_facts }
|
||||
- { role: vr_plan_facts, tags: test_vr_plan_facts }
|
||||
- { role: vr_region_facts, tags: test_vr_region_facts }
|
||||
- { role: vr_server, tags: test_vr_server }
|
||||
- { role: vr_ssh_key, tags: test_vr_ssh_key }
|
||||
- { role: vr_ssh_key_facts, tags: test_vr_ssh_key_facts }
|
||||
- { role: vr_startup_script, tags: test_vr_startup_script }
|
||||
- { role: vr_startup_script_facts, tags: test_vr_startup_script_facts }
|
||||
- { role: vr_user, tags: test_vr_user }
|
||||
- { role: vr_user_facts, tags: test_vr_user_facts }
|
||||
- { role: vultr_account_facts, tags: test_vultr_account_facts }
|
||||
- { role: vultr_dns_domain, tags: test_vultr_dns_domain }
|
||||
- { role: vultr_dns_domain_facts, tags: test_vultr_dns_domain_facts }
|
||||
- { role: vultr_dns_record, tags: test_vultr_dns_record }
|
||||
- { role: vultr_firewall_group, tags: test_vultr_firewall_group }
|
||||
- { role: vultr_firewall_group_facts, tags: test_vultr_firewall_group_facts }
|
||||
- { role: vultr_firewall_rule, tags: test_vultr_firewall_rule }
|
||||
- { role: vultr_os_facts, tags: test_vultr_os_facts }
|
||||
- { role: vultr_plan_facts, tags: test_vultr_plan_facts }
|
||||
- { role: vultr_region_facts, tags: test_vultr_region_facts }
|
||||
- { role: vultr_server, tags: test_vultr_server }
|
||||
- { role: vultr_ssh_key, tags: test_vultr_ssh_key }
|
||||
- { role: vultr_ssh_key_facts, tags: test_vultr_ssh_key_facts }
|
||||
- { role: vultr_startup_script, tags: test_vultr_startup_script }
|
||||
- { role: vultr_startup_script_facts, tags: test_vultr_startup_script_facts }
|
||||
- { role: vultr_user, tags: test_vultr_user }
|
||||
- { role: vultr_user_facts, tags: test_vultr_user_facts }
|
||||
|
|
|
@ -511,13 +511,6 @@ lib/ansible/modules/cloud/vmware/vca_vapp.py E322
|
|||
lib/ansible/modules/cloud/vmware/vca_vapp.py E324
|
||||
lib/ansible/modules/cloud/vmware/vmware_guest.py E322
|
||||
lib/ansible/modules/cloud/vmware/vsphere_copy.py E322
|
||||
lib/ansible/modules/cloud/vultr/vr_dns_domain.py E323
|
||||
lib/ansible/modules/cloud/vultr/vr_dns_record.py E326
|
||||
lib/ansible/modules/cloud/vultr/vr_firewall_rule.py E323
|
||||
lib/ansible/modules/cloud/vultr/vr_firewall_rule.py E324
|
||||
lib/ansible/modules/cloud/vultr/vr_server.py E325
|
||||
lib/ansible/modules/cloud/vultr/vr_user.py E322
|
||||
lib/ansible/modules/cloud/vultr/vr_user.py E326
|
||||
lib/ansible/modules/clustering/consul.py E322
|
||||
lib/ansible/modules/clustering/consul.py E324
|
||||
lib/ansible/modules/clustering/consul_acl.py E325
|
||||
|
|
Loading…
Reference in a new issue