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
02ad2930
Commit
02ad2930
authored
Mar 10, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added ansible tower client
parent
48d2188c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
123 additions
and
97 deletions
+123
-97
__main__.py
deployer/__main__.py
+1
-0
requirements.txt
deployer/requirements.txt
+4
-4
test_deployer.py
deployer/test/test_deployer.py
+24
-10
docker-compose.yml
docker-compose.yml
+94
-83
No files found.
deployer/__main__.py
View file @
02ad2930
...
@@ -82,6 +82,7 @@ def handle_delivery(message):
...
@@ -82,6 +82,7 @@ def handle_delivery(message):
vms
=
tosca
.
get_vms
(
tosca_template_dict
)
vms
=
tosca
.
get_vms
(
tosca_template_dict
)
inventory_path
=
ansible_service
.
write_inventory_file
(
tmp_path
,
vms
)
inventory_path
=
ansible_service
.
write_inventory_file
(
tmp_path
,
vms
)
paths
=
ansible_service
.
write_playbooks_from_tosca_interface
(
tosca_interfaces
,
tmp_path
)
paths
=
ansible_service
.
write_playbooks_from_tosca_interface
(
tosca_interfaces
,
tmp_path
)
tokens
=
{}
tokens
=
{}
for
playbook_path
in
paths
:
for
playbook_path
in
paths
:
out
,
err
=
ansible_service
.
run
(
inventory_path
,
playbook_path
)
out
,
err
=
ansible_service
.
run
(
inventory_path
,
playbook_path
)
...
...
deployer/requirements.txt
View file @
02ad2930
pika==1.1.0
pika==1.1.0
names==0.3.0
names==0.3.0
networkx==2.4
networkx==2.4
requests==2.2
2
.0
requests==2.2
3
.0
wheel==0.34.
1
wheel==0.34.
2
pyyaml==5.3
pyyaml==5.3
tosca-parser ==1.7.0
tosca-parser ==1.7.0
matplotlib==3.
1.2
matplotlib==3.
2.0
ansible==2.9.6
ansible==2.9.6
`
ansible-tower-cli==3.3.8
ansible-tower-cli==3.3.8
deployer/test/test_deployer.py
View file @
02ad2930
...
@@ -8,20 +8,24 @@ import time
...
@@ -8,20 +8,24 @@ import time
import
unittest
import
unittest
from
service
import
k8s_service
,
tosca
,
ansible_service
from
service
import
k8s_service
,
tosca
,
ansible_service
from
tower_cli
import
get_resource
from
tower_cli.exceptions
import
Found
from
tower_cli.conf
import
settings
class
TestDeployer
(
unittest
.
TestCase
):
class
TestDeployer
(
unittest
.
TestCase
):
# def test_parse_token(self):
# tosca_path = "../../ansible_playbooks/"
def
test_parse_token
(
self
):
# example_ansible_output_file_path = tosca_path + '/example_ansible_output.out'
tosca_path
=
"../../ansible_playbooks/"
# if not os.path.exists(example_ansible_output_file_path):
example_ansible_output_file_path
=
tosca_path
+
'/example_ansible_output.out'
# tosca_path = "../ansible_playbooks/"
if
not
os
.
path
.
exists
(
example_ansible_output_file_path
):
# example_ansible_output_file_path = tosca_path + '/example_ansible_output.out'
tosca_path
=
"../ansible_playbooks/"
#
example_ansible_output_file_path
=
tosca_path
+
'/example_ansible_output.out'
# with open(example_ansible_output_file_path, 'r') as file:
# out = file.read()
with
open
(
example_ansible_output_file_path
,
'r'
)
as
file
:
# token = ansible_service.parse_dashboard_tokens(out)
out
=
file
.
read
()
token
=
ansible_service
.
parse_dashboard_tokens
(
out
)
def
test
(
self
):
def
test
(
self
):
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -36,6 +40,16 @@ class TestDeployer(unittest.TestCase):
...
@@ -36,6 +40,16 @@ class TestDeployer(unittest.TestCase):
print
(
parsed_json_message
)
print
(
parsed_json_message
)
# 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'])
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
import
unittest
import
unittest
...
...
docker-compose.yml
View file @
02ad2930
version
:
'
3'
version
:
'
3'
services
:
services
:
postgres
:
#postgres:
image
:
"
postgres:9.6"
#image: "postgres:12.2"
environment
:
#environment:
POSTGRES_USER
:
awx
#POSTGRES_USER: awx
POSTGRES_PASSWORD
:
awxpass
#POSTGRES_PASSWORD: awxpass
POSTGRES_DB
:
awx
#POSTGRES_DB: awx
#POSTGRES_HOST_AUTH_METHOD: trust
#ports:
#- "5432:5432"
#volumes:
#- db-data:/var/lib/postgresql/data
rabbit
:
rabbit
:
image
:
rabbitmq:3.8-management
image
:
rabbitmq:3.8-management
...
@@ -14,69 +19,71 @@ services:
...
@@ -14,69 +19,71 @@ services:
-
"
15672:15672"
-
"
15672:15672"
-
"
4369:4369"
-
"
4369:4369"
-
"
15671:15671"
-
"
15671:15671"
environment
:
#
environment:
RABBITMQ_DEFAULT_VHOST
:
awx
#
RABBITMQ_DEFAULT_VHOST: awx
memcached
:
#
memcached:
image
:
"
memcached:alpine"
#
image: "memcached:alpine"
awx_web
:
#
awx_web:
image
:
"
geerlingguy/awx_web:latest"
#
image: "geerlingguy/awx_web:latest"
#image: "ansible/awx_web:latest"
#
#
image: "ansible/awx_web:latest"
depends_on
:
#
depends_on:
-
rabbit
#
- rabbit
-
memcached
#
- memcached
-
postgres
#
- postgres
ports
:
#
ports:
-
"
8052:
8052"
#- "8051-8052:8051-
8052"
#volumes:
#
#
volumes:
#- /tmp/SECRET_KEY:/etc/tower/SECRET_KEY #echo aabbcc > /tmp/SECRET_KEY
#
#- /tmp/SECRET_KEY:/etc/tower/SECRET_KEY #echo aabbcc > /tmp/SECRET_KEY
user
:
root
#
user: root
environment
:
#
environment:
SECRET_KEY
:
aabbcc
#
SECRET_KEY: aabbcc
DATABASE_USER
:
awx
#
DATABASE_USER: awx
DATABASE_PASSWORD
:
awxpass
#
DATABASE_PASSWORD: awxpass
DATABASE_NAME
:
awx
#
DATABASE_NAME: awx
DATABASE_PORT
:
5432
#
DATABASE_PORT: 5432
DATABASE_HOST
:
postgres
#
DATABASE_HOST: postgres
RABBITMQ_USER
:
guest
#
RABBITMQ_USER: guest
RABBITMQ_PASSWORD
:
guest
#
RABBITMQ_PASSWORD: guest
RABBITMQ_HOST
:
rabbit
#
RABBITMQ_HOST: rabbit
RABBITMQ_PORT
:
5672
#
RABBITMQ_PORT: 5672
RABBITMQ_VHOST
:
awx
#
RABBITMQ_VHOST: awx
MEMCACHED_HOST
:
memcached
#
MEMCACHED_HOST: memcached
MEMCACHED_PORT
:
11211
#
MEMCACHED_PORT: 11211
awx_task
:
#awx_task:
image
:
"
geerlingguy/awx_task:latest"
#image: "geerlingguy/awx_task:latest"
#image: "ansible/awx_task:latest"
##image: "ansible/awx_task:latest"
depends_on
:
##volumes:
-
rabbit
##- /tmp/SECRET_KEY:/etc/tower/SECRET_KEY #echo aabbcc > /tmp/SECRET_KEY
-
memcached
#depends_on:
-
awx_web
#- rabbit
-
postgres
#- memcached
#- awx_web
#- postgres
#hostname: awx
#hostname: awx
user
:
root
#
user: root
environment
:
#
environment:
SECRET_KEY
:
aabbcc
#
SECRET_KEY: aabbcc
DATABASE_USER
:
awx
#
DATABASE_USER: awx
DATABASE_PASSWORD
:
awxpass
#
DATABASE_PASSWORD: awxpass
DATABASE_NAME
:
awx
#
DATABASE_NAME: awx
DATABASE_PORT
:
5432
#
DATABASE_PORT: 5432
DATABASE_HOST
:
postgres
#
DATABASE_HOST: postgres
RABBITMQ_USER
:
guest
#
RABBITMQ_USER: guest
RABBITMQ_PASSWORD
:
guest
#
RABBITMQ_PASSWORD: guest
RABBITMQ_HOST
:
rabbit
#
RABBITMQ_HOST: rabbit
RABBITMQ_PORT
:
5672
#
RABBITMQ_PORT: 5672
RABBITMQ_VHOST
:
awx
#
RABBITMQ_VHOST: awx
MEMCACHED_HOST
:
memcached
#
MEMCACHED_HOST: memcached
MEMCACHED_PORT
:
11211
#
MEMCACHED_PORT: 11211
#
mongo:
mongo
:
#
image: mongo:4
image
:
mongo:4
#
ports:
ports
:
#
- "27017:27017"
-
"
27017:27017"
#jupyter:
#jupyter:
#ports:
#ports:
...
@@ -97,24 +104,28 @@ services:
...
@@ -97,24 +104,28 @@ services:
#ports:
#ports:
#- "30000:8080"
#- "30000:8080"
#
sure-tosca:
sure-tosca
:
#
image: alogo53/sure-tosca:3.0.0
image
:
alogo53/sure-tosca:3.0.0
#
ports:
ports
:
#
- "8081:8081"
-
"
8081:8081"
#
planner:
planner
:
#
depends_on:
depends_on
:
#
- rabbit
-
rabbit
#
- sure-tosca
-
sure-tosca
#
image: alogo53/planner:3.0.0
image
:
alogo53/planner:3.0.0
#
environment:
environment
:
#
RABBITMQ_HOST: rabbit
RABBITMQ_HOST
:
rabbit
#provisioner:
provisioner
:
#depends_on:
depends_on
:
#- rabbit
-
rabbit
#- sure-tosca
-
sure-tosca
#image: alogo53/provisioner:3.0.0
image
:
alogo53/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
#volumes:
#db-data:
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