Valid EX374 Dumps shared by EduDump.com for Helping Passing EX374 Exam! EduDump.com now offer the newest EX374 exam dumps, the EduDump.com EX374 exam questions have been updated and answers have been corrected get the newest EduDump.com EX374 dumps with Test Engine here:
Set up a database query as a dynamic inventory source.
Correct Answer:
# db_inventory.py import sqlite3, json connection = sqlite3.connect("inventory.db") cursor = connection.cursor() cursor.execute("SELECT hostname, ip FROM hosts") inventory = {"all": {"hosts": {}}} for row in cursor.fetchall(): inventory["all"]["hosts"][row[0]] = {"ansible_host": row[1]} print(json.dumps(inventory)) Explanation: Dynamic inventory from a database ensures inventories are generated based on up-to-date information stored in the database.