- String, this is the name of the droplet - must be formatted by hostname rules, or the name of a SSH key.
- String, this is the name of the droplet - must be formatted by hostname rules, or the name of a SSH key, or the name of a domain.
unique_name:
unique_name:
description:
description:
- Bool, require unique hostnames. By default, digital ocean allows multiple hosts with the same name. Setting this to "yes" allows only one host per name. Useful for idempotence.
- Bool, require unique hostnames. By default, digital ocean allows multiple hosts with the same name. Setting this to "yes" allows only one host per name. Useful for idempotence.
@ -75,6 +75,9 @@ options:
ssh_pub_key:
ssh_pub_key:
description:
description:
- The public SSH key you want to add to your account.
- The public SSH key you want to add to your account.
ip:
description:
- The IP address to point a domain at.
notes:
notes:
- Two environment variables can be used, DO_CLIENT_ID and DO_API_KEY.
- Two environment variables can be used, DO_CLIENT_ID and DO_API_KEY.
@ -141,6 +144,31 @@ EXAMPLES = '''
size_id=1
size_id=1
region_id=2
region_id=2
image_id=3
image_id=3
# Create a domain record
- digital_ocean: >
state=present
command=domain
name=my.digitalocean.domain
ip=127.0.0.1
# Create a droplet and a corresponding domain record
- digital_cean: >
state=present
command=droplet
name=test_droplet
size_id=1
region_id=2
image_id=3
register: test_droplet
- digital_ocean: >
state=present
command=domain
name={{ test_droplet.name }}.my.domain
ip={{ test_droplet.ip_address }}
'''
'''
import sys
import sys
@ -275,6 +303,72 @@ class SSH(JsonfyMixIn):
json = cls.manager.new_ssh_key(name, key_pub)
json = cls.manager.new_ssh_key(name, key_pub)
return cls(json)
return cls(json)
class DomainRecord(JsonfyMixIn):
manager = None
def __init__(self, json):
self.__dict__.update(json)
update_attr = __init__
def update(self, data = None, record_type = None):