Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
1e4a2672
Commit
1e4a2672
authored
4 years ago
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed hyperleger inventory
parent
9197f050
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
ansible_service.py
deployer/service/ansible_service.py
+15
-13
No files found.
deployer/service/ansible_service.py
View file @
1e4a2672
...
...
@@ -200,32 +200,34 @@ class AnsibleService:
children
=
{}
for
vm
in
vms
:
attributes
=
vm
.
node_template
.
attributes
public_ip
=
attributes
[
'public_ip'
]
vm_vars
=
{
'ansible_host'
:
public_ip
}
vm_vars
.
update
(
vars
)
roles
=
[]
if
attributes
[
'role'
]
==
'master'
:
roles
.
append
(
'swarm_manager_prime'
)
roles
.
append
(
'swarm_managers'
)
elif
attributes
[
'role'
]
==
'worker'
:
roles
.
append
(
'swarm_workers'
)
public_ip
=
attributes
[
'public_ip'
]
# vars['ansible_host'] = public_ip
fabric_count
=
0
for
role
in
roles
:
if
role
not
in
children
:
hosts
=
{}
else
:
hosts
=
children
[
role
]
if
'hosts'
in
hosts
:
# if role == 'swarm_manager_prime' or role == 'swarm_managers':
# hosts['hosts'] = {'fabric-manager': vars}
# else:
# hosts['hosts'] = {'fabric-worker': vars}
hosts
[
'hosts'
]
=
{
public_ip
:
vars
}
if
role
==
'swarm_manager_prime'
or
role
==
'swarm_managers'
:
host
=
{
'hlf'
+
str
(
fabric_count
):
vm_vars
}
else
:
fabric_count
+=
1
host
=
{
'hlf'
+
str
(
fabric_count
):
vm_vars
}
hosts
[
'hosts'
]
=
host
else
:
host
=
{}
host
[
public_ip
]
=
vars
# if role == 'swarm_manager_prime' or role == 'swarm_managers':
# host = {'fabric-manager': vars}
# else:
# host = {'fabric-worker': vars}
if
role
==
'swarm_manager_prime'
or
role
==
'swarm_managers'
:
host
=
{
'hlf'
+
str
(
fabric_count
):
vm_vars
}
else
:
fabric_count
+=
1
host
=
{
'hlf'
+
str
(
fabric_count
):
vm_vars
}
hosts
[
'hosts'
]
=
host
children
[
role
]
=
hosts
all
[
'children'
]
=
children
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment