mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
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
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:
|
Loading…
Add table
Add a link
Reference in a new issue