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
Aug 05, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed hyperleger inventory
parent
9197f050
Changes
1
Show 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:
...
@@ -200,32 +200,34 @@ class AnsibleService:
children
=
{}
children
=
{}
for
vm
in
vms
:
for
vm
in
vms
:
attributes
=
vm
.
node_template
.
attributes
attributes
=
vm
.
node_template
.
attributes
public_ip
=
attributes
[
'public_ip'
]
vm_vars
=
{
'ansible_host'
:
public_ip
}
vm_vars
.
update
(
vars
)
roles
=
[]
roles
=
[]
if
attributes
[
'role'
]
==
'master'
:
if
attributes
[
'role'
]
==
'master'
:
roles
.
append
(
'swarm_manager_prime'
)
roles
.
append
(
'swarm_manager_prime'
)
roles
.
append
(
'swarm_managers'
)
roles
.
append
(
'swarm_managers'
)
elif
attributes
[
'role'
]
==
'worker'
:
elif
attributes
[
'role'
]
==
'worker'
:
roles
.
append
(
'swarm_workers'
)
roles
.
append
(
'swarm_workers'
)
public_ip
=
attributes
[
'public_ip'
]
fabric_count
=
0
# 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 role == 'swarm_manager_prime' or role == 'swarm_managers':
if
role
==
'swarm_manager_prime'
or
role
==
'swarm_managers'
:
# hosts['hosts'] = {'fabric-manager': vars}
host
=
{
'hlf'
+
str
(
fabric_count
):
vm_vars
}
# else:
# hosts['hosts'] = {'fabric-worker': vars}
hosts
[
'hosts'
]
=
{
public_ip
:
vars
}
else
:
else
:
host
=
{}
fabric_count
+=
1
host
[
public_ip
]
=
vars
host
=
{
'hlf'
+
str
(
fabric_count
):
vm_vars
}
# if role == 'swarm_manager_prime' or role == 'swarm_managers':
hosts
[
'hosts'
]
=
host
# host = {'fabric-manager': vars}
else
:
# else:
if
role
==
'swarm_manager_prime'
or
role
==
'swarm_managers'
:
# host = {'fabric-worker': vars}
host
=
{
'hlf'
+
str
(
fabric_count
):
vm_vars
}
else
:
fabric_count
+=
1
host
=
{
'hlf'
+
str
(
fabric_count
):
vm_vars
}
hosts
[
'hosts'
]
=
host
hosts
[
'hosts'
]
=
host
children
[
role
]
=
hosts
children
[
role
]
=
hosts
all
[
'children'
]
=
children
all
[
'children'
]
=
children
...
...
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