Listing alias record from route53

13 views
Skip to first unread message

Suresh Prajapati

unread,
Nov 5, 2017, 10:54:41 PM11/5/17
to Ansible Project
Hi,

I am writing a route53 module for internal usage. For that, I want to list the alias records from route53.


---
- name: retrieve details for lb.example.io
  strategy: debug
  hosts: localhost
  tasks:
    - route53:
        state: get
        zone: example.io
        record: lb.example.io
        type: A
      register: rec
    - name: Print record
      debug:
         var: rec



This is the run output

PLAY [retrieve details for lb.example.io] ******************************************************************************

TASK [Gathering Facts] ***********************************************************************************************
ok: [localhost]

TASK [route53] *******************************************************************************************************
ok: [localhost]

TASK [Print record] **************************************************************************************************
ok: [localhost] => {
    "rec": {
        "changed": false,
        "failed": false,
        "nameservers": [
            "ns-464.awsdns-58.com.",
            "ns-1140.awsdns-14.org.",
            "ns-1893.awsdns-44.co.uk.",
            "ns-691.awsdns-22.net."
        ],
        "set": {}
    }
}

PLAY RECAP ***********************************************************************************************************
localhost


When I list the record using AWS CLI, I get the following answer

⚡ aws route53 list-resource-record-sets --hosted-zone-id *********** --query "ResourceRecordSets[?Name == 'lb.example.io.']" |jq .[].AliasTarget.DNSName




I am following route53 core module.   My ansible version is 

⚡ ansible --version
ansible 2.4.1.0


Please suggest if I am missing something here.

thanks 
Reply all
Reply to author
Forward
0 new messages