I have a role, route53-healthcheck, which execute a series of command: 
tasks using the aws cli (Ansible route53 module is for DNS records-only).

I have a dictionary of Application names and metadata in group_vars/all. I 
want am trying to loop over the dictionary using with_dict calling the roll 
each time with different parameters:

route53-healthchecks.yml
---
# create Route53 Health check and CloudWatch Alarm
- name: Route53 Health Checks for all Apps
  hosts: webservers[0]
  connection: local
  gather_facts: no
  roles:
    - { role: route53-healthcheck,
          app: '{{ item.key }}' ,
          app_domain: '{{ app_host }}',
          fqdn: '{{ item.key }}-{{ app_environment }}.{{ app_host }}',
        with_dict: apps }


I am getting an error that 'item' is undefined:


$ ansible-playbook -vvv -i staging route53-healthcheck.yml

PLAY [Route53 Health Checks for all Apps] 
*************************************

TASK: [route53-healthcheck | Route53 Caller Reference for this Health 
Check] ***
fatal: [web-1.us-east-1.example.com] => One or more undefined variables: 
'item' is undefined

FATAL: all hosts have already failed -- aborting

PLAY RECAP 
********************************************************************
           to retry, use: --limit @/home/ubuntu/route53-healthcheck.retry

web-1.us-east-1.example.com : ok=0    changed=0    unreachable=1    failed=0


What is the proper way to loop through calling roles?

Thanks,
Robb

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ae023bb8-226f-456f-be49-99af5840aedb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to