summaryrefslogtreecommitdiffstats
path: root/xci/infra
diff options
context:
space:
mode:
Diffstat (limited to 'xci/infra')
-rw-r--r--xci/infra/bifrost/README.md53
-rw-r--r--xci/infra/bifrost/infra-provision.sh86
-rw-r--r--xci/infra/bifrost/playbooks/opnfv-virtual.yml167
-rw-r--r--xci/infra/bifrost/playbooks/roles/common/venv_python_path.yml34
-rw-r--r--xci/infra/bifrost/playbooks/wait-for-baremetal.yml17
-rw-r--r--xci/infra/bifrost/playbooks/xci-prepare-env.yml118
-rw-r--r--xci/infra/bifrost/playbooks/xci-setup-nodes.yml76
-rwxr-xr-xxci/infra/bifrost/scripts/bifrost-env.sh43
-rw-r--r--xci/infra/bifrost/vars/debian.yml19
-rw-r--r--xci/infra/bifrost/vars/redhat.yml19
-rw-r--r--xci/infra/bifrost/vars/suse.yml19
11 files changed, 651 insertions, 0 deletions
diff --git a/xci/infra/bifrost/README.md b/xci/infra/bifrost/README.md
new file mode 100644
index 00000000..60d07244
--- /dev/null
+++ b/xci/infra/bifrost/README.md
@@ -0,0 +1,53 @@
+=====================
+How to deploy bifrost
+=====================
+The scripts and playbooks defined on this repo, need to be combined with proper `Bifrost <http://git.openstack.org/cgit/openstack/bifrost>`_ code.
+
+Please follow that steps:
+
+1. Clone bifrost::
+
+ sudo git clone https://git.openstack.org/openstack/bifrost /opt/bifrost
+
+2. Clone releng::
+
+ sudo git clone https://gerrit.opnfv.org/gerrit/releng-xci /opt/releng-xci
+
+3. Clone infracloud::
+
+ sudo git clone https://git.openstack.org/openstack-infra/puppet-infracloud /opt/puppet-infracloud
+
+4. Combine releng scripts and playbooks with bifrost::
+
+ sudo cp -R /opt/releng-xci/bifrost/* /opt/bifrost/
+
+5. Copy /opt/puppet-infracloud/templates/bifrost/create_bridge.py.erb to /opt/puppet-infracloud/files/elements/infra-cloud-bridge/static/opt/create_bridge.py,
+ and replace tag <%= @bridge_name -%> with br_opnfv
+
+6. If you are on a RHEL/CentOS box, ensure that selinux is disabled
+
+7. Run destroy script if you need to cleanup previous environment::
+
+ cd /opt/bifrost
+ sudo ./scripts/destroy-env.sh
+
+8. Run deployment script to spin up 3 vms with bifrost: xcimaster, controller and compute::
+
+ cd /opt/bifrost
+ sudo ./scripts/test-bifrost-deployment.sh
+
+It is likely that the script will show some errors due to timeout. Please ignore the errors, and wait until the vms are completely bootstrapped. To verify it you can check with ironic::
+
+ cd /opt/bifrost
+ source env-vars
+ ironic node-list
+
+And wait until all the vms are in **active** Provisioning State.
+
+9. Check the IPs assigned to each of the VMS. You can check it by looking at inventory:
+
+ cat /tmp/baremetal.csv
+
+10. You can enter into the vms with devuser login/pass:
+
+ ssh devuser@192.168.122.2
diff --git a/xci/infra/bifrost/infra-provision.sh b/xci/infra/bifrost/infra-provision.sh
new file mode 100644
index 00000000..b0617733
--- /dev/null
+++ b/xci/infra/bifrost/infra-provision.sh
@@ -0,0 +1,86 @@
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 SUSE LINUX GmbH.
+# 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
+##############################################################################
+#-------------------------------------------------------------------------------
+# Start provisioning VM nodes
+#-------------------------------------------------------------------------------
+# This playbook
+# - removes directories that were created by the previous xci run
+# - clones opnfv/releng-xci and openstack/bifrost repositories
+# - combines opnfv/releng-xci and openstack/bifrost scripts/playbooks
+# - destroys VMs, removes ironic db, leases, logs
+# - creates and provisions VMs for the chosen flavor
+#-------------------------------------------------------------------------------
+
+BIFROST_ROOT_DIR="$(dirname $(realpath ${BASH_SOURCE[0]}))"
+export ANSIBLE_ROLES_PATH="$HOME/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:${XCI_PATH}/xci/playbooks/roles:${XCI_CACHE}/repos/bifrost/playbooks/roles"
+export ANSIBLE_LIBRARY="$HOME/.ansible/plugins/modules:/usr/share/ansible/plugins/modules:${XCI_CACHE}/repos/bifrost/playbooks/library"
+
+echo "Info: Create XCI VM resources"
+echo "-------------------------------------------------------------------------"
+
+ansible-playbook ${XCI_ANSIBLE_PARAMS} \
+ -i ${XCI_PATH}/xci/playbooks/dynamic_inventory.py \
+ -e num_nodes=${NUM_NODES} \
+ -e vm_domain_type=${VM_DOMAIN_TYPE} \
+ -e baremetal_json_file=/tmp/baremetal.json \
+ -e xci_distro=${XCI_DISTRO} \
+ -e pdf_file=${PDF} \
+ -e idf_file=${IDF} \
+ ${BIFROST_ROOT_DIR}/playbooks/xci-setup-nodes.yml
+
+
+ansible-playbook ${XCI_ANSIBLE_PARAMS} \
+ --private-key=${XCI_PATH}/xci/scripts/vm/id_rsa_for_dib \
+ --user=devuser \
+ -i ${XCI_PATH}/xci/playbooks/dynamic_inventory.py \
+ ${BIFROST_ROOT_DIR}/playbooks/xci-prepare-env.yml
+
+source ${XCI_CACHE}/repos/bifrost/scripts/bifrost-env.sh
+
+# This is hardcoded to delegate to localhost but we really need to delegate to opnfv instead.
+sed -i "/delegate_to:/d" ${XCI_CACHE}/repos/bifrost/playbooks/roles/bifrost-deploy-nodes-dynamic/tasks/main.yml
+
+ansible-playbook ${XCI_ANSIBLE_PARAMS} \
+ --user=devuser \
+ -i ${XCI_PATH}/xci/playbooks/dynamic_inventory.py \
+ -i ${XCI_CACHE}/repos/bifrost/playbooks/inventory/bifrost_inventory.py \
+ -e use_cirros=false \
+ -e testing_user=root \
+ -e test_vm_num_nodes=${NUM_NODES} \
+ -e test_vm_cpu='host-model' \
+ -e inventory_dhcp=${BIFROST_INVENTORY_DHCP} \
+ -e inventory_dhcp_static_ip=false \
+ -e enable_inspector=true \
+ -e inspect_nodes=true \
+ -e download_ipa=${BIFROST_DOWNLOAD_IPA} \
+ -e create_ipa_image=${BIFROST_CREATE_IPA} \
+ -e write_interfaces_file=true \
+ -e ipv4_gateway=192.168.122.1 \
+ -e wait_timeout=3600 \
+ -e enable_keystone=false \
+ -e ironicinspector_git_branch=${BIFROST_IRONIC_INSPECTOR_VERSION:-master} \
+ -e ironicinspectorclient_git_branch=${BIFROST_IRONIC_INSPECTOR_CLIENT_VERSION:-master} \
+ -e ironicclient_git_branch=${BIFROST_IRONIC_CLIENT_VERSION:-master} \
+ -e ironic_git_branch=${BIFROST_IRONIC_VERSION:-master} \
+ -e create_image_via_dib=${BIFROST_CREATE_IMAGE_VIA_DIB:-true} \
+ -e xci_distro=${XCI_DISTRO} \
+ -e ironic_url="http://192.168.122.2:6385/" \
+ ${BIFROST_ROOT_DIR}/playbooks/opnfv-virtual.yml
+
+
+if [ "${BAREMETAL}" = true ]; then
+ ansible-playbook ${XCI_ANSIBLE_PARAMS} \
+ --user=devuser -i ${XCI_PATH}/xci/playbooks/dynamic_inventory.py \
+ -i ${XCI_CACHE}/repos/bifrost/playbooks/inventory/bifrost_inventory.py \
+ ${BIFROST_ROOT_DIR}/playbooks/wait-for-baremetal.yml
+fi
+
+echo "-----------------------------------------------------------------------"
+echo "Info: VM nodes are provisioned!"
+echo "-----------------------------------------------------------------------"
diff --git a/xci/infra/bifrost/playbooks/opnfv-virtual.yml b/xci/infra/bifrost/playbooks/opnfv-virtual.yml
new file mode 100644
index 00000000..f97eae4b
--- /dev/null
+++ b/xci/infra/bifrost/playbooks/opnfv-virtual.yml
@@ -0,0 +1,167 @@
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2016 RedHat 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: opnfv
+ name: "Host and Ironic bootstrapping"
+ become: yes
+ gather_facts: yes
+ vars_files:
+ - "../vars/{{ ansible_os_family | lower }}.yml"
+ pre_tasks:
+ - name: Remove pre-existing leases file
+ file: path=/var/lib/misc/dnsmasq.leases state=absent
+ - name: "Override the ipv4_gateway setting"
+ set_fact:
+ ipv4_gateway: "192.168.122.1"
+ - name: Prepare the XCI pre-built images
+ block:
+ - name: Create the PXE directory
+ file:
+ path: /httpboot
+ state: directory
+ - name: Download the {{ xci_distro }} image checksum file
+ get_url:
+ dest: /httpboot/deployment_image.qcow2.sha256.txt
+ force: no
+ url: http://artifacts.opnfv.org/releng/xci/images/{{ xci_distro }}.qcow2.sha256.txt
+ timeout: 3000
+ - name: Extract checksum
+ shell: awk '{print $1}' /httpboot/deployment_image.qcow2.sha256.txt
+ register: _image_checksum
+ - fail:
+ msg: "Failed to get image checksum"
+ when: _image_checksum == ''
+ - set_fact:
+ image_checksum: "{{ _image_checksum.stdout }}"
+ - name: Download the {{ xci_distro }} image file
+ get_url:
+ url: http://artifacts.opnfv.org/releng/xci/images/{{ xci_distro }}.qcow2
+ checksum: "sha256:{{ image_checksum }}"
+ timeout: 3000
+ dest: /httpboot/deployment_image.qcow2
+ force: no
+ - name: Set correct mode for {{ xci_distro }}.qcow2 file
+ file:
+ path: /httpboot/deployment_image.qcow2
+ mode: '0755'
+ owner: 'root'
+ group: 'root'
+ when: create_image_via_dib | bool == false
+ - name: Ensure /etc/hosts has good defaults
+ lineinfile:
+ create: yes
+ dest: "/etc/hosts"
+ regexp: "{{ item.regexp }}.*({{ ansible_hostname }}|localhost).*"
+ line: "{{ item.contents }}"
+ with_items:
+ - { regexp: '^127\.0\.0\.1', contents: '127.0.0.1 {{ ansible_hostname }} {{ ansible_fqdn }} localhost' }
+ - { regexp: '^::1', contents: '::1 {{ ansible_hostname }} {{ ansible_fqdn }} localhost ipv6-localhost ipv6-loopback' }
+ - name: Install required packages
+ package:
+ name: "{{ bifrost_required_devel_packages }}"
+ state: present
+
+ roles:
+ - role: bifrost-prep-for-install
+ when: skip_install is not defined
+ - role: bifrost-keystone-install
+ - role: bifrost-ironic-install
+ cleaning: false
+ testing: false
+ enabled_hardware_types: ipmi
+ network_interface: "{{ ansible_default_ipv4.interface }}"
+ # Create the IPA image for ironic to boot the nodes and write the final distro in the hard drive
+ # fedora is used because it is the only one working with ericsson-pod2 (it has support for newer hardware)
+ - role: bifrost-create-dib-image
+ dib_imagename: "{{ http_boot_folder }}/ipa"
+ build_ramdisk: false
+ dib_os_element: "{{ ipa_dib_os_element|default('fedora') }}"
+ dib_elements: "ironic-agent {{ ipa_extra_dib_elements | default('') }}"
+ dib_notmpfs: true
+ when:
+ - create_ipa_image | bool == true
+ # Create the final distro image
+ - role: bifrost-create-dib-image
+ dib_imagetype: "qcow2"
+ dib_imagename: "{{deploy_image}}"
+ dib_env_vars:
+ DIB_PYTHON_VERSION: 2
+ dib_os_element: "{{ lookup('env','DIB_OS_ELEMENT') }}"
+ dib_os_release: "{{ lookup('env', 'DIB_OS_RELEASE') }}"
+ extra_dib_elements: "{{ lookup('env', 'EXTRA_DIB_ELEMENTS') | default('') }}"
+ dib_elements: "vm enable-serial-console simple-init devuser openssh-server growroot pip-and-virtualenv {{ extra_dib_elements }}"
+ dib_packages: "{{ lookup('env', 'DIB_OS_PACKAGES') }}"
+ dib_notmpfs: true
+ when:
+ - create_image_via_dib | bool == true
+ - transform_boot_image | bool == false
+ - role: bifrost-keystone-client-config
+ clouds:
+ bifrost:
+ config_username: "{{ ironic.keystone.default_username }}"
+ config_password: "{{ ironic.keystone.default_password }}"
+ config_project_name: "baremetal"
+ config_region_name: "{{ keystone.bootstrap.region_name }}"
+ config_auth_url: "{{ keystone.bootstrap.public_url }}"
+ environment:
+ http_proxy: "{{ lookup('env','http_proxy') }}"
+ https_proxy: "{{ lookup('env','https_proxy') }}"
+ no_proxy: "{{ lookup('env','no_proxy') }}"
+
+- hosts: baremetal
+ name: "Enrollment and Deployment"
+ vars:
+ multinode_testing: "{{ inventory_dhcp | bool == true }}"
+ become: no
+ gather_facts: False
+ tasks:
+ - name: Gathering facts
+ setup:
+ delegate_to: opnfv
+ delegate_facts: False
+ - name: Find network interface in the OPNFV node
+ set_fact:
+ network_interface: "{{ ansible_default_ipv4.interface }}"
+ - import_role:
+ name: ironic-enroll-dynamic
+ private: True
+ delegate_to: opnfv
+ - import_role:
+ name: ironic-inspect-node
+ private: True
+ delegate_to: opnfv
+ when: inspect_nodes | default('false') | bool == true
+ - import_role:
+ name: bifrost-configdrives-dynamic
+ private: True
+ vars:
+ ipv4_nameserver: "{{ host_info[inventory_hostname]['public']['dns'] | list }}"
+ delegate_to: opnfv
+ - import_role:
+ name: bifrost-deploy-nodes-dynamic
+ private: True
+ delegate_to: opnfv
+ environment:
+ http_proxy: "{{ lookup('env','http_proxy') }}"
+ https_proxy: "{{ lookup('env','https_proxy') }}"
+ no_proxy: "{{ lookup('env','no_proxy') }}"
+
+- hosts: baremetal
+ name: "Deploy machines."
+ become: no
+ serial: 1
+ gather_facts: False
+ tasks:
+ #- name: Gathering facts
+ #setup:
+ #delegate_to: opnfv
+ #delegate_facts: False
+ - import_role:
+ name: bifrost-prepare-for-test-dynamic
+ delegate_to: opnfv
diff --git a/xci/infra/bifrost/playbooks/roles/common/venv_python_path.yml b/xci/infra/bifrost/playbooks/roles/common/venv_python_path.yml
new file mode 100644
index 00000000..7f7ad670
--- /dev/null
+++ b/xci/infra/bifrost/playbooks/roles/common/venv_python_path.yml
@@ -0,0 +1,34 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+---
+- name: "If VENV is set in the environment, enable installation into venv"
+ set_fact:
+ enable_venv: true
+ when: lookup('env', 'VENV') | length > 0
+
+- name: "Retrieve venv python path"
+ shell: "/bin/echo -e \"import sys\\nprint(':'.join(sys.path))\" | {{ ansible_python.get('executable', '/usr/bin/python').split('/')[-1] }}"
+ environment: "{{ bifrost_venv_env | default({}) }}"
+ register: venv_pythonpath_result
+ when: enable_venv
+
+- name: "Compute venv python path"
+ set_fact:
+ venv_pythonpath:
+ PYTHONPATH: "{{ venv_pythonpath_result.get('stdout', '') }}"
+ when: enable_venv
+
+- name: "Compute proper complete venv including proper Python path"
+ set_fact:
+ venv: "{{ venv | default({}) | combine(bifrost_venv_env | default({})) | combine(venv_pythonpath | default({})) }}"
+
diff --git a/xci/infra/bifrost/playbooks/wait-for-baremetal.yml b/xci/infra/bifrost/playbooks/wait-for-baremetal.yml
new file mode 100644
index 00000000..96aab29c
--- /dev/null
+++ b/xci/infra/bifrost/playbooks/wait-for-baremetal.yml
@@ -0,0 +1,17 @@
+# ironic needs to boot the server again to install the OS in the hard drive
+# we are currently modifying opnfv vm networking config while ironic is
+# doing that and it sometimes fail because of networking glitches. We should
+# wait until the OS is installed to do the opnfv config
+
+- hosts: baremetal
+ name: "Wait for baremetal blades to be ready"
+ become: no
+ gather_facts: False
+ tasks:
+ - name: "Wait for nodes to reboot."
+ wait_for: state=stopped port=22 host={{ ipv4_address }} timeout=5000
+ delegate_to: opnfv
+ - name: "Wait for nodes to become available."
+ wait_for: state=started port=22 host={{ ipv4_address }} timeout=5000
+ delegate_to: opnfv
+
diff --git a/xci/infra/bifrost/playbooks/xci-prepare-env.yml b/xci/infra/bifrost/playbooks/xci-prepare-env.yml
new file mode 100644
index 00000000..d576324d
--- /dev/null
+++ b/xci/infra/bifrost/playbooks/xci-prepare-env.yml
@@ -0,0 +1,118 @@
+- name: Prepare deployment host
+ hosts: deployment_host
+ gather_facts: True
+ tasks:
+ - name: Ensure common private key has correct permissions
+ file:
+ path: "{{ xci_path }}/xci/scripts/vm/id_rsa_for_dib"
+ mode: "0600"
+
+ - name: Remove host from known_hosts file if necessary
+ shell:
+ ssh-keygen -R {{ hostvars['opnfv'].ip }}
+ failed_when: false
+
+- name: Prepare the OPNFV host
+ hosts: opnfv
+ gather_facts: True
+ vars_files:
+ - "{{ xci_path }}/xci/var/opnfv.yml"
+ tasks:
+
+ - name: Configure SSH key for devuser
+ user:
+ name: devuser
+ generate_ssh_key: yes
+ ssh_key_bits: 2048
+ ssh_key_comment: xci
+ ssh_key_type: rsa
+ state: present
+
+ - name: Determine local user
+ become: no
+ local_action: command whoami
+ changed_when: False
+ register: _ansible_user
+
+ - name: Fetch local SSH key
+ delegate_to: localhost
+ become: no
+ slurp:
+ src: "/home/{{ _ansible_user.stdout }}/.ssh/id_rsa.pub"
+ register: _local_ssh_key
+
+ - name: "Configure {{ inventory_hostname }} authorized_keys file (devuser)"
+ authorized_key:
+ exclusive: no
+ user: devuser
+ state: present
+ manage_dir: yes
+ key: "{{ _local_ssh_key['content'] | b64decode }}"
+ comment: "deployer's key"
+
+ - name: "Configure {{ inventory_hostname }} authorized_keys file (root)"
+ authorized_key:
+ exclusive: no
+ user: root
+ state: present
+ manage_dir: yes
+ key: "{{ _local_ssh_key['content'] | b64decode }}"
+ comment: "deployer's key"
+ become: yes
+
+ - name: Ensure /httpboot directory exists
+ file:
+ path: /httpboot
+ state: directory
+ become: yes
+
+ # Directory must exist before passing the static config
+ - name: "Setup Inventory DHCP Hosts Directory"
+ file:
+ path: "/etc/dnsmasq.d/bifrost.dhcp-hosts.d"
+ state: directory
+ owner: "root"
+ group: "root"
+ mode: 0755
+ become: yes
+
+ - name: Copy bifrost files
+ copy:
+ src: "{{ item.src }}"
+ dest: "{{ item.dst }}"
+ with_items:
+ - { src: '/tmp/baremetal.json', dst: '/tmp/baremetal.json' }
+ - { src: '/tmp/baremetalstaticips', dst: '/etc/dnsmasq.d/bifrost.dhcp-hosts.d/baremetalstaticips' }
+ become: yes
+
+ - name: Copy original qcow2 image to OPNFV VM
+ synchronize:
+ src: "{{ xci_cache }}/{{ item }}"
+ dest: /httpboot/
+ recursive: yes
+ delete: yes
+ with_items:
+ - "deployment_image.qcow2"
+ - "deployment_image.qcow2.sha256.txt"
+ become: yes
+
+ - name: Configure DNS on openSUSE
+ block:
+ - stat:
+ path: /etc/resolv.conf.netconfig
+ register: _resolv_conf_netconfig
+ - shell: |
+ mv /etc/resolv.conf.netconfig /etc/resolv.conf
+ become: yes
+ when: _resolv_conf_netconfig.stat.exists
+ when: ansible_pkg_mgr == 'zypper'
+
+ #TODO: Find a way to do this with Ansible
+ - name: Make sure the default gateway is correct
+ shell: "ip route del default"
+ become: yes
+
+ #TODO: Find a way to do this with Ansible
+ - name: Make sure the default gateway is correct
+ shell: "ip route add default via {{ host_info[inventory_hostname].public.gateway }}"
+ become: yes
diff --git a/xci/infra/bifrost/playbooks/xci-setup-nodes.yml b/xci/infra/bifrost/playbooks/xci-setup-nodes.yml
new file mode 100644
index 00000000..a0f92159
--- /dev/null
+++ b/xci/infra/bifrost/playbooks/xci-setup-nodes.yml
@@ -0,0 +1,76 @@
+---
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 SUSE LINUX GmbH.
+# 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: deployment_host
+ name: "Bootstrap XCI hardware resources and prepare provisioning environment"
+ gather_facts: yes
+ vars_files:
+ - "{{ pdf_file }}"
+ - "{{ idf_file }}"
+ - "{{ xci_path }}/xci/var/opnfv_vm_pdf.yml"
+ - "{{ xci_path }}/xci/var/opnfv_vm_idf.yml"
+ - "{{ xci_path }}/xci/var/opnfv.yml"
+ pre_tasks:
+ - name: Load distribution variables
+ include_vars:
+ file: "{{ xci_path }}/xci/var/{{ ansible_os_family }}.yml"
+ roles:
+ - role: create-nodes
+ become: yes
+ - role: clone-repository
+ project: "opnfv/bifrost"
+ repo: "{{ openstack_bifrost_git_url }}"
+ dest: "{{ xci_cache }}/repos/bifrost"
+ version: "{{ openstack_bifrost_version }}"
+ tasks:
+ - name: Wait for host to come back to life
+ local_action:
+ module: wait_for
+ host: "{{ opnfv_vm_ip }}"
+ delay: 15
+ state: started
+ port: 22
+ connect_timeout: 10
+ timeout: 10180
+
+ # No ansible module for brctl found
+ - name: Add pxe interface to the bridge
+ shell: "brctl addif {{ item.bridge }} {{ item.interface }}"
+ become: true
+ when: baremetal | bool == true
+ with_items:
+ - { bridge: "{{ network_bridge_admin }}", interface: "{{ network_interface_admin }}" }
+ - { bridge: "{{ network_bridge_mgmt }}", interface: "{{ network_interface_mgmt }}" }
+
+ - name: Load distribution variables
+ include_vars:
+ file: "{{ xci_path }}/xci/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}}/xci/infra/bifrost/"
+ dest: "{{ xci_cache }}/repos/bifrost"
+ - name: "Ensure /etc/hosts has good defaults"
+ lineinfile:
+ dest: "/etc/hosts"
+ regexp: "{{ item.regexp }}.*({{ ansible_hostname }}|localhost).*"
+ line: "{{ item.contents }}"
+ become: yes
+ with_items:
+ - { regexp: '^127\.0\.0\.1', contents: '127.0.0.1 {{ ansible_hostname }} {{ ansible_fqdn }} localhost' }
+ - { regexp: '^::1', contents: '::1 {{ ansible_hostname }} {{ ansible_fqdn }} localhost ipv6-localhost ipv6-loopback' }
diff --git a/xci/infra/bifrost/scripts/bifrost-env.sh b/xci/infra/bifrost/scripts/bifrost-env.sh
new file mode 100755
index 00000000..7d882125
--- /dev/null
+++ b/xci/infra/bifrost/scripts/bifrost-env.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2016 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
+##############################################################################
+
+# dib configuration
+case ${XCI_DISTRO,,} in
+ # These should ideally match the CI jobs
+ ubuntu)
+ export DIB_OS_RELEASE="${DIB_OS_RELEASE:-xenial}"
+ export DIB_OS_ELEMENT="${DIB_OS_ELEMENT:-ubuntu-minimal}"
+ export DIB_OS_PACKAGES="${DIB_OS_PACKAGES:-vlan,vim,less,bridge-utils,language-pack-en,iputils-ping,rsyslog,curl,iptables}"
+ ;;
+ centos)
+ export DIB_OS_RELEASE="${DIB_OS_RELEASE:-7}"
+ export DIB_OS_ELEMENT="${DIB_OS_ELEMENT:-centos-minimal}"
+ export DIB_OS_PACKAGES="${DIB_OS_PACKAGES:-vim,less,bridge-utils,iputils,rsyslog,curl,iptables}"
+ ;;
+ opensuse)
+ export DIB_OS_RELEASE="${DIB_OS_RELEASE:-42.3}"
+ export DIB_OS_ELEMENT="${DIB_OS_ELEMENT:-opensuse-minimal}"
+ export DIB_OS_PACKAGES="${DIB_OS_PACKAGES:-vim,less,bridge-utils,iputils,rsyslog,curl,iptables}"
+ ;;
+esac
+
+export BIFROST_INVENTORY_SOURCE=/tmp/baremetal.json
+
+if [ "${BAREMETAL}" = true ]; then
+ export BIFROST_INVENTORY_DHCP=true
+ export BIFROST_DOWNLOAD_IPA=false
+ export BIFROST_CREATE_IPA=true
+else
+ export BIFROST_INVENTORY_DHCP=false
+ export BIFROST_DOWNLOAD_IPA=true
+ export BIFROST_CREATE_IPA=false
+fi
+
+pip install -q --upgrade -r "${XCI_CACHE}/repos/bifrost/requirements.txt"
diff --git a/xci/infra/bifrost/vars/debian.yml b/xci/infra/bifrost/vars/debian.yml
new file mode 100644
index 00000000..95303b38
--- /dev/null
+++ b/xci/infra/bifrost/vars/debian.yml
@@ -0,0 +1,19 @@
+---
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 SUSE Linux GmbH.
+# 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
+##############################################################################
+bifrost_required_devel_packages:
+ - gcc
+ - libffi-dev
+ - libssl-dev
+ - lsb-release
+ - make
+ - net-tools
+ - libpython-dev
+ - wget
+ - iptables
diff --git a/xci/infra/bifrost/vars/redhat.yml b/xci/infra/bifrost/vars/redhat.yml
new file mode 100644
index 00000000..056c4d61
--- /dev/null
+++ b/xci/infra/bifrost/vars/redhat.yml
@@ -0,0 +1,19 @@
+---
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 SUSE Linux GmbH.
+# 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
+##############################################################################
+bifrost_required_devel_packages:
+ - gcc
+ - libffi-devel
+ - openssl-devel
+ - redhat-lsb
+ - make
+ - net-tools
+ - python-devel
+ - wget
+ - iptables
diff --git a/xci/infra/bifrost/vars/suse.yml b/xci/infra/bifrost/vars/suse.yml
new file mode 100644
index 00000000..8e2e9041
--- /dev/null
+++ b/xci/infra/bifrost/vars/suse.yml
@@ -0,0 +1,19 @@
+---
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 SUSE Linux GmbH.
+# 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
+##############################################################################
+bifrost_required_devel_packages:
+ - gcc
+ - libffi-devel
+ - libopenssl-devel
+ - make
+ - net-tools
+ - python-devel
+ - python-xml
+ - wget
+ - iptables