I have a variables file like so
apps:
appOne:
slug: none
ports:
- "8999:8999"
kong:
slug: somerepo/ansible.kong.git
ports:
- "8000:8000"
- "8001:8001"
- "8443:8443"
- "8445:8445"
in my vars/apps_config file
I'm trying to figure out the ports based on the {{ app_name }} but can't seem to find a way to drill into the apps object.
So in my yml file I'm executing I have
vars_files:
- "vars/app_config"
vars:
app_name: kong
container_ports: "{{ apps [{{ app_name }}]['ports'] }}"
but ansible doesn't like the nested variable {{ app_name }}. I saw someone mention using vars['somestring'] before but the following doesn't seem to work
vars['apps.{{ app_name }}']
any ideas?