This is a quick post on how to use environment variables in ansible
Inventory
Our inventory.ini
file looks like this:
1 2 |
|
Across Tasks
You can set environment variables across tasks, and let your tasks inherit the variables:
1 2 3 4 5 6 7 8 9 10 11 |
|
When we run the task:
1
|
|
Check the output:
1 2 |
|
Environment Variables Per Task
You can set environment variables per task:
1 2 3 4 5 6 7 8 |
|
Running the task:
1
|
|
Checking the output:
1 2 |
|
Read More
Read more on environment variables in ansible in their documentation