How to handle case when dynamic inventory initially returns empty host list?

Let’s suppose I have a custom dynamic inventory fetches instances from EC2 and makes an inventory from them and then if certain required instances do not exist they are created in the playbook and then inventory is refreshed using “meta: refresh_inventory” task.

My problem is that when initial inventory is empty (because there is no instances at all) - Ansible just stops.

I wonder - is there a recommended idiom to solve such problem?

Perhaps add a static inventory item alongside the dynamic so the scripts can run against ansible localhost to create the remote inventory?

https://www.linuxtechi.com/manage-ansible-static-and-dynamic-host-inventory/

http://allandenot.com/devops/2015/01/16/ansible-with-multiple-inventory-files.html