ansible-facts | Ansible module to produce own facts | Wrapper library
kandi X-RAY | ansible-facts Summary
kandi X-RAY | ansible-facts Summary
Ansible module (python) to produce own "facts"
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ansible-facts
ansible-facts Key Features
ansible-facts Examples and Code Snippets
Community Discussions
Trending Discussions on ansible-facts
QUESTION
I want to select different options based on the aws region and availability zone of my instances. As a very simple example, I'd like to set the timezone of the instance to the correct timezone based on the region.
I can get the region and the availability zone from the ohai_ec2 facts.
How do I use the fact to select from a list of variables?
I tried referencing the variable directly, and that works for when statements e.g.
...ANSWER
Answered 2019-Aug-13 at 21:47If you have a dictionary named mytz
(which you do), and you have a dictionary ohai_ec2
with a region
key, you can use the value of that key to select a value from mytz
like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ansible-facts
You can use ansible-facts like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page