From e207c0d34096fa093a22da82fc6f7e50b6eafa87 Mon Sep 17 00:00:00 2001 From: Venkata Harshavardhan Reddy Allu Date: Wed, 3 Oct 2018 20:44:58 +0530 Subject: [PATCH] Register OpenStack as VIM to OSM This patch creates osmrc file and registers the OpenStack as VIM to OSM. TODO: Currently we don't have a suitable way to find out the functioning status of OSM as soon it was installed. So we pause the execution of playbook for 2 minutes and then register OpenStack as VIM. As soon as healthchecks are added to Docker containers(upstream), we'll use them to identify the functioning status of OSM and modify the existing task. installer-type:osa deploy-scenario:os-nosdn-osm Change-Id: Ic38bd2c142f8b1c19bff125f08bab198c423fe5d Signed-off-by: Venkata Harshavardhan Reddy Allu --- .../role/os-nosdn-osm/tasks/install-osm.yml | 7 +++++ .../role/os-nosdn-osm/tasks/post-deployment.yml | 2 ++ .../role/os-nosdn-osm/tasks/register-vim.yml | 30 ++++++++++++++++++++++ .../os-nosdn-osm/role/os-nosdn-osm/vars/main.yml | 2 ++ 4 files changed, 41 insertions(+) create mode 100644 scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/register-vim.yml diff --git a/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/install-osm.yml b/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/install-osm.yml index 30875e5..83deb8f 100644 --- a/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/install-osm.yml +++ b/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/install-osm.yml @@ -22,3 +22,10 @@ args: chdir: "{{ osm_devops_clone_location }}/installers" creates: "/usr/bin/osm" + +- name: create osmrc file + copy: + dest: "{{ osmrc_file_dest }}" + content: | + export OSM_HOSTNAME=127.0.0.1 + export OSM_OL005=True diff --git a/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/post-deployment.yml b/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/post-deployment.yml index 0fb8014..ea7954d 100644 --- a/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/post-deployment.yml +++ b/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/post-deployment.yml @@ -1,3 +1,4 @@ +--- # SPDX-license-identifier: Apache-2.0 ############################################################################## # Copyright (c) 2018 Ericsson AB and others. @@ -9,3 +10,4 @@ - include: configure-opnfvhost.yml - include: install-osm.yml +- include: register-vim.yml diff --git a/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/register-vim.yml b/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/register-vim.yml new file mode 100644 index 0000000..5b68e52 --- /dev/null +++ b/scenarios/os-nosdn-osm/role/os-nosdn-osm/tasks/register-vim.yml @@ -0,0 +1,30 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2018 Venkata Harshavardhan Reddy Allu and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +# This is a simple fix to wait for the OSM services in +# the docker containers to start functioning as expected. +# TODO: Once healthchecks are added to the OSM +# container stack, use them to identify the status +# of the containers and modify this task. +- name: wait till the OSM services are ready + wait_for: timeout=120 + delegate_to: localhost + +- name: register OpenStack as VIM + shell: ". {{ osmrc_file_dest }} ; + osm vim-create \ + --name openstack-site \ + --user admin \ + --password {{ openrc_os_password }} \ + --tenant admin \ + --account_type openstack \ + --auth_url {{ openrc_os_auth_url }} \ + --config='{insecure: true}'" + changed_when: False diff --git a/scenarios/os-nosdn-osm/role/os-nosdn-osm/vars/main.yml b/scenarios/os-nosdn-osm/role/os-nosdn-osm/vars/main.yml index 3bfce9d..a1d6df6 100644 --- a/scenarios/os-nosdn-osm/role/os-nosdn-osm/vars/main.yml +++ b/scenarios/os-nosdn-osm/role/os-nosdn-osm/vars/main.yml @@ -20,3 +20,5 @@ osm_devops_version: "master" osm_devops_git_url: "https://osm.etsi.org/gerrit/osm/devops.git" osm_devops_clone_location: "/home/{{ osm_install_user }}/osm-devops" osm_install_user: "devuser" + +osmrc_file_dest: "/root/osmrc" -- 2.16.6