diff options
Diffstat (limited to 'xci/playbooks')
-rw-r--r-- | xci/playbooks/bootstrap-bifrost.yml | 42 | ||||
-rw-r--r-- | xci/playbooks/bootstrap-scenarios.yml | 27 | ||||
-rw-r--r-- | xci/playbooks/configure-localhost.yml | 58 | ||||
-rw-r--r-- | xci/playbooks/get-opnfv-scenario-requirements.yml | 24 | ||||
-rw-r--r-- | xci/playbooks/roles/bootstrap-host/tasks/time.yml | 4 | ||||
-rw-r--r-- | xci/playbooks/roles/clone-repository/tasks/main.yml | 4 | ||||
-rw-r--r-- | xci/playbooks/roles/prepare-functest/templates/run-functest.sh.j2 | 10 |
7 files changed, 85 insertions, 84 deletions
diff --git a/xci/playbooks/bootstrap-bifrost.yml b/xci/playbooks/bootstrap-bifrost.yml deleted file mode 100644 index 8b8bb30d..00000000 --- a/xci/playbooks/bootstrap-bifrost.yml +++ /dev/null @@ -1,42 +0,0 @@ ---- -# SPDX-license-identifier: Apache-2.0 -############################################################################## -# Copyright (c) 2017 Ericsson AB 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 -############################################################################## -- hosts: localhost - connection: local - gather_facts: true - vars_files: - - ../var/opnfv.yml - pre_tasks: - - name: Load distribution variables - include_vars: - file: ../var/{{ ansible_os_family }}.yml - roles: - - role: clone-repository - project: "opnfv/bifrost" - repo: "{{ OPENSTACK_BIFROST_GIT_URL }}" - dest: "{{ XCI_CACHE }}/repos/bifrost" - version: "{{ OPENSTACK_BIFROST_VERSION }}" - - tasks: - - name: Load distribution variables - include_vars: - file: ../var/{{ ansible_os_family }}.yml - - name: Synchronize local development bifrost repository to XCI paths - # command module is much faster than the copy module - synchronize: - src: "{{ OPENSTACK_BIFROST_DEV_PATH }}" - dest: "{{ XCI_CACHE }}/repos/bifrost" - recursive: yes - delete: yes - when: - - OPENSTACK_BIFROST_DEV_PATH != "" - - name: combine opnfv/releng-xci and openstack/bifrost scripts/playbooks - copy: - src: "{{ XCI_PATH}}/bifrost/" - dest: "{{ XCI_CACHE }}/repos/bifrost" diff --git a/xci/playbooks/bootstrap-scenarios.yml b/xci/playbooks/bootstrap-scenarios.yml new file mode 100644 index 00000000..6546d5ce --- /dev/null +++ b/xci/playbooks/bootstrap-scenarios.yml @@ -0,0 +1,27 @@ +--- +# +# This file is aimed to be used by scenarios to plug into the XCI. +# Ideally, all they need to do at this point is to include their +# role using a statement like the following one +# +# - name: Include foobar role +# include_role: +# name: "foobar" +# when: deploy_scenario == "foobar" + +- name: Prepare everything to run the os-nosdn-nofeature scenario + include_role: + name: "os-nosdn-nofeature" + when: deploy_scenario == 'os-nosdn-nofeature' +- name: Prepare everything to run the os-odl-nofeature scenario + include_role: + name: "os-odl-nofeature" + when: deploy_scenario == 'os-odl-nofeature' +- name: Prepare everything to run the os-odl-sfc scenario + include_role: + name: "os-odl-sfc" + when: deploy_scenario == 'os-odl-sfc' +- name: Prepare everything to run the os-odl-bgpvpn scenario + include_role: + name: "os-odl-bgpvpn" + when: deploy_scenario == 'os-odl-bgpvpn' diff --git a/xci/playbooks/configure-localhost.yml b/xci/playbooks/configure-localhost.yml index 0e3cde6e..c8a9840c 100644 --- a/xci/playbooks/configure-localhost.yml +++ b/xci/playbooks/configure-localhost.yml @@ -16,8 +16,8 @@ file: "{{ item }}" failed_when: false with_items: - - "{{ XCI_PATH }}/xci/var/opnfv.yml" - - "{{ XCI_PATH }}/xci/var/{{ ansible_os_family }}.yml" + - "{{ xci_path }}/xci/var/opnfv.yml" + - "{{ xci_path }}/xci/var/{{ ansible_os_family }}.yml" - name: cleanup leftovers of previous deployment file: @@ -25,48 +25,48 @@ state: absent recurse: no with_items: - - "{{ XCI_CACHE }}/repos" - - "{{ LOG_PATH }} " - - "{{ OPNFV_SSH_HOST_KEYS_PATH }}" + - "{{ xci_cache }}/repos" + - "{{ log_path }} " + - "{{ opnfv_ssh_host_keys_path }}" roles: - role: clone-repository project: "openstack/openstack-ansible-openstack_openrc" - repo: "{{ OPENSTACK_OSA_OPENRC_GIT_URL }}" + repo: "{{ openstack_osa_openrc_git_url }}" dest: roles/openstack-ansible-openstack_openrc version: "master" - when: INSTALLER_TYPE == "osa" + when: installer_type == "osa" - role: clone-repository project: "openstack/openstack-ansible" - repo: "{{ OPENSTACK_OSA_GIT_URL }}" - dest: "{{ XCI_CACHE }}/repos/openstack-ansible" - version: "{{ OPENSTACK_OSA_VERSION }}" - when: INSTALLER_TYPE == "osa" + repo: "{{ openstack_osa_git_url }}" + dest: "{{ xci_cache }}/repos/openstack-ansible" + version: "{{ openstack_osa_version }}" + when: installer_type == "osa" - role: clone-repository project: "kubernetes-incubator/kubespray" - repo: "{{ KUBESPRAY_GIT_URL }}" - dest: "{{ XCI_CACHE }}/repos/kubespray" - version: "{{ KUBESPRAY_VERSION }}" - when: INSTALLER_TYPE == "kubespray" + repo: "{{ kubespray_git_url }}" + dest: "{{ xci_cache }}/repos/kubespray" + version: "{{ kubespray_version }}" + when: installer_type == "kubespray" - role: clone-repository project: "openstack/openstack-ansible-haproxy_server" - repo: "{{ OPENSTACK_OSA_HAPROXY_GIT_URL }}" + repo: "{{ openstack_osa_haproxy_git_url }}" dest: roles/haproxy_server - version: "{{ HAPROXY_VERSION }}" + version: "{{ haproxy_version }}" when: - - INSTALLER_TYPE == "kubespray" + - installer_type == "kubespray" - role: clone-repository project: "ansible-keepalived" - repo: "{{ KEEPALIVED_GIT_URL }}" + repo: "{{ keepalived_git_url }}" dest: roles/keepalived - version: "{{ KEEPALIVED_VERSION }}" + version: "{{ keepalived_version }}" when: - - INSTALLER_TYPE == "kubespray" + - installer_type == "kubespray" tasks: - - name: create log directory {{LOG_PATH}} + - name: create log directory {{log_path}} file: - path: "{{LOG_PATH}}" + path: "{{log_path}}" state: directory recurse: no - block: @@ -85,21 +85,21 @@ path: "/etc/ssl/private" state: directory - name: generate self signed certificate - command: openssl req -new -nodes -x509 -subj "{{ XCI_SSL_SUBJECT }}" -days 3650 -keyout "/etc/ssl/private/xci.key" -out "/etc/ssl/certs/xci.crt" -extensions v3_ca + command: openssl req -new -nodes -x509 -subj "{{ xci_ssl_subject }}" -days 3650 -keyout "/etc/ssl/private/xci.key" -out "/etc/ssl/certs/xci.crt" -extensions v3_ca become: true - name: Synchronize local development OSA repository to XCI paths # command module is much faster than the copy module synchronize: - src: "{{ OPENSTACK_OSA_DEV_PATH }}" - dest: "{{ XCI_CACHE }}/repos/openstack-ansible" + src: "{{ openstack_osa_dev_path }}" + dest: "{{ xci_cache }}/repos/openstack-ansible" recursive: yes delete: yes when: - - OPENSTACK_OSA_DEV_PATH != "" + - openstack_osa_dev_path != "" when: - - INSTALLER_TYPE == "osa" + - installer_type == "osa" - name: Dump XCI execution environment to a file - shell: env > "{{ XCI_PATH }}/.cache/xci.env" + shell: env > "{{ xci_path }}/.cache/xci.env" args: executable: /bin/bash diff --git a/xci/playbooks/get-opnfv-scenario-requirements.yml b/xci/playbooks/get-opnfv-scenario-requirements.yml index 0615fde1..6937b47e 100644 --- a/xci/playbooks/get-opnfv-scenario-requirements.yml +++ b/xci/playbooks/get-opnfv-scenario-requirements.yml @@ -76,7 +76,7 @@ - name: Synchronize local changes to scenarios' master branch synchronize: - src: "{{ XCI_PATH }}/{{ item.item.role }}/" + src: "{{ xci_path }}/{{ item.item.role }}/" dest: "{{ role_path_default }}/{{ item.item.scenario }}" failed_when: false when: @@ -88,47 +88,47 @@ - name: Plug in the scenario to XCI (fallback) synchronize: - src: "{{ XCI_PATH }}/{{ item.item.role }}/" + src: "{{ xci_path }}/{{ item.item.role }}/" dest: "{{ role_path_default }}/{{ item.item.scenario }}" when: not item.stat.exists with_items: "{{ scenarios_list_exists.results }}" loop_control: label: "{{ item.item.scenario }}" - - name: Gather information about the selected {{ DEPLOY_SCENARIO }} scenario + - name: Gather information about the selected {{ deploy_scenario }} scenario set_fact: deploy_scenario: "{{ item }}" with_items: "{{ scenarios }}" loop_control: label: "{{ item.scenario }}" - when: DEPLOY_SCENARIO | lower == item.scenario + when: deploy_scenario | lower == item.scenario - - name: Determine if the selected {{ DEPLOY_SCENARIO }} scenario can be deployed + - name: Determine if the selected {{ deploy_scenario }} scenario can be deployed block: - set_fact: deploy_scenario_installer: "{{ item }}" with_items: "{{ deploy_scenario.installers }}" loop_control: label: "{{ item.installer }}" - when: item.installer == INSTALLER_TYPE + when: item.installer == installer_type - set_fact: - deploy_scenario_flavor: "{{ (XCI_FLAVOR in deploy_scenario_installer.flavors) | bool }}" + deploy_scenario_flavor: "{{ (xci_flavor in deploy_scenario_installer.flavors) | bool }}" when: - deploy_scenario_installer is defined - deploy_scenario_installer - set_fact: - deploy_scenario_distro: "{{ (XCI_DISTRO in deploy_scenario_installer.distros) | bool }}" + deploy_scenario_distro: "{{ (xci_distro in deploy_scenario_installer.distros) | bool }}" when: - deploy_scenario_flavor is defined - deploy_scenario_flavor when: deploy_scenario is defined - - name: Fail if {{ DEPLOY_SCENARIO }} is not supported + - name: Fail if {{ deploy_scenario }} is not supported fail: msg: - ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - - ERROR! The {{ DEPLOY_SCENARIO }} scenario can't be deployed. This is because - - the {{ INSTALLER_TYPE }} XCI installer or the {{ XCI_FLAVOR }} flavor or the {{ XCI_DISTRO }} + - ERROR! The {{ deploy_scenario }} scenario can't be deployed. This is because + - the {{ installer_type }} XCI installer or the {{ xci_flavor }} flavor or the {{ xci_distro }} - distribution is not supported by this scenario. It may also be possible that - this scenario doesn't exist at all or it's not listed in {{ scenario_file }}. - '' @@ -144,7 +144,7 @@ ansible_python_interpreter: "/usr/bin/python" scenarios: "{{ lookup('file', scenario_file) | from_yaml }}" scenario_file: '../opnfv-scenario-requirements.yml' - scenario_path_default: "{{ XCI_SCENARIOS_CACHE }}" + scenario_path_default: "{{ xci_scenarios_cache }}" role_path_default: "{{ playbook_dir }}/roles" git_clone_retries: 2 git_clone_retry_delay: 5 diff --git a/xci/playbooks/roles/bootstrap-host/tasks/time.yml b/xci/playbooks/roles/bootstrap-host/tasks/time.yml index 8f94d33f..4b3bf95a 100644 --- a/xci/playbooks/roles/bootstrap-host/tasks/time.yml +++ b/xci/playbooks/roles/bootstrap-host/tasks/time.yml @@ -21,3 +21,7 @@ until: chrony_got_time.rc == 0 retries: 5 delay: 5 + environment: + http_proxy: "{{ lookup('env','http_proxy') }}" + https_proxy: "{{ lookup('env','https_proxy') }}" + no_proxy: "{{ lookup('env','no_proxy') }}" diff --git a/xci/playbooks/roles/clone-repository/tasks/main.yml b/xci/playbooks/roles/clone-repository/tasks/main.yml index a124003d..0ba80c0a 100644 --- a/xci/playbooks/roles/clone-repository/tasks/main.yml +++ b/xci/playbooks/roles/clone-repository/tasks/main.yml @@ -13,3 +13,7 @@ dest: "{{ dest }}" version: "{{ version }}" force: yes + environment: + http_proxy: "{{ lookup('env','http_proxy') }}" + https_proxy: "{{ lookup('env','https_proxy') }}" + no_proxy: "{{ lookup('env','no_proxy') }}" diff --git a/xci/playbooks/roles/prepare-functest/templates/run-functest.sh.j2 b/xci/playbooks/roles/prepare-functest/templates/run-functest.sh.j2 index 81a0734f..a0ac9970 100644 --- a/xci/playbooks/roles/prepare-functest/templates/run-functest.sh.j2 +++ b/xci/playbooks/roles/prepare-functest/templates/run-functest.sh.j2 @@ -1,7 +1,7 @@ #!/bin/bash # Variables that we need to pass from XCI to functest -XCI_ENV=(INSTALLER_TYPE DEPLOY_SCENARIO XCI_FLAVOR) +XCI_ENV=(INSTALLER_TYPE XCI_FLAVOR) source /root/openrc @@ -22,6 +22,14 @@ if [[ -e /root/xci.env ]]; then for x in ${XCI_ENV[@]}; do grep "^${x}=" /root/xci.env >> /root/env done + # Parse the XCI's DEPLOY_SCENARIO and XCI_FLAVOR variables and + # set the functest container's DEPLOY_SCENARIO variable in the + # following format <scenario>-<flavor>. But the XCI's mini flavor + # is converted into noha. + DEPLOY_SCENARIO=`grep -Po '(?<=DEPLOY_SCENARIO=).*' /root/xci.env` + XCI_FLAVOR=`grep -Po '(?<=XCI_FLAVOR=).*' /root/xci.env` + XCI_FLAVOR=${XCI_FLAVOR/mini/noha} + echo "DEPLOY_SCENARIO=$DEPLOY_SCENARIO-$XCI_FLAVOR" >> /root/env fi # Dump the env file |