Commit b4b272bf authored by Spiros Koulouzis's avatar Spiros Koulouzis

added killall apt in playbook

parent 1440e1d1
This diff is collapsed.
......@@ -10,6 +10,10 @@
#path: /etc/resolv.conf
#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
......
......@@ -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__':
......
......@@ -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:
......
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