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