ansible-collection-mozout/README.md

86 lines
3.3 KiB
Markdown

<p align="center"><img src="assets/logo.png" alt="MozOut" width="280"></p>
# Ansible Collection for MozOut
<!-- badges:start -->
[![Release](https://git.mozout.com/mozout-com/ansible-collection-mozout/badges/release.svg)](https://git.mozout.com/mozout-com/ansible-collection-mozout/releases) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
<!-- badges:end -->
Manage your MozOut VPS servers, domains and DNS records with Ansible. The collection uses only the public MozOut API (https://docs.mozout.com) and the Python standard library: nothing else to install.
## Modules
| Module | What for |
|---|---|
| `mozout.cloud.vps` | Buy a VPS with credit, or manage one you have: start, stop, restart, time zone, reverse DNS |
| `mozout.cloud.vps_info` | List your servers or see one |
| `mozout.cloud.domain` | Register a domain, or manage one you have: nameservers, transfer lock, renewal |
| `mozout.cloud.domain_info` | List your domains, see one, or check if a name is free and its price |
| `mozout.cloud.dns_record` | Add, change or remove a DNS record |
| `mozout.cloud.dns_info` | Read the DNS zone of a domain |
| `mozout.cloud.catalog_info` | Products for sale, the options of one product, domain extensions and prices |
Every module supports check mode (`--check`) and is idempotent: running a playbook again changes only what is different.
## Install
```shell
ansible-galaxy collection install mozout.cloud
```
Or from this repository:
```shell
ansible-galaxy collection build
ansible-galaxy collection install mozout-cloud-1.0.0.tar.gz
```
Needs ansible-core 2.14 or later and Python 3.6 or later.
## Quick start
```shell
export MOZOUT_API_KEY="sandbox_..." # create the key in My MozOut
```
```yaml
- 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
```
Start with a `sandbox_` key: it reads your real data, but every write is simulated and nothing is charged (the result has `simulated: true`). More playbooks in [examples/](examples/).
To set the key once for every task, use the action group:
```yaml
module_defaults:
group/mozout.cloud.all:
api_key: "{{ vault_api_key }}"
```
## Good to know
- Buying a VPS or registering a domain is paid with the 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.
- `domain` registers only when the domain is not in the account yet. With `register: false` it never buys.
- The API cannot cancel services or delete domains. Cancel in My MozOut (https://www.my.mozout.com).
- The key needs these permissions: `catalog:read`; `vps:read` and `vps:write`; `domains:read` and `domains:write`; `dns:read` and `dns:write`; `billing:purchase` to buy.
- Errors show the API code and the `correlation_id`, to give to support. `429` and `5xx` answers are retried.
## License
MIT. See [LICENSE](LICENSE).
---
Create your API key in the [API Center](https://www.my.mozout.com/api-center.php) of My MozOut. Documentation: https://docs.mozout.com
Maintained by RLX Holdings.