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
b4b272bf
Commit
b4b272bf
authored
5 years ago
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added killall apt in playbook
parent
1440e1d1
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
247 additions
and
18 deletions
+247
-18
message_example_provisioned.json
TOSCA/message_example_provisioned.json
+189
-1
install_k8s.yml
ansible_playbooks/install_k8s.yml
+4
-0
test_deployer.py
deployer/test/test_deployer.py
+35
-10
docker-compose.yml
docker-compose.yml
+19
-7
No files found.
TOSCA/message_example_provisioned.json
View file @
b4b272bf
This diff is collapsed.
Click to expand it.
ansible_playbooks/install_k8s.yml
View file @
b4b272bf
...
...
@@ -11,6 +11,10 @@
#regexp: 'nameserver.*'
#line: nameserver 8.8.8.8
-
name
:
Kill running processes
shell
:
"
killall
apt
apt-get"
ignore_errors
:
yes
-
name
:
Update and upgrade apt packages
become
:
true
apt
:
...
...
This diff is collapsed.
Click to expand it.
deployer/test/test_deployer.py
View file @
b4b272bf
...
...
@@ -15,7 +15,6 @@ from tower_cli.conf import settings
class
TestDeployer
(
unittest
.
TestCase
):
def
test_parse_token
(
self
):
tosca_path
=
"../../ansible_playbooks/"
example_ansible_output_file_path
=
tosca_path
+
'/example_ansible_output.out'
...
...
@@ -39,16 +38,42 @@ class TestDeployer(unittest.TestCase):
parsed_json_message
=
json
.
load
(
stream
)
print
(
parsed_json_message
)
# owner = parsed_json_message['owner']
tosca_file_name
=
'tosca_template'
tosca_template_dict
=
parsed_json_message
[
'toscaTemplate'
]
tosca_interfaces
=
tosca
.
get_interfaces
(
tosca_template_dict
)
tmp_path
=
tempfile
.
mkdtemp
()
vms
=
tosca
.
get_vms
(
tosca_template_dict
)
inventory_path
=
ansible_service
.
write_inventory_file
(
tmp_path
,
vms
)
paths
=
ansible_service
.
write_playbooks_from_tosca_interface
(
tosca_interfaces
,
tmp_path
)
tokens
=
{}
for
playbook_path
in
paths
:
out
,
err
=
ansible_service
.
run
(
inventory_path
,
playbook_path
)
api_key
,
join_token
,
discovery_token_ca_cert_hash
=
ansible_service
.
parse_api_tokens
(
out
.
decode
(
"utf-8"
))
if
api_key
:
tokens
[
'api_key'
]
=
api_key
if
join_token
:
tokens
[
'join_token'
]
=
join_token
if
discovery_token_ca_cert_hash
:
tokens
[
'discovery_token_ca_cert_hash'
]
=
discovery_token_ca_cert_hash
ansible_playbook_path
=
k8s_service
.
write_ansible_k8s_files
(
tosca_template_dict
,
tmp_path
)
out
,
err
=
ansible_service
.
run
(
inventory_path
,
ansible_playbook_path
)
dashboard_token
=
ansible_service
.
parse_dashboard_tokens
(
out
.
decode
(
"utf-8"
))
tokens
[
'dashboard_token'
]
=
dashboard_token
tosca_template_dict
=
tosca
.
add_tokens
(
tokens
,
tosca_template_dict
)
tosca_template_dict
=
tosca
.
add_dashboard_url
(
k8s_service
.
get_dashboard_url
(
vms
),
tosca_template_dict
)
# settings.runtime_values()
# with settings.runtime_values(host='localhost',username='admin', password='password'):
# try:
# res = get_resource('organization')
# new_org = res.create(name='foo', description='bar', fail_on_found=True)
# except Found:
# print('This organization already exists.')
# assert isinstance(new_org, dict)
# print(new_org['id'])
response
=
{
'toscaTemplate'
:
tosca_template_dict
}
output_current_milli_time
=
int
(
round
(
time
.
time
()
*
1000
))
response
[
"creationDate"
]
=
output_current_milli_time
logger
.
info
(
"Returning Deployment"
)
logger
.
info
(
"Output message:"
+
json
.
dumps
(
response
))
if
__name__
==
'__main__'
:
...
...
This diff is collapsed.
Click to expand it.
docker-compose.yml
View file @
b4b272bf
...
...
@@ -80,6 +80,18 @@ services:
#MEMCACHED_PORT: 11211
logspout
:
ports
:
-
"
30002:80"
volumes
:
-
/etc/hostname:/etc/host_hostname:ro
-
/var/run/docker.sock:/var/run/docker.sock
environment
:
publish
:
"
127.0.0.1:30002:80"
image
:
gliderlabs/logspout:latest
mongo
:
image
:
mongo:4
ports
:
...
...
@@ -126,13 +138,13 @@ services:
RABBITMQ_HOST
:
rabbit
SURE_TOSCA_BASE_PATH
:
http://sure-tosca:8081/tosca-sure/1.0.0
deployer
:
depends_on
:
-
rabbit
-
sure-tosca
image
:
alogo53/deployer:3.0.0
environment
:
RABBITMQ_HOST
:
rabbit
#
deployer:
#
depends_on:
#
- rabbit
#
- sure-tosca
#
image: alogo53/deployer:3.0.0
#
environment:
#
RABBITMQ_HOST: rabbit
#volumes:
...
...
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