Reputation: 3
Global variable group_vars/all.yml
---
dir:
website_A: /var/www/html/a
website_B: /var/www/html/b
I have created Ansible role health-check
which accepts input variable site
, it can have values website_A
or website_B
. This role will perform some actions based on the input variable site
. I tried with the following settings, but it didn't worked.
chdir: "{{ "dir." + site }}"
As per the FAQ, we can make this work using hostvars or vars dictionary, but I didn't succeed in that.
Upvotes: 0
Views: 183
Reputation: 68229
You have a kind of unbalanced quotes.
Try chdir: "{{ 'dir.' + site }}"
or chdir: dir.{{ site }}
Upvotes: 1