- Ansible 2 Cloud Automation Cookbook
- Aditya Patawari Vikas Aggarwal
- 134字
- 2021-06-24 18:43:41
How to do it...
We can use the Route53 module for creating, retrieving, and deleting a Route53 record. In the following task, we have assumed that the DNS zone example.com belongs to us and has been registered with the AWS Route53 service:
- To create a Route53 record, do the following:
- name: Create Route53 record route53: state: present zone: example.com record: app.example.com type: A ttl: 7200 value: - 1.1.1.1 - 2.2.2.2 - 3.3.3.3 tags: - recipe2
- To get an existing Route53 record, do the following:
- name: Get existing Route53 record route53: state: get zone: example.com record: dns.example.com type: A register: record tags: - recipe2
- To delete a Route53 record, do the following:
- name: Delete existing Route53 record route53: state: absent zone: example.com record: "{{ record.set.record }}" ttl: "{{ record.set.ttl }}" type: "{{ record.set.type }}" value: "{{ record.set.value }}" tags: - recipe2