|
|
@ -50,6 +50,11 @@ options:
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
choices: [ 'tcp', 'udp' ]
|
|
|
|
choices: [ 'tcp', 'udp' ]
|
|
|
|
default: null
|
|
|
|
default: null
|
|
|
|
|
|
|
|
proxied:
|
|
|
|
|
|
|
|
description: Proxy through cloudflare network or just use DNS
|
|
|
|
|
|
|
|
required: false
|
|
|
|
|
|
|
|
default: no
|
|
|
|
|
|
|
|
version_added: "2.2"
|
|
|
|
record:
|
|
|
|
record:
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Record to add. Required if C(state=present). Default is C(@) (e.g. the zone name)
|
|
|
|
- Record to add. Required if C(state=present). Default is C(@) (e.g. the zone name)
|
|
|
@ -144,6 +149,16 @@ EXAMPLES = '''
|
|
|
|
account_email: test@example.com
|
|
|
|
account_email: test@example.com
|
|
|
|
account_api_token: dummyapitoken
|
|
|
|
account_api_token: dummyapitoken
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# create a my.com CNAME record to example.com and proxy through cloudflare's network
|
|
|
|
|
|
|
|
- cloudflare_dns:
|
|
|
|
|
|
|
|
zone: my.com
|
|
|
|
|
|
|
|
type: CNAME
|
|
|
|
|
|
|
|
value: example.com
|
|
|
|
|
|
|
|
state: present
|
|
|
|
|
|
|
|
proxied: yes
|
|
|
|
|
|
|
|
account_email: test@example.com
|
|
|
|
|
|
|
|
account_api_token: dummyapitoken
|
|
|
|
|
|
|
|
|
|
|
|
# create TXT record "test.my.com" with value "unique value"
|
|
|
|
# create TXT record "test.my.com" with value "unique value"
|
|
|
|
# delete all other TXT records named "test.my.com"
|
|
|
|
# delete all other TXT records named "test.my.com"
|
|
|
|
- cloudflare_dns:
|
|
|
|
- cloudflare_dns:
|
|
|
@ -287,6 +302,7 @@ class CloudflareAPI(object):
|
|
|
|
self.port = module.params['port']
|
|
|
|
self.port = module.params['port']
|
|
|
|
self.priority = module.params['priority']
|
|
|
|
self.priority = module.params['priority']
|
|
|
|
self.proto = module.params['proto']
|
|
|
|
self.proto = module.params['proto']
|
|
|
|
|
|
|
|
self.proxied = module.params['proxied']
|
|
|
|
self.record = module.params['record']
|
|
|
|
self.record = module.params['record']
|
|
|
|
self.service = module.params['service']
|
|
|
|
self.service = module.params['service']
|
|
|
|
self.is_solo = module.params['solo']
|
|
|
|
self.is_solo = module.params['solo']
|
|
|
@ -493,7 +509,7 @@ class CloudflareAPI(object):
|
|
|
|
|
|
|
|
|
|
|
|
def ensure_dns_record(self,**kwargs):
|
|
|
|
def ensure_dns_record(self,**kwargs):
|
|
|
|
params = {}
|
|
|
|
params = {}
|
|
|
|
for param in ['port','priority','proto','service','ttl','type','record','value','weight','zone']:
|
|
|
|
for param in ['port','priority','proto','proxied','service','ttl','type','record','value','weight','zone']:
|
|
|
|
if param in kwargs:
|
|
|
|
if param in kwargs:
|
|
|
|
params[param] = kwargs[param]
|
|
|
|
params[param] = kwargs[param]
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -523,6 +539,9 @@ class CloudflareAPI(object):
|
|
|
|
"ttl": params['ttl']
|
|
|
|
"ttl": params['ttl']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (params['type'] in [ 'A', 'AAAA', 'CNAME' ]):
|
|
|
|
|
|
|
|
new_record["proxied"] = params["proxied"]
|
|
|
|
|
|
|
|
|
|
|
|
if params['type'] == 'MX':
|
|
|
|
if params['type'] == 'MX':
|
|
|
|
for attr in [params['priority'],params['value']]:
|
|
|
|
for attr in [params['priority'],params['value']]:
|
|
|
|
if (attr is None) or (attr == ''):
|
|
|
|
if (attr is None) or (attr == ''):
|
|
|
@ -591,6 +610,7 @@ def main():
|
|
|
|
port = dict(required=False, default=None, type='int'),
|
|
|
|
port = dict(required=False, default=None, type='int'),
|
|
|
|
priority = dict(required=False, default=1, type='int'),
|
|
|
|
priority = dict(required=False, default=1, type='int'),
|
|
|
|
proto = dict(required=False, default=None, choices=[ 'tcp', 'udp' ], type='str'),
|
|
|
|
proto = dict(required=False, default=None, choices=[ 'tcp', 'udp' ], type='str'),
|
|
|
|
|
|
|
|
proxied = dict(required=False, default=False, type='bool'),
|
|
|
|
record = dict(required=False, default='@', aliases=['name'], type='str'),
|
|
|
|
record = dict(required=False, default='@', aliases=['name'], type='str'),
|
|
|
|
service = dict(required=False, default=None, type='str'),
|
|
|
|
service = dict(required=False, default=None, type='str'),
|
|
|
|
solo = dict(required=False, default=None, type='bool'),
|
|
|
|
solo = dict(required=False, default=None, type='bool'),
|
|
|
|