2020-03-28 00:03:32 +00:00
|
|
|
# autonomic.gandi
|
|
|
|
|
2020-03-28 15:51:13 +00:00
|
|
|
[![Build Status](https://drone.autonomic.zone/api/badges/autonomic-cooperative/autonomic.gandi/status.svg)](https://drone.autonomic.zone/autonomic-cooperative/autonomic.gandi)
|
|
|
|
|
2020-03-28 18:41:32 +00:00
|
|
|
Ansible libraries for managing Gandi resources.
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
---
|
|
|
|
- hosts: localhost
|
|
|
|
gather_facts: false
|
|
|
|
connection: local
|
|
|
|
tasks:
|
|
|
|
- name: Create foobar.autonomic.zone
|
|
|
|
gandi_dns:
|
2020-03-29 07:07:36 +00:00
|
|
|
gandi_rest_token: abc...
|
2020-03-28 18:41:32 +00:00
|
|
|
domain: foobar.autonomic.zone
|
|
|
|
ipv4: 94.130.105.60
|
|
|
|
state: present
|
|
|
|
```
|
|
|
|
|
|
|
|
## Features
|
|
|
|
|
|
|
|
- [x] Create a new DNS entry
|
|
|
|
- [x] Delete an existing DNS entry
|
|
|
|
- [ ] Update an existing DNS entry
|
2020-03-28 00:03:32 +00:00
|
|
|
|
2020-03-28 15:58:23 +00:00
|
|
|
## Requirements
|
|
|
|
|
|
|
|
- [Ansible >= 2.9.6](https://pypi.org/project/ansible/)
|
2020-03-28 17:28:37 +00:00
|
|
|
- [dns-lexicon >= 3.3.19](https://pypi.org/project/dns-lexicon/) (if using `gandi_dns` module)
|
2020-03-28 15:58:23 +00:00
|
|
|
|
|
|
|
```bash
|
2020-03-28 17:28:37 +00:00
|
|
|
$ pip install ansible==2.6.9 "dns-lexicon[gandi]==3.3.19"
|
2020-03-28 15:58:23 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
These should be present on the localhost where you run Ansible.
|
|
|
|
|
2020-03-28 17:28:37 +00:00
|
|
|
## Gandi DNS Setup
|
|
|
|
|
|
|
|
If you want to use the `gandi_dns` module you need to prepare the environment.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
export PROVIDER="gandi"
|
|
|
|
export LEXICON_GANDI_AUTH_TOKEN="${pass show users/decentral1se/gandi/api_key)"
|
|
|
|
export LEXICON_GANDI_API_PROTOCOL="rest"
|
|
|
|
```
|
|
|
|
|
|
|
|
You can test that everything is working by running the following.
|
|
|
|
|
|
|
|
```bash
|
2020-03-28 18:42:30 +00:00
|
|
|
$ lexicon gandi list autonomic.zone A
|
2020-03-28 17:28:37 +00:00
|
|
|
```
|
|
|
|
|
2020-03-29 07:12:01 +00:00
|
|
|
The `gandi_dns` module will provide the `PROVIDER` and
|
2020-03-29 07:12:40 +00:00
|
|
|
`LEXICON_GANDI_API_PROTOCOL` environment variables internally so you only need
|
|
|
|
to pass `LEXICON_GANDI_AUTH_TOKEN` to the task or expose it in the environment.
|
2020-03-29 07:12:01 +00:00
|
|
|
|
2020-03-28 15:55:50 +00:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
Include an entry in your `requirements.yml` like so.
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
- src: https://git.autonomic.zone/autonomic-cooperative/autonomic.gandi
|
|
|
|
version: 0.0.1
|
|
|
|
name: autonomic.gandi
|
|
|
|
```
|
|
|
|
|
|
|
|
See the [releases](https://git.autonomic.zone/autonomic-cooperative/autonomic.gandi/releases) for which is the latest version.
|
|
|
|
|
|
|
|
Then make sure to download the role with `ansible-galaxy install -r requirements.yml`.
|