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...


What is the way to access shell environment variables in ansible?



What is the way to access shell environment variables in ansible?..

Answer / Manoj Kumar Tiwari

To access shell environment variables in Ansible, you can use the `env` keyword or the `set_fact` module. The `env` keyword allows you to pass environment variables as a dictionary to your tasks or plays. For example: `- env: VARIABLE=value`. You can also define environment variables using `set_fact` in a playbook, making them available for later use:
```yaml
- hosts: myhost
vars:
MYVAR: some_value
tasks:
- debug: var=MYVAR"
```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Ansible Interview Questions

How to keep secret data in playbook?

0 Answers  


Describe the working of ansible.

1 Answers  


What are ad-hoc commands?

1 Answers  


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

0 Answers  


Why is ‘{{ }}’ notation used?

1 Answers  


How can I display all the inventory vars defined for my host?

1 Answers  


Compare ansible with chef.

1 Answers  


How do I access a variable name programmatically?

0 Answers  


How can you speed up management inside in ec2?

1 Answers  


How to interpolate variables or dynamic variable names?

1 Answers  


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

1 Answers  


What is ansible galaxy?

1 Answers  


Categories