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: all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/home/ubuntu/route53-healthcheck.retry
What is the proper way to loop through calling roles?
Thanks,
Robb