From 68b806838830958ec118177b040861dfa047401e Mon Sep 17 00:00:00 2001 From: Andrey Pavlov Date: Thu, 31 May 2018 18:24:47 +0300 Subject: [PATCH] add new role for ISSU - openstack_compute_legacy Change-Id: I3ad5dd8e85f4dd2c205072f37bc2009fdcf380f6 Partial-Bug: #1774441 --- .../install_contrail/tasks/compute_legacy.yml | 29 +++++++++++++++++++ .../roles/install_contrail/tasks/main.yml | 7 +++-- .../templates/contrail-compute-legacy.yaml.j2 | 8 +++++ 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 playbooks/roles/install_contrail/tasks/compute_legacy.yml create mode 100644 playbooks/roles/install_contrail/templates/contrail-compute-legacy.yaml.j2 diff --git a/playbooks/roles/install_contrail/tasks/compute_legacy.yml b/playbooks/roles/install_contrail/tasks/compute_legacy.yml new file mode 100644 index 00000000..fed9857c --- /dev/null +++ b/playbooks/roles/install_contrail/tasks/compute_legacy.yml @@ -0,0 +1,29 @@ +--- +# run openstack-compute-init container with mounted volumes: +# /usr/bin:/opt/plugin/bin +# PYTHONPATH:/opt/plugin/site-packages + +- name: create /etc/contrail/compute-legacy + file: + path: /etc/contrail/compute-legacy + state: directory + recurse: yes + +- name: Getting PYTHONPATH + shell: python -c "import sys; paths = [path for path in sys.path if 'packages' in path] ; print(paths[-1])" + register: pythonpath + +- name: update image + shell: "docker pull {{ container_registry }}/{{ item }}:{{ contrail_version_tag }}" + with_items: + - contrail-openstack-compute-init + when: UPDATE_IMAGES is undefined or UPDATE_IMAGES != false + +- name: "create contrail compute-legacy compose file" + template: + src: contrail-compute-legacy.yaml.j2 + dest: "/etc/contrail/compute-legacy/docker-compose.yaml" + +- name: "start contrail compute-legacy" + docker_service: + project_src: /etc/contrail/compute-legacy diff --git a/playbooks/roles/install_contrail/tasks/main.yml b/playbooks/roles/install_contrail/tasks/main.yml index d90d277b..60c8f361 100644 --- a/playbooks/roles/install_contrail/tasks/main.yml +++ b/playbooks/roles/install_contrail/tasks/main.yml @@ -20,9 +20,8 @@ - name: set orchestrator param set_fact: - contrail_configuration: "{{ contrail_configuration | combine({'CLOUD_ORCHESTRATOR': orchestrator}) }}" + contrail_configuration: "{{ contrail_configuration | combine({'CLOUD_ORCHESTRATOR': orchestrator | default('none')}) }}" when: - - orchestrator is defined - contrail_configuration.CLOUD_ORCHESTRATOR is not defined tags: - always @@ -284,6 +283,10 @@ tags: - vrouter +- name: Pluginize legacy compute + include: compute_legacy.yml + when: roles[instance_name].openstack_compute_legacy is defined + - name: join k8s master include: configure_k8s_join_node.yml when: roles[instance_name].k8s_node is defined and k8s_master_name is defined and inventory_hostname != k8s_master_name diff --git a/playbooks/roles/install_contrail/templates/contrail-compute-legacy.yaml.j2 b/playbooks/roles/install_contrail/templates/contrail-compute-legacy.yaml.j2 new file mode 100644 index 00000000..916a6ad1 --- /dev/null +++ b/playbooks/roles/install_contrail/templates/contrail-compute-legacy.yaml.j2 @@ -0,0 +1,8 @@ +version: '2' +services: + openstack-compute-legacy: + image: "{{ container_registry }}/contrail-openstack-compute-init:{{ contrail_version_tag }}" + network_mode: "host" + volumes: + - /usr/bin:/opt/plugin/bin + - {{ pythonpath.stdout }}:/opt/plugin/site-packages