community / community.general / 0.1.1 / module / vultr_server Manages virtual servers on Vultr. Authors: René Moser (@resmo) preview | supported by communitycommunity.general.vultr_server (0.1.1) — module
Install with ansible-galaxy collection install community.general:==0.1.1
collections: - name: community.general version: 0.1.1
Deploy, start, stop, update, restart, reinstall servers.
- name: create server delegate_to: localhost vultr_server: name: "{{ vultr_server_name }}" os: CentOS 7 x64 plan: 1024 MB RAM,25 GB SSD,1.00 TB BW ssh_keys: - my_key - your_key region: Amsterdam state: present
- name: ensure a server is present and started delegate_to: localhost vultr_server: name: "{{ vultr_server_name }}" os: CentOS 7 x64 plan: 1024 MB RAM,25 GB SSD,1.00 TB BW firewall_group: my_group ssh_key: my_key region: Amsterdam state: started
- name: ensure a server is present and stopped provisioned using IDs delegate_to: localhost vultr_server: name: "{{ vultr_server_name }}" os: "167" plan: "201" region: "7" state: stopped
- name: ensure an existing server is stopped delegate_to: localhost vultr_server: name: "{{ vultr_server_name }}" state: stopped
- name: ensure an existing server is started delegate_to: localhost vultr_server: name: "{{ vultr_server_name }}" state: started
- name: ensure a server is absent delegate_to: localhost vultr_server: name: "{{ vultr_server_name }}" state: absent
os: description: - The operating system name or ID. - Required if the server does not yet exist and is not restoring from a snapshot. type: str tag: description: - Tag for the server. type: str name: aliases: - label description: - Name of the server. required: true type: str plan: description: - Plan name or ID to use for the server. - Required if the server does not yet exist. type: str force: default: false description: - Force stop/start the server if required to apply changes - Otherwise a running server will not be changed. type: bool state: choices: - present - absent - restarted - reinstalled - started - stopped default: present description: - State of the server. type: str region: description: - Region name or ID the server is deployed into. - Required if the server does not yet exist. type: str api_key: description: - API key of the Vultr API. - The ENV variable C(VULTR_API_KEY) is used as default, when defined. type: str hostname: description: - The hostname to assign to this server. type: str snapshot: description: - Name or ID of the snapshot to restore the server from. type: str ssh_keys: aliases: - ssh_key description: - List of SSH key names or IDs passed to the server on creation. type: list user_data: description: - User data to be passed to the server. type: str api_account: default: default description: - Name of the ini section in the C(vultr.ini) file. - The ENV variable C(VULTR_API_ACCOUNT) is used as default, when defined. type: str api_retries: description: - Amount of retries in case of the Vultr API retuns an HTTP 503 code. - The ENV variable C(VULTR_API_RETRIES) is used as default, when defined. - Fallback value is 5 retries if not specified. type: int api_timeout: description: - HTTP timeout to Vultr API. - The ENV variable C(VULTR_API_TIMEOUT) is used as default, when defined. - Fallback value is 60 seconds if not specified. type: int api_endpoint: description: - URL to API endpint (without trailing slash). - The ENV variable C(VULTR_API_ENDPOINT) is used as default, when defined. - Fallback value is U(https://api.vultr.com) if not specified. type: str ipv6_enabled: description: - Whether to enable IPv6 or not. type: bool firewall_group: description: - The firewall group description or ID to assign this server to. type: str 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 startup_script: description: - Name or ID of the startup script to execute on boot. - Only considered while creating the server. type: str validate_certs: default: true description: - Validate SSL certs of the Vultr API. type: bool notify_activate: description: - Whether to send an activation email when the server is ready or not. - Only considered on creation. type: bool api_retry_max_delay: description: - Retry backoff delay in seconds is exponential up to this max. value, in seconds. - The ENV variable C(VULTR_API_RETRY_MAX_DELAY) is used as default, when defined. - Fallback value is 12 seconds. type: int auto_backup_enabled: description: - Whether to enable automatic backups or not. type: bool private_network_enabled: description: - Whether to enable private networking or not. type: bool
vultr_api: contains: api_account: description: Account used in the ini file to select the key returned: success sample: default type: str api_endpoint: description: Endpoint used for the API requests returned: success sample: https://api.vultr.com type: str api_retries: description: Amount of max retries for the API requests returned: success sample: 5 type: int api_retry_max_delay: description: Exponential backoff delay in seconds between retries up to this max delay value. returned: success sample: 12 type: int version_added: '2.9' version_added_collection: community.general api_timeout: description: Timeout used for the API requests returned: success sample: 60 type: int description: Response from Vultr API with a few additions/modification returned: success type: complex vultr_server: contains: allowed_bandwidth_gb: description: Allowed bandwidth to use in GB returned: success sample: 1000 type: int auto_backup_enabled: description: Whether automatic backups are enabled returned: success sample: false type: bool cost_per_month: description: Cost per month for the server returned: success sample: 5.0 type: float current_bandwidth_gb: description: Current bandwidth used for the server returned: success sample: 0 type: int date_created: description: Date when the server was created returned: success sample: '2017-08-26 12:47:48' type: str default_password: description: Password to login as root into the server returned: success sample: '!p3EWYJm$qDWYaFr' type: str disk: description: Information about the disk returned: success sample: Virtual 25 GB type: str firewall_group: description: Firewall group the server is assigned to returned: success and available sample: CentOS 6 x64 type: str id: description: ID of the server returned: success sample: 10194376 type: str internal_ip: description: Internal IP returned: success sample: '' type: str kvm_url: description: URL to the VNC returned: success sample: https://my.vultr.com/subs/vps/novnc/api.php?data=xyz type: str name: description: Name (label) of the server returned: success sample: ansible-test-vm type: str os: description: Operating system used for the server returned: success sample: CentOS 6 x64 type: str pending_charges: description: Pending charges returned: success sample: 0.01 type: float plan: description: Plan used for the server returned: success sample: 1024 MB RAM,25 GB SSD,1.00 TB BW type: str power_status: description: Power status of the server returned: success sample: running type: str ram: description: Information about the RAM size returned: success sample: 1024 MB type: str region: description: Region the server was deployed into returned: success sample: Amsterdam type: str server_state: description: State about the server returned: success sample: ok type: str status: description: Status about the deployment of the server returned: success sample: active type: str tag: description: TBD returned: success sample: '' type: str v4_gateway: description: IPv4 gateway returned: success sample: 45.32.232.1 type: str v4_main_ip: description: Main IPv4 returned: success sample: 45.32.233.154 type: str v4_netmask: description: Netmask IPv4 returned: success sample: 255.255.254.0 type: str v6_main_ip: description: Main IPv6 returned: success sample: '' type: str v6_network: description: Network IPv6 returned: success sample: '' type: str v6_network_size: description: Network size IPv6 returned: success sample: '' type: str v6_networks: description: Networks IPv6 returned: success sample: [] type: list vcpu_count: description: Virtual CPU count returned: success sample: 1 type: int description: Response from Vultr API with a few additions/modification returned: success type: complex