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 {{ }}?



When should I use {{ }}?..

Answer / Vijayendra Kumar Gautam

In Ansible, you should use `{{ }}` for variable interpolation. It allows you to reference variables within your playbooks or templates and have their values substituted at runtime. For example:
```yaml
- hosts: webservers
vars:
server_name: mywebsite.com
tasks:
- name: Set hostname
hostname: {{ server_name }}
```
In the example above, the `server_name` variable is interpolated and its value (mywebsite.com) is used to set the hostname on the webservers.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Ansible Interview Questions

How ansible different from the playbook?

1 Answers  


What are ansible vaults and why are they used?

1 Answers  


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

1 Answers  


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

1 Answers  


What are the variables in ansible?

1 Answers  


How can you access a list of ansible_variables?

1 Answers  


How can you handle different machines needing different user accounts or ports to log in with?

1 Answers  


Desired to gain proficiency on ansible?

1 Answers  


How does configuration management is help an organization?

1 Answers  


Explain in detail about ad-hoc command?

1 Answers  


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

1 Answers  


When to use {{}} ? How to interpolate variables or dynamic variable names?

1 Answers  


Categories