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

What is ansible galaxy?

1 Answers  


How do I handle different machines needing different user accounts or ports to log in with?

1 Answers  


What is the best way to make content reusable/redistributable?

1 Answers  


Can you copy files recursively onto a target host? If yes, how?

1 Answers  


How to keep secret data in a playbook?

1 Answers  


Compare ansible vs puppet?

1 Answers  


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

1 Answers  


Explain different modules in ansible.

1 Answers  


What are the different components of ansible? Explain ansible architecture.

1 Answers  


How to create encrypted files using ansible?

1 Answers  


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

1 Answers  


How do I copy files recursively onto a target host?

0 Answers  


Categories