neoave / mrack

Multicloud use-case based multihost async provisioner for CIs and testing during development
Apache License 2.0
12 stars 14 forks source link

Ansible Inventory and pytest-multihost output modules #7

Closed pvoborni closed 4 years ago

pvoborni commented 4 years ago

Add Ansible Inventory and pytest-multihost output modules

And enhance "up" action to use them. Add also "output" action which calls them separately. It can be used for recreation of deleted ones or testing.

hosts: adding missing properties

So that they can be work with in output modules.

pvoborni commented 4 years ago

@Tiboris or @netoarmando , let me know if I should merge this.

pvoborni commented 4 years ago

Fixed also comment in Ansible Inventory as it was incorrectly referencing to Linchpin.

pvoborni commented 4 years ago

I've also found an issue that the resulting Ansible inventory was not correct. PR updated with fix:

--- a/src/aiohabit/outputs/ansible_inventory.py
+++ b/src/aiohabit/outputs/ansible_inventory.py
@@ -19,7 +19,7 @@ from aiohabit.outputs.utils import is_windows_host, resolve_hostname
 from aiohabit.utils import get_config_value, get_host_from_metadata, save_yaml

 DEFAULT_INVENTORY_PATH = "aiohabit-inventory.yaml"
-DEFAULT_INVENTORY_LAYOUT = {"all": {"children": [], "hosts": {}}}
+DEFAULT_INVENTORY_LAYOUT = {"all": {"children": {}, "hosts": {}}}

now e.g. ansible -i aiohabit-inventory.yaml -m shell -a "hostname" all should work