Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

When should I use {{ }}? Also, how to interpolate variables or dynamic variable names

Answer Posted / Pushpendra Singh Thakur

In Ansible, double curly braces `{{ }}` are used for variable interpolation. This means that Ansible replaces the double curly braces with the value of the specified variable at runtime. For example, if you have a variable named `host`, you can use it in your playbook like this: `hosts: {{ host_list }}`. To interpolate dynamic variable names, you can use the `set_fact` or ` vars ` keywords to define a new variable dynamically during the playbook execution.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different components of ansible?

3


How does ansible work?

3


How do I configure a jump host to access servers that I have no direct access to?

3


What are playbooks in ansible?

3


How can you create a lamp stack and deploy a webpage by using ansible?

4


Write an ansible playbook to automate the starting of ec2 instance.

3


How would you access a variable of the first host in a group?

3


Enlist the differences between variable name and environment variables.

3


Can you write a simple playbook to install nginx on a host machine?

3


How to keep secret data in a playbook?

3


Does ansible support hardware provisioning?

3


What does fact mean in ansible?

4


What is ansible role and how are they different from the playbook?

3


Why is ‘{{ }}’ notation used? And how can one interpolate variables or dynamic variable names?

2


How do I see a list of all of the ansible_ variables?

3