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
26b7efd8
Commit
26b7efd8
authored
Apr 10, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
deployer works with playbooks. Missing the k8s dashboard
parent
6ce96ef2
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
121 additions
and
43 deletions
+121
-43
requirements.txt
deployer/requirements.txt
+2
-2
ansible_service.py
deployer/service/ansible_service.py
+23
-13
test_deployer.py
deployer/test/test_deployer.py
+9
-6
docker-compose.yml
docker-compose.yml
+20
-20
ExoGENI.yml
provisioner/etc/UD/ExoGENI.yml
+60
-0
semaphore_helper.py
...hon-client-generated/semaphore_client/semaphore_helper.py
+7
-2
No files found.
deployer/requirements.txt
View file @
26b7efd8
...
@@ -6,9 +6,9 @@ wheel==0.34.2
...
@@ -6,9 +6,9 @@ wheel==0.34.2
pyyaml==5.3.1
pyyaml==5.3.1
matplotlib==3.2.1
matplotlib==3.2.1
# ansible==2.9.6
# ansible==2.9.6
certifi==20
19.11.28
certifi==20
20.4.5.1
six==1.14.0
six==1.14.0
python_dateutil==2.8.1
python_dateutil==2.8.1
setuptools==46.
0.0
setuptools==46.
1.3
urllib3==1.25.8
urllib3==1.25.8
deployer/service/ansible_service.py
View file @
26b7efd8
...
@@ -54,6 +54,9 @@ class AnsibleService:
...
@@ -54,6 +54,9 @@ class AnsibleService:
playbook_names
=
inputs
[
'playbooks'
]
playbook_names
=
inputs
[
'playbooks'
]
for
playbook_name
in
playbook_names
:
for
playbook_name
in
playbook_names
:
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
)
if
self
.
semaphore_helper
.
get_task
(
project_id
,
task_id
)
.
status
!=
'success'
:
break
if
self
.
semaphore_helper
.
get_task
(
project_id
,
task_id
)
.
status
==
'success'
:
if
self
.
semaphore_helper
.
get_task
(
project_id
,
task_id
)
.
status
==
'success'
:
configure
=
standard
[
'configure'
]
configure
=
standard
[
'configure'
]
inputs
=
configure
[
'inputs'
]
inputs
=
configure
[
'inputs'
]
...
@@ -61,6 +64,8 @@ class AnsibleService:
...
@@ -61,6 +64,8 @@ class AnsibleService:
playbook_names
=
inputs
[
'playbooks'
]
playbook_names
=
inputs
[
'playbooks'
]
for
playbook_name
in
playbook_names
:
for
playbook_name
in
playbook_names
:
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
)
if
self
.
semaphore_helper
.
get_task
(
project_id
,
task_id
)
.
status
!=
'success'
:
break
def
build_yml_inventory
(
self
,
vms
):
def
build_yml_inventory
(
self
,
vms
):
# loader = DataLoader()
# loader = DataLoader()
...
@@ -94,19 +99,24 @@ class AnsibleService:
...
@@ -94,19 +99,24 @@ class AnsibleService:
return
base64
.
b64decode
(
private_key
)
.
decode
(
'utf-8'
)
.
replace
(
r'\n'
,
'
\n
'
)
return
base64
.
b64decode
(
private_key
)
.
decode
(
'utf-8'
)
.
replace
(
r'\n'
,
'
\n
'
)
def
run_task
(
self
,
name
,
project_id
,
key_id
,
git_url
,
inventory_id
,
playbook_name
):
def
run_task
(
self
,
name
,
project_id
,
key_id
,
git_url
,
inventory_id
,
playbook_name
):
logger
.
info
(
'task name: '
+
str
(
name
)
+
' git url: '
+
git_url
+
' playbook: '
+
playbook_name
)
logger
.
info
(
'project_id: '
+
str
(
project_id
)
+
' task name: '
+
str
(
name
)
+
' git url: '
+
git_url
+
' playbook: '
+
playbook_name
)
if
not
self
.
repository_id
:
self
.
repository_id
=
self
.
semaphore_helper
.
create_repository
(
name
,
project_id
,
key_id
,
git_url
)
self
.
repository_id
=
self
.
semaphore_helper
.
create_repository
(
name
,
project_id
,
key_id
,
git_url
)
template_id
=
self
.
semaphore_helper
.
create_template
(
project_id
,
key_id
,
inventory_id
,
self
.
repository_id
,
template_id
=
self
.
semaphore_helper
.
create_template
(
project_id
,
key_id
,
inventory_id
,
self
.
repository_id
,
playbook_name
)
playbook_name
)
#
task_id
=
self
.
semaphore_helper
.
execute_task
(
project_id
,
template_id
,
playbook_name
)
# task_id = self.semaphore_helper.execute_task(project_id, template_id, playbook_name)
task
=
self
.
semaphore_helper
.
get_task
(
project_id
,
task_id
)
# task = self.semaphore_helper.get_task(project_id, task_id)
last_output
=
''
# while task.status == 'waiting' or task.status == 'running':
while
task
.
status
==
'waiting'
or
task
.
status
==
'running'
:
# task = self.semaphore_helper.get_task(project_id, task_id)
task
=
self
.
semaphore_helper
.
get_task
(
project_id
,
task_id
)
# logger.info('task status: ' + str(task.status))
logger
.
info
(
'task name: '
+
name
+
' task status: '
+
str
(
task
.
status
))
# task_outputs = self.semaphore_helper.get_task_outputs(project_id, task_id)
task_outputs
=
self
.
semaphore_helper
.
get_task_outputs
(
project_id
,
task_id
)
# sleep(1.5)
this_output
=
task_outputs
[
len
(
task_outputs
)
-
1
]
.
output
.
replace
(
r'\n'
,
'
\n
'
)
.
replace
(
r'\r'
,
'
\r
'
)
# task_outputs = self.semaphore_helper.get_task_outputs(project_id, task_id)
if
last_output
!=
this_output
:
# # logger.info('task_output: ' + str(task_outputs))
logger
.
info
(
'task output: '
+
str
(
this_output
))
return
None
#task_id
last_output
=
this_output
# logger.info('task output: ' + str(latask name:st_output))
sleep
(
3
)
return
task_id
deployer/test/test_deployer.py
View file @
26b7efd8
...
@@ -8,6 +8,7 @@ import time
...
@@ -8,6 +8,7 @@ import time
import
yaml
import
yaml
import
re
# noqa: F401
import
re
# noqa: F401
from
pathlib
import
Path
import
unittest
import
unittest
import
sure_tosca_client
import
sure_tosca_client
...
@@ -33,13 +34,15 @@ class TestDeployer(unittest.TestCase):
...
@@ -33,13 +34,15 @@ class TestDeployer(unittest.TestCase):
def
test
(
self
):
def
test
(
self
):
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
tosca_path
=
"../../example_messages/"
message_file_path
=
str
(
Path
.
home
())
+
'/Downloads/message_deploy_request.json'
input_tosca_file_path
=
tosca_path
+
'/message_deploy_request.json'
if
not
os
.
path
.
exists
(
input_tosca_file_path
):
# example_messages_path = "../../example_messages/"
tosca_path
=
"../example_messages/"
# message_file_path = example_messages_path + '/message_deploy_request.json'
input_tosca_file_path
=
tosca_path
+
'/message_deploy_request.json'
# if not os.path.exists(message_file_path):
# example_messages_path = "../example_messages/"
# message_file_path = example_messages_path + '/message_deploy_request.json'
with
open
(
input_tosca
_file_path
,
'r'
)
as
stream
:
with
open
(
message
_file_path
,
'r'
)
as
stream
:
parsed_json_message
=
json
.
load
(
stream
)
parsed_json_message
=
json
.
load
(
stream
)
# owner = parsed_json_message['owner']
# owner = parsed_json_message['owner']
...
...
docker-compose.yml
View file @
26b7efd8
...
@@ -56,18 +56,18 @@ services:
...
@@ -56,18 +56,18 @@ services:
-
"
27017:27017"
-
"
27017:27017"
#
manager:
manager
:
#
depends_on:
depends_on
:
#
- rabbit
-
rabbit
#
- mongo
-
mongo
#
- sure-tosca
-
sure-tosca
#
image: manager:3.0.0
image
:
manager:3.0.0
#
environment:
environment
:
#
RABBITMQ_HOST: rabbit
RABBITMQ_HOST
:
rabbit
#
MONGO_HOST: mongo
MONGO_HOST
:
mongo
#
SURE_TOSCA_BASE_PATH: http://sure-tosca:8081/tosca-sure/1.0.0
SURE_TOSCA_BASE_PATH
:
http://sure-tosca:8081/tosca-sure/1.0.0
#
ports:
ports
:
#
- "30000:8080"
-
"
30000:8080"
sure-tosca
:
sure-tosca
:
image
:
sure-tosca:3.0.0
image
:
sure-tosca:3.0.0
...
@@ -82,14 +82,14 @@ services:
...
@@ -82,14 +82,14 @@ services:
environment
:
environment
:
RABBITMQ_HOST
:
rabbit
RABBITMQ_HOST
:
rabbit
#
provisioner:
provisioner
:
#
depends_on:
depends_on
:
#
- rabbit
-
rabbit
#
- sure-tosca
-
sure-tosca
#
image: provisioner:3.0.0
image
:
provisioner:3.0.0
#
environment:
environment
:
#
RABBITMQ_HOST: rabbit
RABBITMQ_HOST
:
rabbit
#
SURE_TOSCA_BASE_PATH: http://sure-tosca:8081/tosca-sure/1.0.0
SURE_TOSCA_BASE_PATH
:
http://sure-tosca:8081/tosca-sure/1.0.0
#deployer:
#deployer:
#depends_on:
#depends_on:
...
...
provisioner/etc/UD/ExoGENI.yml
View file @
26b7efd8
...
@@ -235,6 +235,26 @@ DCMetaInfo:
...
@@ -235,6 +235,26 @@ DCMetaInfo:
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu/ub1404-v1.0.4.xml"
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu/ub1404-v1.0.4.xml"
OS_GUID
:
"
9394ca154aa35eb55e604503ae7943ddaecc6ca5"
OS_GUID
:
"
9394ca154aa35eb55e604503ae7943ddaecc6ca5"
DiskSize
:
75
DiskSize
:
75
-
OS
:
"
Ubuntu
18.04"
CPU
:
4
MEM
:
12
VMType
:
"
XOXLarge"
Price
:
null
DefaultSSHAccount
:
"
root"
extraInfo
:
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu-comet/ubuntu-18.04/ubuntu-18.04.xml"
OS_GUID
:
"
fe66b08bffa14c385ad64edd124350a2da826af9"
DiskSize
:
75
-
OS
:
"
Ubuntu
18.04"
CPU
:
2
MEM
:
6
VMType
:
"
XOLarge"
Price
:
null
DefaultSSHAccount
:
"
root"
extraInfo
:
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu-comet/ubuntu-18.04/ubuntu-18.04.xml"
OS_GUID
:
"
fe66b08bffa14c385ad64edd124350a2da826af9"
DiskSize
:
50
-
domain
:
"
RENCI
(Chapel
Hill,
NC
USA)
XO
Rack"
-
domain
:
"
RENCI
(Chapel
Hill,
NC
USA)
XO
Rack"
endpoint
:
"
rcivmsite.rdf#rcivmsite"
endpoint
:
"
rcivmsite.rdf#rcivmsite"
country
:
USA
country
:
USA
...
@@ -284,6 +304,26 @@ DCMetaInfo:
...
@@ -284,6 +304,26 @@ DCMetaInfo:
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu/ub1404-v1.0.4.xml"
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu/ub1404-v1.0.4.xml"
OS_GUID
:
"
9394ca154aa35eb55e604503ae7943ddaecc6ca5"
OS_GUID
:
"
9394ca154aa35eb55e604503ae7943ddaecc6ca5"
DiskSize
:
75
DiskSize
:
75
-
OS
:
"
Ubuntu
18.04"
CPU
:
4
MEM
:
12
VMType
:
"
XOXLarge"
Price
:
null
DefaultSSHAccount
:
"
root"
extraInfo
:
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu-comet/ubuntu-18.04/ubuntu-18.04.xml"
OS_GUID
:
"
fe66b08bffa14c385ad64edd124350a2da826af9"
DiskSize
:
75
-
OS
:
"
Ubuntu
18.04"
CPU
:
2
MEM
:
6
VMType
:
"
XOLarge"
Price
:
null
DefaultSSHAccount
:
"
root"
extraInfo
:
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu-comet/ubuntu-18.04/ubuntu-18.04.xml"
OS_GUID
:
"
fe66b08bffa14c385ad64edd124350a2da826af9"
DiskSize
:
50
-
domain
:
"
FIU
(Miami,
FL
USA)
XO
Rack"
-
domain
:
"
FIU
(Miami,
FL
USA)
XO
Rack"
endpoint
:
"
fiuvmsite.rdf#fiuvmsite"
endpoint
:
"
fiuvmsite.rdf#fiuvmsite"
country
:
USA
country
:
USA
...
@@ -333,6 +373,26 @@ DCMetaInfo:
...
@@ -333,6 +373,26 @@ DCMetaInfo:
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu/ub1404-v1.0.4.xml"
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu/ub1404-v1.0.4.xml"
OS_GUID
:
"
9394ca154aa35eb55e604503ae7943ddaecc6ca5"
OS_GUID
:
"
9394ca154aa35eb55e604503ae7943ddaecc6ca5"
DiskSize
:
75
DiskSize
:
75
-
OS
:
"
Ubuntu
18.04"
CPU
:
4
MEM
:
12
VMType
:
"
XOXLarge"
Price
:
null
DefaultSSHAccount
:
"
root"
extraInfo
:
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu-comet/ubuntu-18.04/ubuntu-18.04.xml"
OS_GUID
:
"
fe66b08bffa14c385ad64edd124350a2da826af9"
DiskSize
:
75
-
OS
:
"
Ubuntu
18.04"
CPU
:
2
MEM
:
6
VMType
:
"
XOLarge"
Price
:
null
DefaultSSHAccount
:
"
root"
extraInfo
:
OS_URL
:
"
http://geni-images.renci.org/images/standard/ubuntu-comet/ubuntu-18.04/ubuntu-18.04.xml"
OS_GUID
:
"
fe66b08bffa14c385ad64edd124350a2da826af9"
DiskSize
:
50
-
domain
:
"
UH
(Houston,
TX
USA)
XO
Rack"
-
domain
:
"
UH
(Houston,
TX
USA)
XO
Rack"
endpoint
:
"
uhvmsite.rdf#uhvmsite"
endpoint
:
"
uhvmsite.rdf#uhvmsite"
country
:
USA
country
:
USA
...
...
semaphore-python-client-generated/semaphore_client/semaphore_helper.py
View file @
26b7efd8
...
@@ -78,7 +78,7 @@ class SemaphoreHelper:
...
@@ -78,7 +78,7 @@ class SemaphoreHelper:
repository_id
=
repository_id
,
alias
=
playbook_name
,
playbook
=
playbook_name
)
repository_id
=
repository_id
,
alias
=
playbook_name
,
playbook
=
playbook_name
)
self
.
project_api
.
project_project_id_templates_post
(
template_request
,
project_id
)
self
.
project_api
.
project_project_id_templates_post
(
template_request
,
project_id
)
templates
=
self
.
project_api
.
project_project_id_templates_get
(
project_id
,
playbook_name
,
'asc'
)
templates
=
self
.
project_api
.
project_project_id_templates_get
(
project_id
,
playbook_name
,
'asc'
)
return
templates
[
0
]
.
id
return
self
.
find_template
(
templates
,
playbook_name
)
.
id
def
execute_task
(
self
,
project_id
,
template_id
,
playbook_name
):
def
execute_task
(
self
,
project_id
,
template_id
,
playbook_name
):
task
=
Task
(
template_id
=
template_id
,
playbook
=
playbook_name
)
task
=
Task
(
template_id
=
template_id
,
playbook
=
playbook_name
)
...
@@ -118,3 +118,8 @@ class SemaphoreHelper:
...
@@ -118,3 +118,8 @@ class SemaphoreHelper:
def
find_latest_task
(
self
,
tasks
):
def
find_latest_task
(
self
,
tasks
):
return
tasks
[
0
]
return
tasks
[
0
]
def
find_template
(
self
,
templates
,
playbook_name
):
for
template
in
templates
:
if
template
.
playbook
==
playbook_name
:
return
template
\ No newline at end of file
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