domain.modify.yml 786 Bytes
---
# 修改腾讯云域名解析记录值: ansible-playbook playbooks/domain.modify.yml -e '{"domain_name":"www.yohotest.xyz","new_record":"1.2.3.4"}' --check -vvv

- hosts: localhost

  vars_prompt:
    - name: "domain_name"
      prompt: "Input the domain name"
      private: no
    - name: "new_record"
      prompt: "Input the record value"
      private: no

  vars_files:
    - extra_vars/all.yml

  vars:
    qcloud_key: "{{ lookup('hashi_vault',  'secret=yoho/ops/qcloud token='+'{{vault.token}}'+' url='+'{{vault.server}}') }}"

  tasks: 
    - name: 修改域名映射的IP或CNAME
      domain_modify:
        secretId: "{{ qcloud_key.SecretId }}"
        secretKey: "{{ qcloud_key.SecretKey }}"
        domain_name: "{{ domain_name }}"
        value: "{{ new_record }}"