forked from guifi-org/guifiadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinventory.py
More file actions
executable file
·32 lines (26 loc) · 836 Bytes
/
inventory.py
File metadata and controls
executable file
·32 lines (26 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python
import os
import argparse
import django
from guifiadmin.extended_json import dumps
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "guifiadmin.settings")
django.setup()
parser = argparse.ArgumentParser(
description="Ansible inventory"
)
parser.add_argument('--list', action='store_true', help='return full ansible inventory.')
if __name__ == "__main__":
from guifi.inventory import ansible_inventory as guifi_inventory
from vpn.inventory import ansible_inventory as vpn_inventory
args = parser.parse_args()
if args.list:
data = {
'_meta': {
'hostvars': {}
},
}
data = guifi_inventory(data)
data = vpn_inventory(data)
else:
data = '{}' # No response for other parametters
print dumps(data, indent=4)