I want to build a variable name at play level which is the result of different variables.
In the following example I need to replace TEST
(that is included in vars.yaml) by a variable name which comes from the inventory.
E.g.
playbook.yaml
---
- hosts: server1
gather_facts: true
vars_files:
- vars.yaml
vars:
ansible_password: '{{ var1.name1.TEST }}'
tasks:
- debug:
msg: '{{ ansible_password }}'
vars.yaml
var1:
name1:
TEST: "prova"
server1 hostvars
environment_value: TEST