Commit 9197f050 authored by Spiros Koulouzis's avatar Spiros Koulouzis

fixed hyperleger inventory

parent 461fd918
...@@ -65,11 +65,16 @@ class AnsibleService: ...@@ -65,11 +65,16 @@ class AnsibleService:
arguments = '["-u","vm_user"]' arguments = '["-u","vm_user"]'
if playbook_name == '013.mount_fs.yml': if playbook_name == '013.mount_fs.yml':
master_ip = next(iter( master_ip = next(iter(
inventory_dict['all']['children']['swarm_manager_prime']['hosts'])) # outputs 'foo' inventory_dict['all']['children']['swarm_manager_prime']['hosts']))
arguments = '["-u","vm_user","--extra-vars","gluster_cluster_host0=\'' + master_ip + '\' gluster_cluster_volume=\'gfs0\'"]' arguments = '["-u","vm_user","--extra-vars","gluster_cluster_host0=\'' + master_ip + '\' gluster_cluster_volume=\'gfs0\'"]'
task_id = self.run_task(name, project_id, key_id, git_url, inventory_id, playbook_name, task_id = self.run_task(name, project_id, key_id, git_url, inventory_id, playbook_name,
environment_id=environment_id, arguments=arguments) environment_id=environment_id, arguments=arguments)
if self.semaphore_helper.get_task(project_id, task_id).status != 'success': count = 0
while self.semaphore_helper.get_task(project_id, task_id).status != 'success':
task_id = self.run_task(name, project_id, key_id, git_url, inventory_id, playbook_name,
environment_id=environment_id, arguments=arguments)
count += 1
if count >= 3:
msg = ' ' msg = ' '
for out in self.semaphore_helper.get_task_outputs(project_id, task_id): for out in self.semaphore_helper.get_task_outputs(project_id, task_id):
msg = msg + ' ' + out.output msg = msg + ' ' + out.output
...@@ -202,26 +207,25 @@ class AnsibleService: ...@@ -202,26 +207,25 @@ class AnsibleService:
elif attributes['role'] == 'worker': elif attributes['role'] == 'worker':
roles.append('swarm_workers') roles.append('swarm_workers')
public_ip = attributes['public_ip'] public_ip = attributes['public_ip']
# vars['ansible_host'] = public_ip
for role in roles: for role in roles:
if role not in children: if role not in children:
hosts = {} hosts = {}
else: else:
hosts = children[role] hosts = children[role]
if 'hosts' in hosts: if 'hosts' in hosts:
# if attributes['role'] == 'master': # if role == 'swarm_manager_prime' or role == 'swarm_managers':
hosts['hosts'] = {public_ip: vars} # hosts['hosts'] = {'fabric-manager': vars}
# else: # else:
# hosts['hosts'] = {public_ip: vars} # hosts['hosts'] = {'fabric-worker': vars}
hosts['hosts'] = {public_ip: vars}
else: else:
host = {} host = {}
host[public_ip] = vars host[public_ip] = vars
# if role == 'swarm_manager_prime': # if role == 'swarm_manager_prime' or role == 'swarm_managers':
# host['fabric-manager'] = vars # host = {'fabric-manager': vars}
# elif role == 'swarm_managers':
# host['fabric-manager'] = {}
# else: # else:
# host['fabric-worker'] = vars # host = {'fabric-worker': vars}
hosts['hosts'] = host hosts['hosts'] = host
children[role] = hosts children[role] = hosts
all['children'] = children all['children'] = children
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment