Help formatting local_action output to facts

How do I get my task to return the output as key=value pairs? I’d like to set the four values returned when I do msg= to key name nameserver1,2,3,4.

  • debug: msg=“{{route53_hosted_zones.stdout.split() }}”

  • debug: var={{route53_hosted_zones.stdout.split() }}

TASK: [route53 | debug msg=“{{route53_hosted_zones.stdout.split()}}”] *********
ESTABLISH CONNECTION FOR USER: ubuntu
ok: [localhost] => {
“item”: “”,
“msg”: “[u’ns-892.awsdns-47.net’, u’ns-167.awsdns-20.com’, u’ns-1965.awsdns-53.co.uk’, u’ns-1105.awsdns-10.org’]”
}

TASK: [route53 | debug var={{route53_hosted_zones.stdout.split()}}] ***********
ESTABLISH CONNECTION FOR USER: ubuntu
ok: [localhost] => {
“[uns-892.awsdns-47.net,”: “{{ [uns-892.awsdns-47.net, }}”,
“item”: “”
}

The task:

  • name: create {{ domain_name }} zone
    local_action: shell executable=/bin/sh aws route53 create-hosted-zone --name {{ domain_name }} --caller-reference Job{{ job_number }} --query DelegationSet.NameServers --output text
    register: route53_hosted_zones

The shell module returns a stdout_lines key which is already split() ...

$ cat site.yml
- hosts: localhost
   connection: local
   gather_facts: False
   tasks:
     - shell: for i in $(seq 1 5); do echo $i; done
       register: result
     - debug: var=result

# EXAMPLE OUTPUT ....
TASK: [debug var=result]