summaryrefslogtreecommitdiffstats
path: root/build-gluster-org/scripts/distributed-regression.py
blob: 56e724bffab6940e73ba93e82b5ff7d8d2838f34 (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='\t'.join([str(i['ansible_host']) for i in hostnames])
   return ip


def main():
    ip = get_ansible_host_ip()
    subprocess.call("./extras/distributed-testing/distributed-test.sh --hosts {0} --id_rsa 'key'".format(ip))


main()