mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
vultr: streamline docs (#56563)
This commit is contained in:
parent
6b240433b6
commit
ded7949879
5 changed files with 62 additions and 49 deletions
|
@ -19,12 +19,12 @@ VULTR_USER_AGENT = 'Ansible Vultr'
|
||||||
|
|
||||||
def vultr_argument_spec():
|
def vultr_argument_spec():
|
||||||
return dict(
|
return dict(
|
||||||
api_key=dict(default=os.environ.get('VULTR_API_KEY'), no_log=True),
|
api_key=dict(type='str', default=os.environ.get('VULTR_API_KEY'), no_log=True),
|
||||||
api_timeout=dict(type='int', default=os.environ.get('VULTR_API_TIMEOUT')),
|
api_timeout=dict(type='int', default=os.environ.get('VULTR_API_TIMEOUT')),
|
||||||
api_retries=dict(type='int', default=os.environ.get('VULTR_API_RETRIES')),
|
api_retries=dict(type='int', default=os.environ.get('VULTR_API_RETRIES')),
|
||||||
api_account=dict(default=os.environ.get('VULTR_API_ACCOUNT') or 'default'),
|
api_account=dict(type='str', default=os.environ.get('VULTR_API_ACCOUNT') or 'default'),
|
||||||
api_endpoint=dict(default=os.environ.get('VULTR_API_ENDPOINT')),
|
api_endpoint=dict(type='str', default=os.environ.get('VULTR_API_ENDPOINT')),
|
||||||
validate_certs=dict(default=True, type='bool'),
|
validate_certs=dict(type='bool', default=True),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,24 +26,30 @@ options:
|
||||||
- Name of the server.
|
- Name of the server.
|
||||||
required: true
|
required: true
|
||||||
aliases: [ label ]
|
aliases: [ label ]
|
||||||
|
type: str
|
||||||
hostname:
|
hostname:
|
||||||
description:
|
description:
|
||||||
- Hostname to assign to this server.
|
- Hostname to assign to this server.
|
||||||
|
type: str
|
||||||
os:
|
os:
|
||||||
description:
|
description:
|
||||||
- The operating system.
|
- The operating system.
|
||||||
- Required if the server does not yet exist and is not restoring from a snapshot.
|
- Required if the server does not yet exist and is not restoring from a snapshot.
|
||||||
|
type: str
|
||||||
snapshot:
|
snapshot:
|
||||||
version_added: "2.8"
|
version_added: "2.8"
|
||||||
description:
|
description:
|
||||||
- Name of snapshot to restore server from.
|
- Name of snapshot to restore server from.
|
||||||
|
type: str
|
||||||
firewall_group:
|
firewall_group:
|
||||||
description:
|
description:
|
||||||
- The firewall group to assign this server to.
|
- The firewall group to assign this server to.
|
||||||
|
type: str
|
||||||
plan:
|
plan:
|
||||||
description:
|
description:
|
||||||
- Plan to use for the server.
|
- Plan to use for the server.
|
||||||
- Required if the server does not yet exist.
|
- Required if the server does not yet exist.
|
||||||
|
type: str
|
||||||
force:
|
force:
|
||||||
description:
|
description:
|
||||||
- Force stop/start the server if required to apply changes
|
- Force stop/start the server if required to apply changes
|
||||||
|
@ -69,37 +75,43 @@ options:
|
||||||
tag:
|
tag:
|
||||||
description:
|
description:
|
||||||
- Tag for the server.
|
- Tag for the server.
|
||||||
|
type: str
|
||||||
user_data:
|
user_data:
|
||||||
description:
|
description:
|
||||||
- User data to be passed to the server.
|
- User data to be passed to the server.
|
||||||
|
type: str
|
||||||
startup_script:
|
startup_script:
|
||||||
description:
|
description:
|
||||||
- Name of the startup script to execute on boot.
|
- Name of the startup script to execute on boot.
|
||||||
- Only considered while creating the server.
|
- Only considered while creating the server.
|
||||||
|
type: str
|
||||||
ssh_keys:
|
ssh_keys:
|
||||||
description:
|
description:
|
||||||
- List of SSH keys passed to the server on creation.
|
- List of SSH keys passed to the server on creation.
|
||||||
aliases: [ ssh_key ]
|
aliases: [ ssh_key ]
|
||||||
|
type: list
|
||||||
reserved_ip_v4:
|
reserved_ip_v4:
|
||||||
description:
|
description:
|
||||||
- IP address of the floating IP to use as the main IP of this server.
|
- IP address of the floating IP to use as the main IP of this server.
|
||||||
- Only considered on creation.
|
- Only considered on creation.
|
||||||
|
type: str
|
||||||
region:
|
region:
|
||||||
description:
|
description:
|
||||||
- Region the server is deployed into.
|
- Region the server is deployed into.
|
||||||
- Required if the server does not yet exist.
|
- Required if the server does not yet exist.
|
||||||
|
type: str
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- State of the server.
|
- State of the server.
|
||||||
default: present
|
default: present
|
||||||
choices: [ present, absent, restarted, reinstalled, started, stopped ]
|
choices: [ present, absent, restarted, reinstalled, started, stopped ]
|
||||||
|
type: str
|
||||||
extends_documentation_fragment: vultr
|
extends_documentation_fragment: vultr
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: create server
|
- name: create server
|
||||||
local_action:
|
vultr_server:
|
||||||
module: vultr_server
|
|
||||||
name: "{{ vultr_server_name }}"
|
name: "{{ vultr_server_name }}"
|
||||||
os: CentOS 7 x64
|
os: CentOS 7 x64
|
||||||
plan: 1024 MB RAM,25 GB SSD,1.00 TB BW
|
plan: 1024 MB RAM,25 GB SSD,1.00 TB BW
|
||||||
|
@ -110,8 +122,7 @@ EXAMPLES = '''
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: ensure a server is present and started
|
- name: ensure a server is present and started
|
||||||
local_action:
|
vultr_server:
|
||||||
module: vultr_server
|
|
||||||
name: "{{ vultr_server_name }}"
|
name: "{{ vultr_server_name }}"
|
||||||
os: CentOS 7 x64
|
os: CentOS 7 x64
|
||||||
plan: 1024 MB RAM,25 GB SSD,1.00 TB BW
|
plan: 1024 MB RAM,25 GB SSD,1.00 TB BW
|
||||||
|
@ -120,8 +131,7 @@ EXAMPLES = '''
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
- name: ensure a server is present and stopped
|
- name: ensure a server is present and stopped
|
||||||
local_action:
|
vultr_server:
|
||||||
module: vultr_server
|
|
||||||
name: "{{ vultr_server_name }}"
|
name: "{{ vultr_server_name }}"
|
||||||
os: CentOS 7 x64
|
os: CentOS 7 x64
|
||||||
plan: 1024 MB RAM,25 GB SSD,1.00 TB BW
|
plan: 1024 MB RAM,25 GB SSD,1.00 TB BW
|
||||||
|
@ -129,20 +139,17 @@ EXAMPLES = '''
|
||||||
state: stopped
|
state: stopped
|
||||||
|
|
||||||
- name: ensure an existing server is stopped
|
- name: ensure an existing server is stopped
|
||||||
local_action:
|
vultr_server:
|
||||||
module: vultr_server
|
|
||||||
name: "{{ vultr_server_name }}"
|
name: "{{ vultr_server_name }}"
|
||||||
state: stopped
|
state: stopped
|
||||||
|
|
||||||
- name: ensure an existing server is started
|
- name: ensure an existing server is started
|
||||||
local_action:
|
vultr_server:
|
||||||
module: vultr_server
|
|
||||||
name: "{{ vultr_server_name }}"
|
name: "{{ vultr_server_name }}"
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
- name: ensure a server is absent
|
- name: ensure a server is absent
|
||||||
local_action:
|
vultr_server:
|
||||||
module: vultr_server
|
|
||||||
name: "{{ vultr_server_name }}"
|
name: "{{ vultr_server_name }}"
|
||||||
state: absent
|
state: absent
|
||||||
'''
|
'''
|
||||||
|
@ -865,22 +872,22 @@ def main():
|
||||||
argument_spec = vultr_argument_spec()
|
argument_spec = vultr_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
name=dict(required=True, aliases=['label']),
|
name=dict(required=True, aliases=['label']),
|
||||||
hostname=dict(),
|
hostname=dict(type='str',),
|
||||||
os=dict(),
|
os=dict(type='str',),
|
||||||
snapshot=dict(),
|
snapshot=dict(type='str',),
|
||||||
plan=dict(),
|
plan=dict(type='str',),
|
||||||
force=dict(type='bool', default=False),
|
force=dict(type='bool', default=False),
|
||||||
notify_activate=dict(type='bool', default=False),
|
notify_activate=dict(type='bool', default=False),
|
||||||
private_network_enabled=dict(type='bool'),
|
private_network_enabled=dict(type='bool'),
|
||||||
auto_backup_enabled=dict(type='bool'),
|
auto_backup_enabled=dict(type='bool'),
|
||||||
ipv6_enabled=dict(type='bool'),
|
ipv6_enabled=dict(type='bool'),
|
||||||
tag=dict(),
|
tag=dict(type='str',),
|
||||||
reserved_ip_v4=dict(),
|
reserved_ip_v4=dict(type='str',),
|
||||||
firewall_group=dict(),
|
firewall_group=dict(type='str',),
|
||||||
startup_script=dict(),
|
startup_script=dict(type='str',),
|
||||||
user_data=dict(),
|
user_data=dict(type='str',),
|
||||||
ssh_keys=dict(type='list', aliases=['ssh_key']),
|
ssh_keys=dict(type='list', aliases=['ssh_key']),
|
||||||
region=dict(),
|
region=dict(type='str',),
|
||||||
state=dict(choices=['present', 'absent', 'restarted', 'reinstalled', 'started', 'stopped'], default='present'),
|
state=dict(choices=['present', 'absent', 'restarted', 'reinstalled', 'started', 'stopped'], default='present'),
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
|
@ -24,29 +24,29 @@ options:
|
||||||
description:
|
description:
|
||||||
- Name of the ssh key.
|
- Name of the ssh key.
|
||||||
required: true
|
required: true
|
||||||
|
type: str
|
||||||
ssh_key:
|
ssh_key:
|
||||||
description:
|
description:
|
||||||
- SSH public key.
|
- SSH public key.
|
||||||
- Required if C(state=present).
|
- Required if C(state=present).
|
||||||
required: false
|
type: str
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- State of the ssh key.
|
- State of the ssh key.
|
||||||
default: present
|
default: present
|
||||||
choices: [ present, absent ]
|
choices: [ present, absent ]
|
||||||
|
type: str
|
||||||
extends_documentation_fragment: vultr
|
extends_documentation_fragment: vultr
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = '''
|
||||||
- name: ensure an SSH key is present
|
- name: ensure an SSH key is present
|
||||||
local_action:
|
vultr_ssh_key:
|
||||||
module: vultr_ssh_key
|
|
||||||
name: my ssh key
|
name: my ssh key
|
||||||
ssh_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
|
ssh_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
|
||||||
|
|
||||||
- name: ensure an SSH key is absent
|
- name: ensure an SSH key is absent
|
||||||
local_action:
|
vultr_ssh_key:
|
||||||
module: vultr_ssh_key
|
|
||||||
name: my ssh key
|
name: my ssh key
|
||||||
state: absent
|
state: absent
|
||||||
'''
|
'''
|
||||||
|
@ -205,9 +205,9 @@ class AnsibleVultrSshKey(Vultr):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = vultr_argument_spec()
|
argument_spec = vultr_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
name=dict(required=True),
|
name=dict(type='str', required=True),
|
||||||
ssh_key=dict(),
|
ssh_key=dict(type='str',),
|
||||||
state=dict(choices=['present', 'absent'], default='present'),
|
state=dict(type='str', choices=['present', 'absent'], default='present'),
|
||||||
))
|
))
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -24,41 +24,42 @@ options:
|
||||||
description:
|
description:
|
||||||
- The script name.
|
- The script name.
|
||||||
required: true
|
required: true
|
||||||
|
type: str
|
||||||
script_type:
|
script_type:
|
||||||
description:
|
description:
|
||||||
- The script type, can not be changed once created.
|
- The script type, can not be changed once created.
|
||||||
default: boot
|
default: boot
|
||||||
choices: [ boot, pxe ]
|
choices: [ boot, pxe ]
|
||||||
aliases: [ type ]
|
aliases: [ type ]
|
||||||
|
type: str
|
||||||
script:
|
script:
|
||||||
description:
|
description:
|
||||||
- The script source code.
|
- The script source code.
|
||||||
- Required if (state=present).
|
- Required if I(state=present).
|
||||||
|
type: str
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- State of the script.
|
- State of the script.
|
||||||
default: present
|
default: present
|
||||||
choices: [ present, absent ]
|
choices: [ present, absent ]
|
||||||
|
type: str
|
||||||
extends_documentation_fragment: vultr
|
extends_documentation_fragment: vultr
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = r'''
|
EXAMPLES = r'''
|
||||||
- name: ensure a pxe script exists, source from a file
|
- name: ensure a pxe script exists, source from a file
|
||||||
local_action:
|
vultr_startup_script:
|
||||||
module: vultr_startup_script
|
|
||||||
name: my_web_script
|
name: my_web_script
|
||||||
script_type: pxe
|
script_type: pxe
|
||||||
script: "{{ lookup('file', 'path/to/script') }}"
|
script: "{{ lookup('file', 'path/to/script') }}"
|
||||||
|
|
||||||
- name: ensure a boot script exists
|
- name: ensure a boot script exists
|
||||||
local_action:
|
vultr_startup_script:
|
||||||
module: vultr_startup_script
|
|
||||||
name: vultr_startup_script
|
name: vultr_startup_script
|
||||||
script: "#!/bin/bash\necho Hello World > /root/hello"
|
script: "#!/bin/bash\necho Hello World > /root/hello"
|
||||||
|
|
||||||
- name: ensure a script is absent
|
- name: ensure a script is absent
|
||||||
local_action:
|
vultr_startup_script:
|
||||||
module: vultr_startup_script
|
|
||||||
name: my_web_script
|
name: my_web_script
|
||||||
state: absent
|
state: absent
|
||||||
'''
|
'''
|
||||||
|
@ -232,10 +233,10 @@ class AnsibleVultrStartupScript(Vultr):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = vultr_argument_spec()
|
argument_spec = vultr_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
name=dict(required=True),
|
name=dict(type='str', required=True),
|
||||||
script=dict(),
|
script=dict(type='str',),
|
||||||
script_type=dict(default='boot', choices=['boot', 'pxe'], aliases=['type']),
|
script_type=dict(type='str', default='boot', choices=['boot', 'pxe'], aliases=['type']),
|
||||||
state=dict(choices=['present', 'absent'], default='present'),
|
state=dict(type='str', choices=['present', 'absent'], default='present'),
|
||||||
))
|
))
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
|
@ -24,14 +24,17 @@ options:
|
||||||
description:
|
description:
|
||||||
- Name of the user
|
- Name of the user
|
||||||
required: true
|
required: true
|
||||||
|
type: str
|
||||||
email:
|
email:
|
||||||
description:
|
description:
|
||||||
- Email of the user.
|
- Email of the user.
|
||||||
- Required if C(state=present).
|
- Required if C(state=present).
|
||||||
|
type: str
|
||||||
password:
|
password:
|
||||||
description:
|
description:
|
||||||
- Password of the user.
|
- Password of the user.
|
||||||
- Only considered while creating a user or when C(force=yes).
|
- Only considered while creating a user or when C(force=yes).
|
||||||
|
type: str
|
||||||
force:
|
force:
|
||||||
description:
|
description:
|
||||||
- Password will only be changed with enforcement.
|
- Password will only be changed with enforcement.
|
||||||
|
@ -57,11 +60,13 @@ options:
|
||||||
- dns
|
- dns
|
||||||
- upgrade
|
- upgrade
|
||||||
aliases: [ acl ]
|
aliases: [ acl ]
|
||||||
|
type: list
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- State of the user.
|
- State of the user.
|
||||||
default: present
|
default: present
|
||||||
choices: [ present, absent ]
|
choices: [ present, absent ]
|
||||||
|
type: str
|
||||||
extends_documentation_fragment: vultr
|
extends_documentation_fragment: vultr
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -287,13 +292,13 @@ class AnsibleVultrUser(Vultr):
|
||||||
def main():
|
def main():
|
||||||
argument_spec = vultr_argument_spec()
|
argument_spec = vultr_argument_spec()
|
||||||
argument_spec.update(dict(
|
argument_spec.update(dict(
|
||||||
name=dict(required=True),
|
name=dict(type='str', required=True),
|
||||||
email=dict(),
|
email=dict(type='str',),
|
||||||
password=dict(no_log=True),
|
password=dict(type='str', no_log=True),
|
||||||
force=dict(type='bool', default=False),
|
force=dict(type='bool', default=False),
|
||||||
api_enabled=dict(type='bool', default=True),
|
api_enabled=dict(type='bool', default=True),
|
||||||
acls=dict(type='list', choices=ACLS, aliases=['acl']),
|
acls=dict(type='list', choices=ACLS, aliases=['acl']),
|
||||||
state=dict(choices=['present', 'absent'], default='present'),
|
state=dict(type='str', choices=['present', 'absent'], default='present'),
|
||||||
))
|
))
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
|
|
Loading…
Reference in a new issue