7 Commits
0.0.2 ... show

Author SHA1 Message Date
767316125d Pass in the right env var too
All checks were successful
continuous-integration/drone/push Build is passing
2020-03-29 14:46:16 +02:00
995592a555 Add example and drop non-existant extra
All checks were successful
continuous-integration/drone/push Build is passing
2020-03-29 14:41:47 +02:00
f1abb8cb37 Remove import not available in older Ansible
All checks were successful
continuous-integration/drone/push Build is passing
2020-03-29 14:19:19 +02:00
6544f2acc8 Bump version (forgot to include in 0.0.3 tag) 2020-03-29 14:17:30 +02:00
bebccfab99 Pass tar.gz file
All checks were successful
continuous-integration/drone/push Build is passing
2020-03-29 10:40:42 +02:00
ff000ed5b1 Bump version
All checks were successful
continuous-integration/drone/push Build is passing
2020-03-29 10:39:33 +02:00
f4a49b5843 Add missing role folders
All checks were successful
continuous-integration/drone/push Build is passing
2020-03-29 10:37:35 +02:00
6 changed files with 41 additions and 14 deletions

View File

@ -12,6 +12,18 @@ Ansible libraries for managing Gandi resources.
gather_facts: false
connection: local
tasks:
- name: Prepare Python dependencies
become: true
apt:
name: python3-pip
state: present
- name: Install dns-lexicon system wide
become: true
pip:
name: dns-lexicon==3.3.19
executable: /usr/bin/pip3
- name: Create foobar.autonomic.zone
gandi_dns:
gandi_rest_token: abc...
@ -32,7 +44,7 @@ Ansible libraries for managing Gandi resources.
- [dns-lexicon >= 3.3.19](https://pypi.org/project/dns-lexicon/) (if using `gandi_dns` module)
```bash
$ pip install ansible==2.6.9 "dns-lexicon[gandi]==3.3.19"
$ pip install ansible==2.6.9 dns-lexicon==3.3.19
```
These should be present on the localhost where you run Ansible.
@ -63,8 +75,7 @@ task or expose it in the environment and it will be picked up.
Include an entry in your `requirements.yml` like so.
```yaml
- src: https://git.autonomic.zone/autonomic-cooperative/autonomic.gandi
version: 0.0.2
- src: https://git.autonomic.zone/autonomic-cooperative/autonomic.gandi/archive/0.0.5.tar.gz
name: autonomic.gandi
```

1
defaults/main.yml Normal file
View File

@ -0,0 +1 @@
---

View File

@ -5,11 +5,7 @@ import os
import traceback
from subprocess import CalledProcessError, check_output
from ansible.module_utils.basic import (
AnsibleModule,
env_fallback,
missing_required_lib,
)
from ansible.module_utils.basic import AnsibleModule, env_fallback
DOCUMENTATION = """
---
@ -74,18 +70,19 @@ def error_msg(domain):
).format(domain=domain)
def get_env():
def get_env(module):
"""Build environment for running command-line commands."""
env = os.environ.copy()
env["PROVIDER"] = "gandi"
env["LEXICON_GANDI_API_PROTOCOL"] = "rest"
env["LEXICON_GANDI_AUTH_TOKEN"] = module.params["gandi_rest_token"]
return env
def retrieve_domain_info(module):
"""Retrieve all information about a specific domain."""
domain = module.params["domain"]
env = get_env()
env = get_env(module)
try:
return json.loads(
@ -102,7 +99,7 @@ def create_domain(module):
"""Create a new DNS entry."""
domain = module.params["domain"]
ipv4 = module.params["ipv4"]
env = get_env()
env = get_env(module)
try:
return json.loads(
@ -131,7 +128,7 @@ def delete_domain(module):
"""Delete an existing DNS entry."""
domain = module.params["domain"]
ipv4 = module.params["ipv4"]
env = get_env()
env = get_env(module)
try:
return json.loads(
@ -177,7 +174,11 @@ def main():
)
if not HAS_DNS_LEXICON_DEPENDENCY:
msg = missing_required_lib("lexicon")
msg = (
"Missing dns-lexicon, please run apt "
"install -y python3-lexicon or install it "
" using the Ansible `apt` module."
)
module.fail_json(msg=msg, exception=DNS_LEXICON_IMP_ERR)
domains = retrieve_domain_info(module)

13
meta/main.yml Normal file
View File

@ -0,0 +1,13 @@
---
dependencies: []
galaxy_info:
author: autonomic
description: Ansible libraries for managing Gandi resources.
company: Autonomic
license: GPLv
min_ansible_version: 2.9.6
platforms:
- name: Debian
versions:
- buster

View File

@ -13,7 +13,7 @@ include_trailing_comma = True
[metadata]
name = autonomic.gandi
author = decentral1se
version = 0.0.2
version = 0.0.5
[options]
packages = find:

1
tasks/main.yml Normal file
View File

@ -0,0 +1 @@
---