
This collection adds Ansible modules for your MozOut VPS servers, domains and DNS records, so you can manage them from playbooks. It uses only our public API and the Python standard library: there is nothing else to install.
What it does
mozout.cloud.vps buys a VPS with credit, or manages one you have: start, stop, restart, time zone and reverse DNS. mozout.cloud.domain registers a domain, or manages one you have: nameservers, transfer lock and renewal. mozout.cloud.dns_record adds, changes or removes a DNS record.
Four more modules only read: mozout.cloud.vps_info (your servers), mozout.cloud.domain_info (your domains, or whether a name is free and its price), mozout.cloud.dns_info (the DNS zone of a domain) and mozout.cloud.catalog_info (products, options, domain extensions and prices).
Every module supports check mode (--check) and is idempotent: running a playbook again changes only what is different.
What you need
ansible-core 2.14 or later, Python 3.6 or later, and an account with MozOut that has an API key, created in the API Center of My MozOut.
Installing, step by step
|
|
|
ansible-galaxy collection install mozout.cloud
export MOZOUT_API_KEY="sandbox_..."
- hosts: localhost
gather_facts: false
tasks:
- name: Point www to the server
mozout.cloud.dns_record:
domain: example.com
name: www
type: A
value: 203.0.113.10
ttl: 3600
solo: true
To set the key once for every task, use the action group:
module_defaults:
group/mozout.cloud.all:
api_key: "{{ vault_api_key }}"
The API key and its permissions
The key needs these permissions: catalog:read; vps:read and vps:write; domains:read and domains:write; dns:read and dns:write; and billing:purchase to buy. See how to create a key and pick its permissions.
Testing without spending
Start with a sandbox_ key. It reads your real data, but every write is simulated and nothing is charged. The result has simulated: true.
Good to know
Purchases: buying a VPS or registering a domain is paid with your account credit, within the spending limit of the key. A VPS purchase needs idempotency_key: the same task with the same key within 24 hours gets the same answer and is not charged again. Save the returned server id and use server_id from then on.
Registers only when missing: domain registers only when the domain is not in your account yet. With register: false it never buys.
Cancelling: the API cannot cancel services or delete domains. You cancel in My MozOut.
Errors: they show the API code and the correlation_id, to give to support. 429 and 5xx answers are retried.
Help
If a task fails and you cannot tell why, open a support ticket and include the correlation_id from the error. There are more example playbooks in the collection repository, under the MIT license.
|
Ready to automate your account with Ansible? Download the latest release |
|
SEE ALSO |
RECOMMENDED PRODUCT VPS server with root access Resources of your own, the OS you choose, reinstall whenever you like. from ₦12,600.00/mo (3-year plan, with coupon) See plans |











