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
Hide 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):
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
)
...
...
deployer/requirements.txt
View file @
02ad2930
pika==1.1.0
names==0.3.0
networkx==2.4
requests==2.2
2
.0
wheel==0.34.
1
requests==2.2
3
.0
wheel==0.34.
2
pyyaml==5.3
tosca-parser ==1.7.0
matplotlib==3.
1.2
matplotlib==3.
2.0
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
import
unittest
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
):
# def test_parse_token(self):
# tosca_path = "../../ansible_playbooks/"
# example_ansible_output_file_path = tosca_path + '/example_ansible_output.out'
# if not os.path.exists(example_ansible_output_file_path):
# 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()
# token = ansible_service.parse_dashboard_tokens(out)
def
test_parse_token
(
self
):
tosca_path
=
"../../ansible_playbooks/"
example_ansible_output_file_path
=
tosca_path
+
'/example_ansible_output.out'
if
not
os
.
path
.
exists
(
example_ansible_output_file_path
):
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
()
token
=
ansible_service
.
parse_dashboard_tokens
(
out
)
def
test
(
self
):
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -36,6 +40,16 @@ class TestDeployer(unittest.TestCase):
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__'
:
import
unittest
...
...
docker-compose.yml
View file @
02ad2930
version
:
'
3'
services
:
postgres
:
image
:
"
postgres:9.6"
environment
:
POSTGRES_USER
:
awx
POSTGRES_PASSWORD
:
awxpass
POSTGRES_DB
:
awx
#postgres:
#image: "postgres:12.2"
#environment:
#POSTGRES_USER: awx
#POSTGRES_PASSWORD: awxpass
#POSTGRES_DB: awx
#POSTGRES_HOST_AUTH_METHOD: trust
#ports:
#- "5432:5432"
#volumes:
#- db-data:/var/lib/postgresql/data
rabbit
:
image
:
rabbitmq:3.8-management
...
...
@@ -13,70 +18,72 @@ services:
-
"
5671-5672:5671-5672"
-
"
15672:15672"
-
"
4369:4369"
-
"
15671:15671"
environment
:
RABBITMQ_DEFAULT_VHOST
:
awx
-
"
15671:15671"
#
environment:
#
RABBITMQ_DEFAULT_VHOST: awx
memcached
:
image
:
"
memcached:alpine"
#
memcached:
#
image: "memcached:alpine"
awx_web
:
image
:
"
geerlingguy/awx_web:latest"
#image: "ansible/awx_web:latest"
depends_on
:
-
rabbit
-
memcached
-
postgres
ports
:
-
"
8052:
8052"
#volumes:
#- /tmp/SECRET_KEY:/etc/tower/SECRET_KEY #echo aabbcc > /tmp/SECRET_KEY
user
:
root
environment
:
SECRET_KEY
:
aabbcc
DATABASE_USER
:
awx
DATABASE_PASSWORD
:
awxpass
DATABASE_NAME
:
awx
DATABASE_PORT
:
5432
DATABASE_HOST
:
postgres
RABBITMQ_USER
:
guest
RABBITMQ_PASSWORD
:
guest
RABBITMQ_HOST
:
rabbit
RABBITMQ_PORT
:
5672
RABBITMQ_VHOST
:
awx
MEMCACHED_HOST
:
memcached
MEMCACHED_PORT
:
11211
#
awx_web:
#
image: "geerlingguy/awx_web:latest"
#
#
image: "ansible/awx_web:latest"
#
depends_on:
#
- rabbit
#
- memcached
#
- postgres
#
ports:
#- "8051-8052:8051-
8052"
#
#
volumes:
#
#- /tmp/SECRET_KEY:/etc/tower/SECRET_KEY #echo aabbcc > /tmp/SECRET_KEY
#
user: root
#
environment:
#
SECRET_KEY: aabbcc
#
DATABASE_USER: awx
#
DATABASE_PASSWORD: awxpass
#
DATABASE_NAME: awx
#
DATABASE_PORT: 5432
#
DATABASE_HOST: postgres
#
RABBITMQ_USER: guest
#
RABBITMQ_PASSWORD: guest
#
RABBITMQ_HOST: rabbit
#
RABBITMQ_PORT: 5672
#
RABBITMQ_VHOST: awx
#
MEMCACHED_HOST: memcached
#
MEMCACHED_PORT: 11211
awx_task
:
image
:
"
geerlingguy/awx_task:latest"
#image: "ansible/awx_task:latest"
depends_on
:
-
rabbit
-
memcached
-
awx_web
-
postgres
#awx_task:
#image: "geerlingguy/awx_task:latest"
##image: "ansible/awx_task:latest"
##volumes:
##- /tmp/SECRET_KEY:/etc/tower/SECRET_KEY #echo aabbcc > /tmp/SECRET_KEY
#depends_on:
#- rabbit
#- memcached
#- awx_web
#- postgres
#hostname: awx
user
:
root
environment
:
SECRET_KEY
:
aabbcc
DATABASE_USER
:
awx
DATABASE_PASSWORD
:
awxpass
DATABASE_NAME
:
awx
DATABASE_PORT
:
5432
DATABASE_HOST
:
postgres
RABBITMQ_USER
:
guest
RABBITMQ_PASSWORD
:
guest
RABBITMQ_HOST
:
rabbit
RABBITMQ_PORT
:
5672
RABBITMQ_VHOST
:
awx
MEMCACHED_HOST
:
memcached
MEMCACHED_PORT
:
11211
#
user: root
#
environment:
#
SECRET_KEY: aabbcc
#
DATABASE_USER: awx
#
DATABASE_PASSWORD: awxpass
#
DATABASE_NAME: awx
#
DATABASE_PORT: 5432
#
DATABASE_HOST: postgres
#
RABBITMQ_USER: guest
#
RABBITMQ_PASSWORD: guest
#
RABBITMQ_HOST: rabbit
#
RABBITMQ_PORT: 5672
#
RABBITMQ_VHOST: awx
#
MEMCACHED_HOST: memcached
#
MEMCACHED_PORT: 11211
#
mongo:
#
image: mongo:4
#
ports:
#
- "27017:27017"
mongo
:
image
:
mongo:4
ports
:
-
"
27017:27017"
#jupyter:
#ports:
...
...
@@ -97,24 +104,28 @@ services:
#ports:
#- "30000:8080"
#
sure-tosca:
#
image: alogo53/sure-tosca:3.0.0
#
ports:
#
- "8081:8081"
sure-tosca
:
image
:
alogo53/sure-tosca:3.0.0
ports
:
-
"
8081:8081"
#
planner:
#
depends_on:
#
- rabbit
#
- sure-tosca
#
image: alogo53/planner:3.0.0
#
environment:
#
RABBITMQ_HOST: rabbit
planner
:
depends_on
:
-
rabbit
-
sure-tosca
image
:
alogo53/planner:3.0.0
environment
:
RABBITMQ_HOST
:
rabbit
#provisioner:
#depends_on:
#- rabbit
#- sure-tosca
#image: alogo53/provisioner:3.0.0
#environment:
#RABBITMQ_HOST: rabbit
#SURE_TOSCA_BASE_PATH: http://sure-tosca:8081/tosca-sure/1.0.0
provisioner
:
depends_on
:
-
rabbit
-
sure-tosca
image
:
alogo53/provisioner:3.0.0
environment
:
RABBITMQ_HOST
:
rabbit
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