When deploying an app (on ec2) I need to setup a file with all the redis instances the app will use.
But I can’t find a way to enumerate all redis instances that I have on AWS elasticache.
When deploying an app (on ec2) I need to setup a file with all the redis instances the app will use.
But I can’t find a way to enumerate all redis instances that I have on AWS elasticache.
If you have a redis group of servers you can do something like:
{% for host in groups['redis'] %}
{{ hostvars[host].ansible_default_ipv4.address }}
{% endfor %}
Which will print the IP address of that host in the template file.
I’m using the ‘ec2.py’ inventory script and it doesn’t report or group the elasticache instances.
While there are probably other suggestions people would offer up, I’d probably consider tagging your redis machines “redis”, that way it will automatically make a group of them, and they will be easier to manage.
These are not “redis machines”, it’s about instances of the ElastiCache service.
Unlike the RDS instances, ElastiCache instances don’t show up in the inventory.