# Is there a way to get OS information from ec2.py dynamic inventory script?

**URL:** <https://forum.ansible.com/t/is-there-a-way-to-get-os-information-from-ec2-py-dynamic-inventory-script/18809>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [July 20, 2015, 9:16pm UTC](https://forum.ansible.com/t/is-there-a-way-to-get-os-information-from-ec2-py-dynamic-inventory-script/18809 "2015-07-20T21:16:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_R](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@Adam\_R](https://forum.ansible.com/u/Adam_R)\
**Post date:** [July 20, 2015, 9:16pm UTC](https://forum.ansible.com/t/is-there-a-way-to-get-os-information-from-ec2-py-dynamic-inventory-script/18809/1 "2015-07-20T21:16:54Z")

</div>

Hello,

I would like to know if it is possible to get OS information from the AWS ec2 dynamic inventory script? Like OS distribution. Or how do you get OS information before sshing the host?

Thank you.

B.R.

---

<div class="post-metadata">

**Author:** ![James\_Martin](https://avatars.discourse-cdn.com/v4/letter/j/f14d63/32.png) [@James\_Martin](https://forum.ansible.com/u/James_Martin)\
**Post date:** [July 21, 2015, 12:50am UTC](https://forum.ansible.com/t/is-there-a-way-to-get-os-information-from-ec2-py-dynamic-inventory-script/18809/2 "2015-07-21T00:50:23Z")

</div>

You could modify the ec2.py script so that it checks he ec2\_image\_id and does some logic based around the OS associated with the ec2\_image\_id.

---

<div class="post-metadata">

**Author:** ![Adam\_R](https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/32.png) [@Adam\_R](https://forum.ansible.com/u/Adam_R)\
**Post date:** [July 21, 2015, 4:16pm UTC](https://forum.ansible.com/t/is-there-a-way-to-get-os-information-from-ec2-py-dynamic-inventory-script/18809/3 "2015-07-21T16:16:02Z")

</div>

Hello James,

Thats a good idea. We have like 23 different images installed. Maybe i can do some logic to process only the ones that are different and process the others as always. Thank you!
