...
|
...
|
@@ -67,6 +67,8 @@ def dns_inqure(SecretId,SecretKey,domain_name,value): |
|
|
ret["recordType_old"] = lines["type"]
|
|
|
ret["recordType_new"] = recordType
|
|
|
ret["recordLine"] = lines["line"]
|
|
|
ret["ttl"] = lines["ttl"]
|
|
|
#ret["mx"] = lines["mx"]
|
|
|
ret["code"] = 0
|
|
|
break
|
|
|
else:
|
...
|
...
|
@@ -86,12 +88,12 @@ def dns_inqure(SecretId,SecretKey,domain_name,value): |
|
|
'''
|
|
|
通过调用接口RecordModify修改域名解析记录
|
|
|
'''
|
|
|
def dns_modify(SecretId,SecretKey,domain_name,value,subDomain,domain,recordType,recordId,recordLine):
|
|
|
def dns_modify(SecretId,SecretKey,domain_name,value,subDomain,domain,recordType,recordId,recordLine,ttl):
|
|
|
ret = {}
|
|
|
# 调用域名解析接口RecordModify修改域名解析记录
|
|
|
try:
|
|
|
domain_modify_api = QcloudApi(secretId=SecretId,secretKey=SecretKey)
|
|
|
dns_info = domain_modify_api.do_query(params={'Action':'RecordModify','domain':domain,'recordId':recordId,'subDomain':subDomain,'recordType':recordType,'recordLine':recordLine,'value':value})
|
|
|
dns_info = domain_modify_api.do_query(params={'Action':'RecordModify','domain':domain,'recordId':recordId,'subDomain':subDomain,'recordType':recordType,'recordLine':recordLine,'value':value,'ttl':ttl})
|
|
|
ret["code"] = dns_info["code"]
|
|
|
ret["err"] = dns_info['message']
|
|
|
except Exception,e:
|
...
|
...
|
@@ -144,7 +146,7 @@ def run_module(): |
|
|
module.exit_json(**result)
|
|
|
# 非check模式下执行修改接口 执行语句:ansible-playbook playbooks/domain.modify.yml
|
|
|
else:
|
|
|
modify_result = dns_modify(secretId,secretKey,domain_name, value,ret["subDomain"],ret["domain"],ret["recordType_new"],ret["recordId"],ret["recordLine"])
|
|
|
modify_result = dns_modify(secretId,secretKey,domain_name, value,ret["subDomain"],ret["domain"],ret["recordType_new"],ret["recordId"],ret["recordLine"],ret["ttl"])
|
|
|
if modify_result['code'] != 0:
|
|
|
module.fail_json(msg='Modify Failed: code: %i, err: %s' % (modify_result['code'], modify_result['err']), **result)
|
|
|
result['changed'] = True
|
...
|
...
|
|