summaryrefslogtreecommitdiffstats
path: root/build-gluster-org/scripts/distributed-regression.py
blob: 820c3a04aea001823f7c09b4bef2c2c36f3cf1a5 (plain)
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
#!/usr/bin/env python
import subprocess
import os
from ansible.parsing.dataloader import DataLoader
from ansible.vars.manager import VariableManager
from ansible.inventory.manager import InventoryManager


def get_ansible_host_ip():
   loader = DataLoader()
   inventory = InventoryManager(loader=loader, sources='hosts')
   variable_manager = VariableManager(loader=loader, inventory=inventory)
   hostnames = []
   for host in inventory.get_hosts():
       hostnames.append(variable_manager.get_vars(host=host))
   ip = ' '.join([str(i['ansible_host']) for i in hostnames])
   return str(ip)


def main():
    ip = get_ansible_host_ip()
    subprocess.call(['./extras/distributed-testing/distributed-test.sh', '--hosts', '%s' % ip, '--id-rsa', 'key', '-v'])


main()