# How can I pass predefined variable to playbook's “- hosts: ”POD\_'+VARIABLE+'\_master\_sn“”

**URL:** <https://forum.ansible.com/t/how-can-i-pass-predefined-variable-to-playbooks-hosts-pod-variable-master-sn/32331>\
**Category:** Ansible Project\
**Created:** [February 26, 2020, 9:33am UTC](https://forum.ansible.com/t/how-can-i-pass-predefined-variable-to-playbooks-hosts-pod-variable-master-sn/32331 "2020-02-26T09:33:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anton\_Tsurkanu](https://avatars.discourse-cdn.com/v4/letter/a/2bfe46/32.png) [@Anton\_Tsurkanu](https://forum.ansible.com/u/Anton_Tsurkanu)\
**Post date:** [February 26, 2020, 9:33am UTC](https://forum.ansible.com/t/how-can-i-pass-predefined-variable-to-playbooks-hosts-pod-variable-master-sn/32331/1 "2020-02-26T09:33:53Z")

</div>

I need to read VARIABLE from some pre-defined file, not from the console.

I have a file named “all” under group\_vars with predefined variable, the value of which can be changed, let say, from “C” to "D’ depends on what I need:

`  
VARIABLE: C

`

Also, I have a task under my playbook:

```auto

- hosts: "POD_'+VARIABLE+'_master_sn" # or - hosts: "{{ 'POD_' + source_pod_name_capital_letter + '_master_sn' }}"
  tasks:
    - include_role:
        name: sn_static_hosts 
        tasks_from: remove

```

As you can see, I want to perform concatenation, but getting this:

`  
[WARNING]: Could not match supplied host pattern, ignoring: POD\_‘+source\_pod\_name\_capital\_letter+’\_master\_sn

or this:

ERROR! The field ‘hosts’ has an invalid value, which includes an undefined variable. The error was: ‘source\_pod\_name\_capital\_letter’ is undefined

`

I have tried to play with brackets, removed/added “+” etc, but got only warnings or errors.

Is that possible to have this kind of concatenation?
