Commit 48d2188c authored by Spiros Koulouzis's avatar Spiros Koulouzis

added awx

parent eea641f2
This diff is collapsed.
...@@ -6,4 +6,6 @@ wheel==0.34.1 ...@@ -6,4 +6,6 @@ wheel==0.34.1
pyyaml==5.3 pyyaml==5.3
tosca-parser ==1.7.0 tosca-parser ==1.7.0
matplotlib==3.1.2 matplotlib==3.1.2
ansible==2.9.4 ansible==2.9.6
`ansible-tower-cli==3.3.8
...@@ -12,44 +12,29 @@ from service import k8s_service, tosca, ansible_service ...@@ -12,44 +12,29 @@ from service import k8s_service, tosca, ansible_service
class TestDeployer(unittest.TestCase): class TestDeployer(unittest.TestCase):
def test_parse_token(self): # def test_parse_token(self):
tosca_path = "../../ansible_playbooks/" # tosca_path = "../../ansible_playbooks/"
example_ansible_output_file_path = tosca_path + '/example_ansible_output.out' # example_ansible_output_file_path = tosca_path + '/example_ansible_output.out'
if not os.path.exists(example_ansible_output_file_path): # if not os.path.exists(example_ansible_output_file_path):
tosca_path = "../ansible_playbooks/" # tosca_path = "../ansible_playbooks/"
example_ansible_output_file_path = tosca_path + '/example_ansible_output.out' # 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__)
# tosca_path = "../../TOSCA/"
# input_tosca_file_path = tosca_path + '/message_example_provisioned.json'
# if not os.path.exists(input_tosca_file_path):
# tosca_path = "../TOSCA/"
# input_tosca_file_path = tosca_path + '/message_example_provisioned.json'
# #
# with open(input_tosca_file_path, 'r') as stream: # with open(example_ansible_output_file_path, 'r') as file:
# parsed_json_message = json.load(stream) # out = file.read()
# # token = ansible_service.parse_dashboard_tokens(out)
# # parsed_json_message = json.loads(message)
# owner = parsed_json_message['owner'] def test(self):
# tosca_file_name = 'tosca_template' logger = logging.getLogger(__name__)
# tosca_template_json = parsed_json_message['toscaTemplate'] tosca_path = "../../TOSCA/"
# input_tosca_file_path = tosca_path + '/message_example_provisioned.json'
# interfaces = tosca.get_interfaces(tosca_template_json) if not os.path.exists(input_tosca_file_path):
# tmp_path = tempfile.mkdtemp() tosca_path = "../TOSCA/"
# vms = tosca.get_vms(tosca_template_json) input_tosca_file_path = tosca_path + '/message_example_provisioned.json'
# inventory_path = ansible_service.write_inventory_file(tmp_path, vms)
# paths = ansible_service.write_playbooks_from_tosca_interface(interfaces, tmp_path) with open(input_tosca_file_path, 'r') as stream:
# for playbook_path in paths: parsed_json_message = json.load(stream)
# out,err = ansible_service.run(inventory_path,playbook_path)
# api_key, join_token, discovery_token_ca_cert_hash = ansible_service.parse_tokens(out.decode("utf-8")) print(parsed_json_message)
# ansible_playbook_path = k8s_service.write_ansible_k8s_files(tosca_template_json, tmp_path)
# out, err = ansible_service.run(inventory_path, ansible_playbook_path)
if __name__ == '__main__': if __name__ == '__main__':
......
version: '3' version: '3'
services: services:
mongo: postgres:
image: mongo:4 image: "postgres:9.6"
ports: environment:
- "27017:27017" POSTGRES_USER: awx
POSTGRES_PASSWORD: awxpass
POSTGRES_DB: awx
rabbit: rabbit:
image: rabbitmq:3.8-management image: rabbitmq:3.8-management
...@@ -13,56 +14,107 @@ services: ...@@ -13,56 +14,107 @@ services:
- "15672:15672" - "15672:15672"
- "4369:4369" - "4369:4369"
- "15671:15671" - "15671:15671"
planner:
depends_on:
- rabbit
- sure-tosca
image: alogo53/planner:3.0.0
environment: environment:
RABBITMQ_HOST: rabbit RABBITMQ_DEFAULT_VHOST: awx
provisioner: memcached:
depends_on: image: "memcached:alpine"
- 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
deployer: awx_web:
image: "geerlingguy/awx_web:latest"
#image: "ansible/awx_web:latest"
depends_on: depends_on:
- rabbit - rabbit
- sure-tosca - memcached
image: alogo53/deployer:3.0.0 - postgres
ports:
- "8052:8052"
#volumes:
#- /tmp/SECRET_KEY:/etc/tower/SECRET_KEY #echo aabbcc > /tmp/SECRET_KEY
user: root
environment: 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_HOST: rabbit
RABBITMQ_PORT: 5672
RABBITMQ_VHOST: awx
MEMCACHED_HOST: memcached
MEMCACHED_PORT: 11211
manager: awx_task:
image: "geerlingguy/awx_task:latest"
#image: "ansible/awx_task:latest"
depends_on: depends_on:
- rabbit - rabbit
- mongo - memcached
- sure-tosca - awx_web
image: alogo53/manager:3.0.0 - postgres
#hostname: awx
user: root
environment: 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_HOST: rabbit
MONGO_HOST: mongo RABBITMQ_PORT: 5672
SURE_TOSCA_BASE_PATH: http://sure-tosca:8081/tosca-sure/1.0.0 RABBITMQ_VHOST: awx
ports: MEMCACHED_HOST: memcached
- "30000:8080" MEMCACHED_PORT: 11211
sure-tosca:
image: alogo53/sure-tosca:3.0.0
ports:
- "8081:8081"
#logspout: #mongo:
#image: mongo:4
#ports: #ports:
#- "30002:80" #- "27017:27017"
#volumes:
#- /etc/hostname:/etc/host_hostname:ro #jupyter:
#- /var/run/docker.sock:/var/run/docker.sock #ports:
#- "30003:8888"
#image: jupyter/base-notebook
#manager:
#depends_on:
#- rabbit
#- mongo
#- sure-tosca
#image: alogo53/manager:3.0.0
#environment:
#RABBITMQ_HOST: rabbit
#MONGO_HOST: mongo
#SURE_TOSCA_BASE_PATH: http://sure-tosca:8081/tosca-sure/1.0.0
#ports:
#- "30000:8080"
#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
#provisioner:
#depends_on:
#- rabbit
#- sure-tosca
#image: alogo53/provisioner:3.0.0
#environment: #environment:
#publish: "127.0.0.1:30002:80" #RABBITMQ_HOST: rabbit
#image: gliderlabs/logspout:latest #SURE_TOSCA_BASE_PATH: http://sure-tosca:8081/tosca-sure/1.0.0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment