Commit ba201cb5 authored by Spiros Koulouzis's avatar Spiros Koulouzis

made interface input 'playbook' into a list

parent da5b0cae
......@@ -51,16 +51,16 @@ class AnsibleService:
create = standard['create']
inputs = create['inputs']
git_url = inputs['repository']
playbook_name = inputs['playbook']
task_id = self.run_task(name, project_id, key_id, git_url, inventory_id, playbook_name)
configure = standard['configure']
inputs = configure['inputs']
git_url = inputs['repository']
playbook_name = inputs['playbook']
if self.semaphore_helper.get_task(project_id,task_id).status == 'success':
playbook_names = inputs['playbooks']
for playbook_name in playbook_names:
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':
configure = standard['configure']
inputs = configure['inputs']
git_url = inputs['repository']
playbook_names = inputs['playbooks']
for playbook_name in playbook_names:
task_id = self.run_task(name, project_id, key_id, git_url, inventory_id, playbook_name)
def build_yml_inventory(self, vms):
# loader = DataLoader()
......@@ -94,17 +94,19 @@ class AnsibleService:
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):
logger.info('task name: ' + str(name)+ ' git url: '+git_url+' playbook: '+playbook_name)
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,
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)
while task.status == 'waiting' or task.status == 'running':
task = self.semaphore_helper.get_task(project_id, task_id)
logger.info('task status: ' + str(task.status))
sleep(1.5)
task_outputs = self.semaphore_helper.get_task_outputs(project_id, task_id)
logger.info('task_output: ' + str(task_outputs))
return task_id
#
# task_id = self.semaphore_helper.execute_task(project_id, template_id, playbook_name)
# task = self.semaphore_helper.get_task(project_id, task_id)
# while task.status == 'waiting' or task.status == 'running':
# task = self.semaphore_helper.get_task(project_id, task_id)
# logger.info('task status: ' + str(task.status))
# task_outputs = self.semaphore_helper.get_task_outputs(project_id, task_id)
# sleep(1.5)
# task_outputs = self.semaphore_helper.get_task_outputs(project_id, task_id)
# # logger.info('task_output: ' + str(task_outputs))
return None #task_id
......@@ -56,18 +56,18 @@ services:
- "27017:27017"
manager:
depends_on:
- rabbit
- mongo
- sure-tosca
image: 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"
#manager:
#depends_on:
#- rabbit
#- mongo
#- sure-tosca
#image: 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: sure-tosca:3.0.0
......@@ -82,14 +82,14 @@ services:
environment:
RABBITMQ_HOST: rabbit
provisioner:
depends_on:
- rabbit
- sure-tosca
image: 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: provisioner:3.0.0
#environment:
#RABBITMQ_HOST: rabbit
#SURE_TOSCA_BASE_PATH: http://sure-tosca:8081/tosca-sure/1.0.0
#deployer:
#depends_on:
......
{"owner":"user","creationDate":1585660820879,"toscaTemplate":{"tosca_definitions_version":"tosca_simple_yaml_1_0","tosca_default_namespace":null,"template_name":null,"topology_template":{"description":null,"inputs":null,"node_templates":{"ws-pema":{"properties":{"ports":["30001:8080"]},"type":"tosca.nodes.ARTICONF.Container.Application.Docker","artifacts":{"image":{"type":"tosca.artifacts.Deployment.Image.Container.Docker","file":"alogo53/ws-pema-lifewatch","repository":"docker_hub"}}}},"relationship_templates":null,"outputs":null,"groups":null,"substitution_mappings":null,"policies":null},"template_author":null,"template_version":null,"description":"TOSCA example\n","imports":[{"nodes":"https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/nodes.yaml"},{"data":"https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/data.yml"},{"capabilities":"https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/capabilities.yaml"},{"policies":"https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/policies.yaml"},{"interfaces":"https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/interfaces.yml"}],"dsl_definitions":null,"node_types":null,"relationship_types":null,"relationship_templates":null,"capability_types":null,"artifact_types":null,"data_types":null,"interface_types":null,"policy_types":null,"group_types":null,"repositories":{"docker_hub":"https://hub.docker.com/"}}}
{
"owner": "user",
"creationDate": 1585660820879,
"toscaTemplate": {
"tosca_definitions_version": "tosca_simple_yaml_1_0",
"tosca_default_namespace": null,
"template_name": null,
"topology_template": {
"description": null,
"inputs": null,
"node_templates": {
"ws-pema": {
"properties": {
"ports": [
"30001:8080"
]
},
"type": "tosca.nodes.ARTICONF.Container.Application.Docker",
"artifacts": {
"image": {
"type": "tosca.artifacts.Deployment.Image.Container.Docker",
"file": "alogo53/ws-pema-lifewatch",
"repository": "docker_hub"
}
}
}
},
"relationship_templates": null,
"outputs": null,
"groups": null,
"substitution_mappings": null,
"policies": null
},
"template_author": null,
"template_version": null,
"description": "TOSCA example\n",
"imports": [
{
"nodes": "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/nodes.yaml"
},
{
"data": "https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/data.yml"
},
{
"capabilities": "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/capabilities.yaml"
},
{
"policies": "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/policies.yaml"
},
{
"interfaces": "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/interfaces.yml"
}
],
"dsl_definitions": null,
"node_types": null,
"relationship_types": null,
"relationship_templates": null,
"capability_types": null,
"artifact_types": null,
"data_types": null,
"interface_types": null,
"policy_types": null,
"group_types": null,
"repositories": {
"docker_hub": "https://hub.docker.com/"
}
}
}
{"toscaTemplate": {"description": "TOSCA example", "imports": [{"nodes": "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/nodes.yaml"}, {"data": "https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/data.yml"}, {"capabilities": "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/capabilities.yaml"}, {"policies": "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/policies.yaml"}, {"interfaces": "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/interfaces.yml"}], "tosca_definitions_version": "tosca_simple_yaml_1_0", "topology_template": {"node_templates": {"compute": {"interfaces": {"Standard": {"create": "dumy.yaml"}}, "properties": {"disk_size": "10000 MB", "mem_size": "1000 MB", "num_cores": 1, "os": "Ubuntu 18.04", "user_name": "vm_user"}, "type": "tosca.nodes.ARTICONF.VM.Compute"}, "compute_1": {"interfaces": {"Standard": {"create": "dumy.yaml"}}, "properties": {"disk_size": "10000 MB", "mem_size": "1000 MB", "num_cores": 1, "os": "Ubuntu 18.04", "user_name": "vm_user"}, "type": "tosca.nodes.ARTICONF.VM.Compute"}, "kubernetes": {"interfaces": {"Standard": {"configure": {"inputs": {"playbook": "k8s_dashboard.yaml", "repository": "https://github.com/skoulouzis/playbooks.git"}}, "create": {"inputs": {"playbook": "install_k8s.yaml", "repository": "https://github.com/skoulouzis/playbooks.git"}}, "delete": {"inputs": {"playbook": "k8s_delete.yaml", "repository": "https://github.com/skoulouzis/playbooks.git"}}}}, "requirements": [{"host": {"capability": "tosca.capabilities.ARTICONF.VM.topology", "node": "topology", "relationship": "tosca.relationships.HostedOn"}}], "type": "tosca.nodes.ARTICONF.docker.Orchestrator.Kubernetes"}, "topology": {"artifacts": {"provisioned_files": {"required": false, "type": "string"}}, "interfaces": {"CloudsStorm": {"delete": {"inputs": {"code_type": "SEQ", "object_type": "SubTopology"}}, "hscale": {"inputs": {"code_type": "SEQ", "object_type": "SubTopology"}}, "provision": {"inputs": {"code_type": "SEQ", "object_type": "SubTopology"}}, "start": {"inputs": {"code_type": "SEQ", "object_type": "SubTopology"}}, "stop": {"inputs": {"code_type": "SEQ", "object_type": "SubTopology"}}}}, "properties": {"domain": "Frankfurt", "provider": "EC2"}, "requirements": [{"vm": {"capability": "tosca.capabilities.ARTICONF.VM", "node": "compute", "relationship": "tosca.relationships.DependsOn"}}, {"vm": {"capability": "tosca.capabilities.ARTICONF.VM", "node": "compute_1", "relationship": "tosca.relationships.DependsOn"}}], "type": "tosca.nodes.ARTICONF.VM.topology"}, "ws-pema": {"artifacts": {"image": {"file": "alogo53/ws-pema-lifewatch", "repository": "docker_hub", "type": "tosca.artifacts.Deployment.Image.Container.Docker"}}, "properties": {"ports": ["30001:8080"]}, "requirements": [{"host": {"capability": "tosca.capabilities.ARTICONF.docker.Orchestrator", "node": "kubernetes", "relationship": "tosca.relationships.HostedOn"}}], "type": "tosca.nodes.ARTICONF.Container.Application.Docker"}}}}, "creationDate": 1585660828105}
{
"toscaTemplate": {
"description": "TOSCA example",
"imports": [
{
"nodes": "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/nodes.yaml"
},
{
"data": "https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/data.yml"
},
{
"capabilities": "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/capabilities.yaml"
},
{
"policies": "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/policies.yaml"
},
{
"interfaces": "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/interfaces.yml"
}
],
"tosca_definitions_version": "tosca_simple_yaml_1_0",
"topology_template": {
"node_templates": {
"compute": {
"interfaces": {
"Standard": {
"create": "dumy.yaml"
}
},
"properties": {
"disk_size": "10000 MB",
"mem_size": "1000 MB",
"num_cores": 1,
"os": "Ubuntu 18.04",
"user_name": "vm_user"
},
"type": "tosca.nodes.ARTICONF.VM.Compute"
},
"compute_1": {
"interfaces": {
"Standard": {
"create": "dumy.yaml"
}
},
"properties": {
"disk_size": "10000 MB",
"mem_size": "1000 MB",
"num_cores": 1,
"os": "Ubuntu 18.04",
"user_name": "vm_user"
},
"type": "tosca.nodes.ARTICONF.VM.Compute"
},
"kubernetes": {
"interfaces": {
"Standard": {
"configure": {
"inputs": {
"playbook": "k8s_dashboard.yaml",
"repository": "https://github.com/skoulouzis/playbooks.git"
}
},
"create": {
"inputs": {
"playbook": "install_k8s.yaml",
"repository": "https://github.com/skoulouzis/playbooks.git"
}
},
"delete": {
"inputs": {
"playbook": "k8s_delete.yaml",
"repository": "https://github.com/skoulouzis/playbooks.git"
}
}
}
},
"requirements": [
{
"host": {
"capability": "tosca.capabilities.ARTICONF.VM.topology",
"node": "topology",
"relationship": "tosca.relationships.HostedOn"
}
}
],
"type": "tosca.nodes.ARTICONF.docker.Orchestrator.Kubernetes"
},
"topology": {
"artifacts": {
"provisioned_files": {
"required": false,
"type": "string"
}
},
"interfaces": {
"CloudsStorm": {
"delete": {
"inputs": {
"code_type": "SEQ",
"object_type": "SubTopology"
}
},
"hscale": {
"inputs": {
"code_type": "SEQ",
"object_type": "SubTopology"
}
},
"provision": {
"inputs": {
"code_type": "SEQ",
"object_type": "SubTopology"
}
},
"start": {
"inputs": {
"code_type": "SEQ",
"object_type": "SubTopology"
}
},
"stop": {
"inputs": {
"code_type": "SEQ",
"object_type": "SubTopology"
}
}
}
},
"properties": {
"domain": "Frankfurt",
"provider": "EC2"
},
"requirements": [
{
"vm": {
"capability": "tosca.capabilities.ARTICONF.VM",
"node": "compute",
"relationship": "tosca.relationships.DependsOn"
}
},
{
"vm": {
"capability": "tosca.capabilities.ARTICONF.VM",
"node": "compute_1",
"relationship": "tosca.relationships.DependsOn"
}
}
],
"type": "tosca.nodes.ARTICONF.VM.topology"
},
"ws-pema": {
"artifacts": {
"image": {
"file": "alogo53/ws-pema-lifewatch",
"repository": "docker_hub",
"type": "tosca.artifacts.Deployment.Image.Container.Docker"
}
},
"properties": {
"ports": [
"30001:8080"
]
},
"requirements": [
{
"host": {
"capability": "tosca.capabilities.ARTICONF.docker.Orchestrator",
"node": "kubernetes",
"relationship": "tosca.relationships.HostedOn"
}
}
],
"type": "tosca.nodes.ARTICONF.Container.Application.Docker"
}
}
}
},
"creationDate": 1585660828105
}
{"owner":"user","creationDate":1585660972026,"toscaTemplate":{"tosca_definitions_version":"tosca_simple_yaml_1_0","tosca_default_namespace":null,"template_name":null,"topology_template":{"description":null,"inputs":null,"node_templates":{"compute":{"properties":{"disk_size":"10000 MB","mem_size":"1000 MB","num_cores":1,"os":"Ubuntu 18.04","user_name":"vm_user"},"interfaces":{"Standard":{"create":"dumy.yaml"}},"type":"tosca.nodes.ARTICONF.VM.Compute"},"compute_1":{"properties":{"disk_size":"10000 MB","mem_size":"1000 MB","num_cores":1,"os":"Ubuntu 18.04","user_name":"vm_user"},"interfaces":{"Standard":{"create":"dumy.yaml"}},"type":"tosca.nodes.ARTICONF.VM.Compute"},"kubernetes":{"requirements":[{"host":{"capability":"tosca.capabilities.ARTICONF.VM.topology","node":"topology","relationship":"tosca.relationships.HostedOn"}}],"interfaces":{"Standard":{"configure":{"inputs":{"playbook":"k8s_dashboard.yaml","repository":"https://github.com/skoulouzis/playbooks.git"}},"create":{"inputs":{"playbook":"install_k8s.yaml","repository":"https://github.com/skoulouzis/playbooks.git"}},"delete":{"inputs":{"playbook":"k8s_delete.yaml","repository":"https://github.com/skoulouzis/playbooks.git"}}}},"type":"tosca.nodes.ARTICONF.docker.Orchestrator.Kubernetes"},"topology":{"properties":{"domain":"Frankfurt","provider":"EC2"},"requirements":[{"vm":{"capability":"tosca.capabilities.ARTICONF.VM","node":"compute","relationship":"tosca.relationships.DependsOn"}},{"vm":{"capability":"tosca.capabilities.ARTICONF.VM","node":"compute_1","relationship":"tosca.relationships.DependsOn"}}],"interfaces":{"CloudsStorm":{"delete":{"inputs":{"code_type":"SEQ","object_type":"SubTopology"}},"hscale":{"inputs":{"code_type":"SEQ","object_type":"SubTopology"}},"provision":{"inputs":{"code_type":"SEQ","object_type":"SubTopology"}},"start":{"inputs":{"code_type":"SEQ","object_type":"SubTopology"}},"stop":{"inputs":{"code_type":"SEQ","object_type":"SubTopology"}}}},"type":"tosca.nodes.ARTICONF.VM.topology","attributes":{"credential":{"cloud_provider_name":"EC2","keys":{"aws_access_key_id":"XXXXXXXXXXXX"},"token":"XXXXXXXXXXXXX","token_type":"access_key"},"desired_state":"RUNNING"},"artifacts":{"provisioned_files":{"required":false,"type":"string"}}},"ws-pema":{"properties":{"ports":["30001:8080"]},"requirements":[{"host":{"capability":"tosca.capabilities.ARTICONF.docker.Orchestrator","node":"kubernetes","relationship":"tosca.relationships.HostedOn"}}],"type":"tosca.nodes.ARTICONF.Container.Application.Docker","artifacts":{"image":{"file":"alogo53/ws-pema-lifewatch","repository":"docker_hub","type":"tosca.artifacts.Deployment.Image.Container.Docker"}}}},"relationship_templates":null,"outputs":null,"groups":null,"substitution_mappings":null,"policies":null},"template_author":null,"template_version":null,"description":"TOSCA example","imports":[{"nodes":"https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/nodes.yaml"},{"data":"https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/data.yml"},{"capabilities":"https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/capabilities.yaml"},{"policies":"https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/policies.yaml"},{"interfaces":"https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/interfaces.yml"}],"dsl_definitions":null,"node_types":null,"relationship_types":null,"relationship_templates":null,"capability_types":null,"artifact_types":null,"data_types":null,"interface_types":null,"policy_types":null,"group_types":null,"repositories":null}}
{
"owner": "user",
"creationDate": 1585660972026,
"toscaTemplate": {
"tosca_definitions_version": "tosca_simple_yaml_1_0",
"tosca_default_namespace": null,
"template_name": null,
"topology_template": {
"description": null,
"inputs": null,
"node_templates": {
"compute": {
"properties": {
"disk_size": "10000 MB",
"mem_size": "1000 MB",
"num_cores": 1,
"os": "Ubuntu 18.04",
"user_name": "vm_user"
},
"interfaces": {
"Standard": {
"create": "dumy.yaml"
}
},
"type": "tosca.nodes.ARTICONF.VM.Compute"
},
"compute_1": {
"properties": {
"disk_size": "10000 MB",
"mem_size": "1000 MB",
"num_cores": 1,
"os": "Ubuntu 18.04",
"user_name": "vm_user"
},
"interfaces": {
"Standard": {
"create": "dumy.yaml"
}
},
"type": "tosca.nodes.ARTICONF.VM.Compute"
},
"kubernetes": {
"requirements": [
{
"host": {
"capability": "tosca.capabilities.ARTICONF.VM.topology",
"node": "topology",
"relationship": "tosca.relationships.HostedOn"
}
}
],
"interfaces": {
"Standard": {
"configure": {
"inputs": {
"playbook": "k8s_dashboard.yaml",
"repository": "https://github.com/skoulouzis/playbooks.git"
}
},
"create": {
"inputs": {
"playbook": "install_k8s.yaml",
"repository": "https://github.com/skoulouzis/playbooks.git"
}
},
"delete": {
"inputs": {
"playbook": "k8s_delete.yaml",
"repository": "https://github.com/skoulouzis/playbooks.git"
}
}
}
},
"type": "tosca.nodes.ARTICONF.docker.Orchestrator.Kubernetes"
},
"topology": {
"properties": {
"domain": "Frankfurt",
"provider": "EC2"
},
"requirements": [
{
"vm": {
"capability": "tosca.capabilities.ARTICONF.VM",
"node": "compute",
"relationship": "tosca.relationships.DependsOn"
}
},
{
"vm": {
"capability": "tosca.capabilities.ARTICONF.VM",
"node": "compute_1",
"relationship": "tosca.relationships.DependsOn"
}
}
],
"interfaces": {
"CloudsStorm": {
"delete": {
"inputs": {
"code_type": "SEQ",
"object_type": "SubTopology"
}
},
"hscale": {
"inputs": {
"code_type": "SEQ",
"object_type": "SubTopology"
}
},
"provision": {
"inputs": {
"code_type": "SEQ",
"object_type": "SubTopology"
}
},
"start": {
"inputs": {
"code_type": "SEQ",
"object_type": "SubTopology"
}
},
"stop": {
"inputs": {
"code_type": "SEQ",
"object_type": "SubTopology"
}
}
}
},
"type": "tosca.nodes.ARTICONF.VM.topology",
"attributes": {
"credential": {
"cloud_provider_name": "EC2",
"keys": {
"aws_access_key_id": "XXXXXXXXXXXX"
},
"token": "XXXXXXXXXXXXX",
"token_type": "access_key"
},
"desired_state": "RUNNING"
},
"artifacts": {
"provisioned_files": {
"required": false,
"type": "string"
}
}
},
"ws-pema": {
"properties": {
"ports": [
"30001:8080"
]
},
"requirements": [
{
"host": {
"capability": "tosca.capabilities.ARTICONF.docker.Orchestrator",
"node": "kubernetes",
"relationship": "tosca.relationships.HostedOn"
}
}
],
"type": "tosca.nodes.ARTICONF.Container.Application.Docker",
"artifacts": {
"image": {
"file": "alogo53/ws-pema-lifewatch",
"repository": "docker_hub",
"type": "tosca.artifacts.Deployment.Image.Container.Docker"
}
}
}
},
"relationship_templates": null,
"outputs": null,
"groups": null,
"substitution_mappings": null,
"policies": null
},
"template_author": null,
"template_version": null,
"description": "TOSCA example",
"imports": [
{
"nodes": "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/nodes.yaml"
},
{
"data": "https://raw.githubusercontent.com/skoulouzis/CONF/develop/TOSCA/types/data.yml"
},
{
"capabilities": "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/capabilities.yaml"
},
{
"policies": "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/policies.yaml"
},
{
"interfaces": "https://raw.githubusercontent.com/skoulouzis/DRIP/develop/TOSCA/types/interfaces.yml"
}
],
"dsl_definitions": null,
"node_types": null,
"relationship_types": null,
"relationship_templates": null,
"capability_types": null,
"artifact_types": null,
"data_types": null,
"interface_types": null,
"policy_types": null,
"group_types": null,
"repositories": null
}
}
This diff is collapsed.
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