diff options
Diffstat (limited to 'ansible/roles')
87 files changed, 2315 insertions, 0 deletions
diff --git a/ansible/roles/add_custom_repos/tasks/main.yml b/ansible/roles/add_custom_repos/tasks/main.yml new file mode 100644 index 000000000..7341ad07d --- /dev/null +++ b/ansible/roles/add_custom_repos/tasks/main.yml @@ -0,0 +1,16 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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. +--- +- include: "{{ target_os|lower }}.yml" + diff --git a/ansible/roles/add_custom_repos/tasks/ubuntu.yml b/ansible/roles/add_custom_repos/tasks/ubuntu.yml new file mode 100644 index 000000000..c0ba89c0b --- /dev/null +++ b/ansible/roles/add_custom_repos/tasks/ubuntu.yml @@ -0,0 +1,29 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: add custom repos + template: + src: sources.list.j2 + dest: /etc/apt/sources.list.d/yardstick.list + +#- name: Workaround for building on CentOS (apt-get is not working with http sources) +# replace: +# path: /etc/apt/sources.list +# regex: http +# replace: ftp + +- name: Force apt to use ipv4 due to build problems on LF POD. + copy: + content: 'Acquire::ForceIPv4 "true";' + dest: /etc/apt/apt.conf.d/99force-ipv4
\ No newline at end of file diff --git a/ansible/roles/add_custom_repos/templates/sources.list.j2 b/ansible/roles/add_custom_repos/templates/sources.list.j2 new file mode 100644 index 000000000..86be348f6 --- /dev/null +++ b/ansible/roles/add_custom_repos/templates/sources.list.j2 @@ -0,0 +1,5 @@ +{% if YARD_IMG_ARCH == "arm64" %} +deb [arch={{ YARD_IMG_ARCH }}] http://ports.ubuntu.com/ {{ ubuntu_release[target_os_version] }}-backports main restricted universe multiverse +{% else %} +deb http://archive.ubuntu.com/ubuntu/ {{ ubuntu_release[target_os_version] }}-backports main restricted universe multiverse +{% endif %} diff --git a/ansible/roles/add_custom_repos/vars/main.yml b/ansible/roles/add_custom_repos/vars/main.yml new file mode 100644 index 000000000..03ed6e446 --- /dev/null +++ b/ansible/roles/add_custom_repos/vars/main.yml @@ -0,0 +1,3 @@ +ubuntu_release: + "16.04": xenial + "14.04": trusty
\ No newline at end of file diff --git a/ansible/roles/add_fuel_jumphost/tasks/main.yml b/ansible/roles/add_fuel_jumphost/tasks/main.yml new file mode 100644 index 000000000..c6793a260 --- /dev/null +++ b/ansible/roles/add_fuel_jumphost/tasks/main.yml @@ -0,0 +1,20 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: add host for fuel jumphost + add_host: + name: fuel_jumphost + ansible_host: "{{ lookup('env', 'INSTALLER_IP') }}" + ansible_pass: r00tme + when: "INSTALLER_TYPE == 'fuel'" diff --git a/ansible/roles/add_heat_stack_owner_role/tasks/main.yml b/ansible/roles/add_heat_stack_owner_role/tasks/main.yml new file mode 100644 index 000000000..d751eb032 --- /dev/null +++ b/ansible/roles/add_heat_stack_owner_role/tasks/main.yml @@ -0,0 +1,24 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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. +# openstack role assignment list --names +--- +- os_user_role: + state: present + user: "{{ openrc.OS_USERNAME }}" + role: heat_stack_owner + project: "{{ item }}" + with_items: + - demo + - admin + environment: "{{ openrc }}" diff --git a/ansible/roles/check_external_network/tasks/main.yml b/ansible/roles/check_external_network/tasks/main.yml new file mode 100644 index 000000000..586ad74be --- /dev/null +++ b/ansible/roles/check_external_network/tasks/main.yml @@ -0,0 +1,21 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: Get all networks + os_networks_facts: + name: "{{ EXTERNAL_NETWORK }}" + environment: "{{ openrc }}" + +- debug: var=openstack_networks + diff --git a/ansible/roles/check_openstack_services/tasks/main.yml b/ansible/roles/check_openstack_services/tasks/main.yml new file mode 100644 index 000000000..02e730533 --- /dev/null +++ b/ansible/roles/check_openstack_services/tasks/main.yml @@ -0,0 +1,25 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: Check images + os_images_facts: {} + environment: "{{ openrc }}" + +- name: Check servers + os_server_facts: {} + environment: "{{ openrc }}" + +- name: Check stacks + os_stack_facts: {} + environment: "{{ openrc }}" diff --git a/ansible/roles/clean_flavors/tasks/main.yml b/ansible/roles/clean_flavors/tasks/main.yml new file mode 100644 index 000000000..a34f7e65f --- /dev/null +++ b/ansible/roles/clean_flavors/tasks/main.yml @@ -0,0 +1,19 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: cleanup yardstick flavor + os_nova_flavor: + state: absent + name: yardstick-flavor + environment: "{{ openrc }}" diff --git a/ansible/roles/clean_images/tasks/main.yml b/ansible/roles/clean_images/tasks/main.yml new file mode 100644 index 000000000..5cbae06d8 --- /dev/null +++ b/ansible/roles/clean_images/tasks/main.yml @@ -0,0 +1,32 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: Get all images + os_images_facts: {} + environment: "{{ openrc }}" + +- debug: var=openstack_images + +- set_fact: + images_to_clean: "{{ openstack_images|map(attribute='name')|select('search', 'yardstick|cirros|Ubuntu-14\\.04')|list }}" + +- debug: var=images_to_clean + +- name: Cleanup images + os_image: + state: absent + name: "{{ item }}" + with_items: "{{ images_to_clean }}" + environment: "{{ openrc }}" + diff --git a/ansible/roles/convert_openrc/defaults/main.yml b/ansible/roles/convert_openrc/defaults/main.yml new file mode 100644 index 000000000..dffca1078 --- /dev/null +++ b/ansible/roles/convert_openrc/defaults/main.yml @@ -0,0 +1,17 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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. +--- +openrc_file: "openrc" +cloud_yaml_path: "{{ playbook_dir }}/clouds.yaml" + diff --git a/ansible/roles/convert_openrc/tasks/main.yml b/ansible/roles/convert_openrc/tasks/main.yml new file mode 100644 index 000000000..1606b0bc5 --- /dev/null +++ b/ansible/roles/convert_openrc/tasks/main.yml @@ -0,0 +1,55 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: parse openrc into openstack auth dict + parse_shell_file: path="{{ openrc_file }}" fact_name="openrc" + +- debug: var=openrc + +- set_fact: + yardstick_url_ip: "{{ openrc.OS_AUTH_URL|urlsplit|attr('hostname') }}" + +- debug: var=yardstick_url_ip + +# This doesn't work, due to OS_IDENTITY_API_VERSION, use environment + +- set_fact: + os_auth: + auth_url: "{{ openrc.OS_AUTH_URL }}" + password: "{{ openrc.OS_PASSWORD }}" + username: "{{ openrc.OS_USERNAME }}" + project_name: "{{ openrc.OS_PROJECT_NAME }}" +# tenant_name: "{{ openrc.OS_TENANT_NAME }}" + project_domain_name: "{{ openrc.OS_PROJECT_DOMAIN_NAME }}" +# user_domain_name: "{{ openrc.OS_USER_DOMAIN_NAME }}" + # BUGS: We need to specify identity_api_version == 3, but we can't do it here + # because it is not the write place + # we need to set it via OS_IDENTITY_API_VERSION or clouds.yaml +# identity_api_version: "{{ openrc.OS_IDENTITY_API_VERSION }}" + +- debug: var=os_auth + +- set_fact: + clouds: + demo: + # must specify API version here + identity_api_version: "{{ openrc.OS_IDENTITY_API_VERSION }}" + auth: "{{ os_auth }}" + +- template: + src: clouds.yaml.j2 + # this is autodetected and used + dest: "{{ cloud_yaml_path }}" + when: write_cloud_yaml|default(False) + diff --git a/ansible/roles/convert_openrc/templates/clouds.yaml.j2 b/ansible/roles/convert_openrc/templates/clouds.yaml.j2 new file mode 100644 index 000000000..b1a76cb76 --- /dev/null +++ b/ansible/roles/convert_openrc/templates/clouds.yaml.j2 @@ -0,0 +1,9 @@ +clouds: + demo: + identity_api_version: "{{ openrc.OS_IDENTITY_API_VERSION }}" + auth: + auth_url: "{{ openrc.OS_AUTH_URL }}" + password: "{{ openrc.OS_PASSWORD }}" + username: "{{ openrc.OS_USERNAME }}" + project_name: "{{ openrc.OS_PROJECT_NAME }}" + project_domain_name: "{{ openrc.OS_PROJECT_DOMAIN_NAME }}" diff --git a/ansible/roles/copy_L4Replay/tasks/main.yml b/ansible/roles/copy_L4Replay/tasks/main.yml new file mode 100644 index 000000000..2f4887dc1 --- /dev/null +++ b/ansible/roles/copy_L4Replay/tasks/main.yml @@ -0,0 +1,14 @@ +--- +- file: + path: "{{ NSB_INSTALL_DIR }}" + state: directory + +- get_url: + url: "{{ L4REPLAY_DOWNLOAD }}" + dest: "{{ NSB_INSTALL_DIR }}" + checksum: "sha256:4dd17209715af68a95058648ab9314e2737418c836acc45492e987886f38bbe8" + +- unarchive: + src: "{{ NSB_INSTALL_DIR }}/{{ L4REPLAY_DOWNLOAD|basename }}" + dest: "{{ NSB_INSTALL_DIR }}" + copy: no diff --git a/ansible/roles/create_dockerfile/tasks/main.yml b/ansible/roles/create_dockerfile/tasks/main.yml new file mode 100644 index 000000000..d48f7be3f --- /dev/null +++ b/ansible/roles/create_dockerfile/tasks/main.yml @@ -0,0 +1,82 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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. +--- +- set_fact: + yardstick_image_name: "yardstick_python{{ python_version }}_{{ target_os }}" + tags: + - create_template + +- debug: var=docker_build_dir + +- file: dest="{{ docker_build_dir }}" state=directory + tags: + - create_template + +- template: "src={{ target_os }}/Dockerfile dest={{ docker_build_dir }}/Dockerfile" + tags: + - create_template + +- name: bootstrap repos + template: "src=Ubuntu-repos.j2 dest={{ docker_build_dir}}/sources.list" + when: use_ext == "intr" + +- name: Create apt.conf.d/ proxy config + template: + src: apt_conf.j2 + dest: "{{ docker_build_dir }}/20proxy" + when: "'http_proxy' in proxy_env" + +- name: set pip mirror + template: "src=pip.conf.j2 dest={{ docker_build_dir }}/pip.conf" + when: pip_mirror_url is defined and pip_mirror_url + +- name: easy_utils mirror + template: "src=pydistutils.cfg.j2 dest={{ docker_build_dir }}/pydistutils.cfg" + when: pip_mirror_url is defined and pip_mirror_url + +- set_fact: + yardstick_base: "{{ docker_registry ~ '/' if docker_registry|default('') else '' }}{{ yardstick_image_name}}" + + +- set_fact: + yardstick_base_tag: "{{ docker_image_tag|default('v1') }}" + +- debug: var=yardstick_base + +#- command: "docker build {{ docker_build_dir }}" +#- fail: msg="don't build" + +- docker_image: + name: "{{ yardstick_base }}" + tag: "{{ yardstick_base_tag }}" + path: "{{ docker_build_dir }}" + state: present + force: yes + rm: true + # push is broken, manually push + push: no + ignore_errors: yes + register: docker_image_results + when: not release +- debug: var=docker_image_results + +- name: manual push image + command: docker push {{ yardstick_base }} + when: not release and docker_image_results|changed + register: docker_image_push + tags: + - push_image + +- debug: var=docker_image_push + diff --git a/ansible/roles/create_dockerfile/templates/centos/Dockerfile b/ansible/roles/create_dockerfile/templates/centos/Dockerfile new file mode 100644 index 000000000..ca104c8f8 --- /dev/null +++ b/ansible/roles/create_dockerfile/templates/centos/Dockerfile @@ -0,0 +1,69 @@ +############################################################################## +# Copyright (c) 2017 Intel Corporation +# +# 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 +############################################################################## + +FROM centos:7.3.1611 + +LABEL image=opnfv/yardstick + +ARG BRANCH=master + +# GIT repo directory +ENV REPOS_DIR /home/opnfv/repos + +# Yardstick repo +ENV YARDSTICK_REPO_DIR ${REPOS_DIR}/yardstick +ENV RELENG_REPO_DIR ${REPOS_DIR}/releng + +RUN yum -y install\ + deltarpm \ + wget \ + expect \ + curl \ + git \ + sshpass \ + ansible \ + qemu-kvm \ + qemu-utils \ + kpartx \ + libffi-devel \ + openssl-devel \ + zeromq2-devel \ + python \ + python-devel \ + libxml2-devel \ + libxslt-devel \ + nginx \ + uwsgi \ + uwsgi-plugin-python \ + supervisor \ + ansible \ + python-setuptools && \ + easy_install -U setuptools==30.0.0 && \ + yum clean all + +RUN mkdir -p ${REPOS_DIR} && \ + git config --global http.sslVerify false && \ + git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/yardstick ${YARDSTICK_REPO_DIR} && \ + git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng ${RELENG_REPO_DIR} + +# install yardstick + dependencies +# explicity pin pip version to avoid future issues like the ill-fated pip 8.0.0 release +RUN easy_install -U "pip==${PIP_VERSION}" && \ + pip install -r ${YARDSTICK_REPO_DIR}/requirements.txt && \ + pip install ${YARDSTICK_REPO_DIR} + +RUN ${YARDSTICK_REPO_DIR}/api/api-prepare.sh + +EXPOSE 5000 + +ADD http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img /home/opnfv/images/ +ADD http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img /home/opnfv/images/ + +COPY ./exec_tests.sh /usr/local/bin/ +CMD ["/usr/bin/supervisord"] diff --git a/ansible/roles/create_dockerfile/templates/ubuntu/Dockerfile b/ansible/roles/create_dockerfile/templates/ubuntu/Dockerfile new file mode 100644 index 000000000..7fbc4f01a --- /dev/null +++ b/ansible/roles/create_dockerfile/templates/ubuntu/Dockerfile @@ -0,0 +1,82 @@ +############################################################################## +# Copyright (c) 2015 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 +############################################################################## + +FROM ubuntu:16.04 + +LABEL image=opnfv/yardstick + +ARG BRANCH=master + +# GIT repo directory +ENV REPOS_DIR /home/opnfv/repos + +# Yardstick repo +ENV YARDSTICK_REPO_DIR ${REPOS_DIR}/yardstick +ENV RELENG_REPO_DIR ${REPOS_DIR}/releng +RUN sed -i -e 's/^deb /deb [arch=amd64] /g;s/^deb-src /# deb-src /g' /etc/apt/sources.list && \ + echo "\n\ +deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ trusty main universe multiverse restricted \n\ +deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main universe multiverse restricted \n\ +deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ trusty-security main universe multiverse restricted \n\ +deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ trusty-proposed main universe multiverse restricted" >> /etc/apt/sources.list && \ + dpkg --add-architecture arm64 + +# WHY? Is this workaround still needed? +# https://wiki.debian.org/mmap_min_addr#apps +# qemu, as shipped in Debian 5.0, requires low virtual memory mmaps. mmap_min_addr must be set to 0 to run qemu as a non-root user. This limitation has been removed upstream, so qemu should work with an increased mmap_min_addr starting with Debian squeeze. +#RUN echo "vm.mmap_min_addr = 0" > /etc/sysctl.d/mmap_min_addr.conf + +# This will prevent questions from being asked during the install +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -y \ + qemu-user-static \ + libc6:arm64 \ + wget \ + expect \ + curl \ + git \ + sshpass \ + qemu-utils \ + kpartx \ + libffi-dev \ + libssl-dev \ + libzmq-dev \ + python \ + python-dev \ + libxml2-dev \ + libxslt1-dev \ + nginx \ + uwsgi \ + uwsgi-plugin-python \ + supervisor \ + python-setuptools && \ + easy_install -U setuptools==30.0.0 && \ + apt-get -y autoremove && \ + apt-get clean + +RUN mkdir -p ${REPOS_DIR} && \ + git config --global http.sslVerify false && \ + git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/yardstick ${YARDSTICK_REPO_DIR} && \ + git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng ${RELENG_REPO_DIR} + +# install yardstick + dependencies +# explicity pin pip version to avoid future issues like the ill-fated pip 8.0.0 release +RUN easy_install -U "pip==${PIP_VERSION}" && \ + pip install -r ${YARDSTICK_REPO_DIR}/requirements.txt && \ + pip install ${YARDSTICK_REPO_DIR} + +RUN ${YARDSTICK_REPO_DIR}/api/api-prepare.sh + +EXPOSE 5000 + +ADD http://download.cirros-cloud.net/0.3.3/cirros-0.3.5-x86_64-disk.img /home/opnfv/images/ +ADD http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img /home/opnfv/images/ + +COPY ./exec_tests.sh /usr/local/bin/ +CMD ["/usr/bin/supervisord"] diff --git a/ansible/roles/create_flavors/tasks/main.yml b/ansible/roles/create_flavors/tasks/main.yml new file mode 100644 index 000000000..b0c120c36 --- /dev/null +++ b/ansible/roles/create_flavors/tasks/main.yml @@ -0,0 +1,23 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: create yardstick flavor + os_nova_flavor: + state: present + name: yardstick-flavor + flavorid: 100 + ram: 1024 + disk: 4 + vcpus: 2 + environment: "{{ openrc }}" diff --git a/ansible/roles/create_fuel_pod_yaml/tasks/main.yml b/ansible/roles/create_fuel_pod_yaml/tasks/main.yml new file mode 100644 index 000000000..b13bc2f08 --- /dev/null +++ b/ansible/roles/create_fuel_pod_yaml/tasks/main.yml @@ -0,0 +1,37 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: fetch fuel master ssh key + fetch: + src: /root/.ssh/id_rsa + dest: /root/.ssh/id_rsa + +- name: collect fuel node info + command: fuel --json node + register: fuel_node_output + +- name: import fuel json + set_fact: + fuel_nodes: "{{ fuel_node_output.stdout|from_json }}" + +- name: find compute node + set_fact: + compute_node: "{{ fuel_nodes|find_fuel_nodes.computes_ips[0] }}" + +- name: get remote arch + command: ssh "{{ compute_node }}" uname -m + register: uname_output + +- set_fact: + YARD_IMG_ARCH: "{{ 'arm64' if uname_output.stdout.strip() == 'aarch64' else 'amd64' }}" diff --git a/ansible/roles/create_fuel_pod_yaml/templates/fuel_pod.yaml.j2 b/ansible/roles/create_fuel_pod_yaml/templates/fuel_pod.yaml.j2 new file mode 100644 index 000000000..2a038537b --- /dev/null +++ b/ansible/roles/create_fuel_pod_yaml/templates/fuel_pod.yaml.j2 @@ -0,0 +1,33 @@ +############################################################################## +# 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 +############################################################################## +--- +# sample config file about the POD information, including the +# name/IP/user/ssh key of Bare Metal and Controllers/Computes +# +# The options of this config file include: +# name: the name of this node +# role: node's role, support role: Master/Controller/Comupte/BareMetal +# ip: the node's IP address +# user: the username for login +# key_filename:the path of the private key file for login +# ipX: the ips of the nodes will be fetched by prepare_env.sh and replaced here + +nodes: +{% for fuel_node in fuel_nodes %} +- + name: {{ fuel_node.name }} + {% if "contoller" in fuel_node.roles %} + role: Controller + {% elif "compute" in fuel_node.roles %} + role: Compute + {% endif %} + ip: {{ fuel_node.ip }} + user: root + key_filename: /root/.ssh/id_rsa +{% endfor %} diff --git a/ansible/roles/create_node_pod_yaml/tasks/main.yml b/ansible/roles/create_node_pod_yaml/tasks/main.yml new file mode 100644 index 000000000..c398737c9 --- /dev/null +++ b/ansible/roles/create_node_pod_yaml/tasks/main.yml @@ -0,0 +1,19 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: create pod yaml + template: + src: pod.yaml.j2 + dest: "{{ dest_pod_yaml }}" + delegate_to: localhost diff --git a/ansible/roles/create_node_pod_yaml/templates/pod.yaml.j2 b/ansible/roles/create_node_pod_yaml/templates/pod.yaml.j2 new file mode 100644 index 000000000..e51701830 --- /dev/null +++ b/ansible/roles/create_node_pod_yaml/templates/pod.yaml.j2 @@ -0,0 +1,22 @@ +--- +nodes: +{% for node in groups[pod_group] %} +- + name: "{{ node }}" +{% if "control" in hostvars[node].group_names %} + role: Controller +{% elif "compute" in hostvars[node].group_names %} + role: Compute +{% endif %} + ip: "{{ hostvars[node].ansible_host }}" + user: "{{ hostvars[node].ansible_user }}" +{% if hostvars[node].ansible_port is defined %} + ssh_port: "{{ hostvars[node].ansible_port }}" +{% endif %} +{% if hostvars[node].ansible_ssh_pass is defined %} + password: "{{ hostvars[node].ansible_ssh_pass }}" +{% endif %} +{% if hostvars[node].ansible_ssh_private_key_file is defined %} + key_filename: "{{ hostvars[node].ansible_ssh_private_key_file }}" +{% endif %} +{% endfor %} diff --git a/ansible/roles/create_storperf_admin_rc/library/my_os_project_facts.py b/ansible/roles/create_storperf_admin_rc/library/my_os_project_facts.py new file mode 100644 index 000000000..debb8dd5b --- /dev/null +++ b/ansible/roles/create_storperf_admin_rc/library/my_os_project_facts.py @@ -0,0 +1,167 @@ +#!/usr/bin/python +# Copyright (c) 2016 Hewlett-Packard Enterprise Corporation +# +# This module is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software. If not, see <http://www.gnu.org/licenses/>. + +import sys + +try: + import shade + HAS_SHADE = True +except ImportError: + HAS_SHADE = False + +DOCUMENTATION = ''' +--- +module: os_project_facts +short_description: Retrieve facts about one or more OpenStack projects +extends_documentation_fragment: openstack +version_added: "2.1" +author: "Ricardo Carrillo Cruz (@rcarrillocruz)" +description: + - Retrieve facts about a one or more OpenStack projects +requirements: + - "python >= 2.6" + - "shade" +options: + name: + description: + - Name or ID of the project + required: true + domain: + description: + - Name or ID of the domain containing the project if the cloud supports domains + required: false + default: None + filters: + description: + - A dictionary of meta data to use for further filtering. Elements of + this dictionary may be additional dictionaries. + required: false + default: None +''' + +EXAMPLES = ''' +# Gather facts about previously created projects +- my_os_project_facts: + cloud: awesomecloud +- debug: var=openstack_projects + +# Gather facts about a previously created project by name +- my_os_project_facts: + cloud: awesomecloud + name: demoproject +- debug: var=openstack_projects + +# Gather facts about a previously created project in a specific domain +- my_os_project_facts + cloud: awesomecloud + name: demoproject + domain: admindomain +- debug: var=openstack_projects + +# Gather facts about a previously created project in a specific domain + with filter +- my_os_project_facts + cloud: awesomecloud + name: demoproject + domain: admindomain + filters: + enabled: False +- debug: var=openstack_projects +''' + + +RETURN = ''' +openstack_projects: + description: has all the OpenStack facts about projects + returned: always, but can be null + type: complex + contains: + id: + description: Unique UUID. + returned: success + type: string + name: + description: Name given to the project. + returned: success + type: string + description: + description: Description of the project + returned: success + type: string + enabled: + description: Flag to indicate if the project is enabled + returned: success + type: bool + domain_id: + description: Domain ID containing the project (keystone v3 clouds only) + returned: success + type: bool +''' + +def main(): + + argument_spec = openstack_full_argument_spec( + name=dict(required=False, default=None), + domain=dict(required=False, default=None), + filters=dict(required=False, type='dict', default=None), + ) + + module = AnsibleModule(argument_spec) + + if not HAS_SHADE: + module.fail_json(msg='shade is required for this module') + + try: + name = module.params['name'] + domain = module.params['domain'] + filters = module.params['filters'] + + opcloud = shade.operator_cloud(**module.params) + # module.exit_json(changed=False, ansible_facts=dict( + # openstack_prjects=opcloud.cloud_config.get_auth_args())) + + if domain: + try: + # We assume admin is passing domain id + dom = opcloud.get_domain(domain)['id'] + domain = dom + except: + # If we fail, maybe admin is passing a domain name. + # Note that domains have unique names, just like id. + dom = opcloud.search_domains(filters={'name': domain}) + if dom: + domain = dom[0]['id'] + else: + module.fail_json(msg='Domain name or ID does not exist') + + if not filters: + filters = {} + + filters['domain_id'] = domain + + # projects = opcloud.search_projects(name, filters) + projects = opcloud.list_projects(name, filters) + module.exit_json(changed=False, ansible_facts=dict( + openstack_projects=projects)) + + except shade.OpenStackCloudException as e: + module.fail_json(msg=str(e)) + +from ansible.module_utils.basic import * +from ansible.module_utils.openstack import * + +if __name__ == '__main__': + main() diff --git a/ansible/roles/create_storperf_admin_rc/tasks/main.yml b/ansible/roles/create_storperf_admin_rc/tasks/main.yml new file mode 100644 index 000000000..bd1418e89 --- /dev/null +++ b/ansible/roles/create_storperf_admin_rc/tasks/main.yml @@ -0,0 +1,27 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: Fetch TENANT_ID + os_project_facts: + name: admin + environment: "{{ openrc }}" + +- name: Fetch TENANT_ID + set_fact: + os_tenant_id: "{{ openstack_projects[0].id }}" + +- name: Create storperf_admin-rc + template: + src: storperf_admin-rc.j2 + dest: "{{ storperf_rc }}" diff --git a/ansible/roles/create_storperf_admin_rc/templates/storperf_admin-rc.j2 b/ansible/roles/create_storperf_admin_rc/templates/storperf_admin-rc.j2 new file mode 100644 index 000000000..410ab24df --- /dev/null +++ b/ansible/roles/create_storperf_admin_rc/templates/storperf_admin-rc.j2 @@ -0,0 +1,7 @@ +OS_AUTH_URL="{{ openrc.OS_AUTH_URL }}" +OS_USERNAME="{{ openrc.OS_USERNAME|default('admin') }}" +OS_PASSWORD="{{ openrc.OS_PASSWORD|default('console') }}" +OS_TENANT_NAME="{{ openrc.OS_TENANT_NAME|default('admin') }}" +OS_VOLUME_API_VERSION="{{ openrc.OS_VOLUME_API_VERSION|default('2') }}" +OS_PROJECT_NAME="{{ openrc.OS_PROJECT_NAME|default(openrc.OS_TENANT_NAME) }}" +OS_TENANT_ID="{{ os_tenant_id }}" diff --git a/ansible/roles/detect_fuel_arch/tasks/main.yml b/ansible/roles/detect_fuel_arch/tasks/main.yml new file mode 100644 index 000000000..2a5713106 --- /dev/null +++ b/ansible/roles/detect_fuel_arch/tasks/main.yml @@ -0,0 +1,25 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: collect fuel node info + command: fuel --json node + register: fuel_node_output + +- name: import fuel json + set_fact: + fuel_nodes: "{{ fuel_node_output.stdout|from_json }}" + +- name: ssh to fuel and get fuel arch + shell: + diff --git a/ansible/roles/download_cachestat/defaults/main.yml b/ansible/roles/download_cachestat/defaults/main.yml new file mode 100644 index 000000000..c88cba879 --- /dev/null +++ b/ansible/roles/download_cachestat/defaults/main.yml @@ -0,0 +1,4 @@ +--- +cachestat_repo: "https://github.com/beefyamoeba5/cachestat.git" +cachestat_version: master +cachestat_dest: "{{ clone_dest }}/Cachestat" diff --git a/ansible/roles/download_cachestat/tasks/main.yml b/ansible/roles/download_cachestat/tasks/main.yml new file mode 100644 index 000000000..12175c8fd --- /dev/null +++ b/ansible/roles/download_cachestat/tasks/main.yml @@ -0,0 +1,21 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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. +--- +- git: + repo: "{{ cachestat_repo }}" + dest: "{{ cachestat_dest }}" + version: "{{ cachestat_version }}" + accept_hostkey: yes + recursive: no + force: yes diff --git a/ansible/roles/download_dpdk/defaults/main.yml b/ansible/roles/download_dpdk/defaults/main.yml new file mode 100644 index 000000000..fb42ed48a --- /dev/null +++ b/ansible/roles/download_dpdk/defaults/main.yml @@ -0,0 +1,10 @@ +--- +dpdk_version: "17.02" +dpdk_url: "http://dpdk.org/browse/dpdk/snapshot/dpdk-{{ dpdk_version }}.zip" +dpdk_file: "{{ dpdk_url|basename }}" +dpdk_unarchive: "{{ dpdk_file|regex_replace('[.]zip$', '') }}" +dpdk_dest: "{{ clone_dest }}/" +dpdk_sha256s: + "17.02": "sha256:c675285d5eab8e7e8537a10bdae6f03c603caa80cb4bf5b055ddd482e3b7d67f" + "16.04": "sha256:65e587af439b21abf54c644f86ba5ce7ea65657b3272480dcd78b769d2aecac3" + "16.07": "sha256:46fee52f9b3ff54df869414c69f122aea8f744de5ed5f8fb275a22cc9cefe094" diff --git a/ansible/roles/download_dpdk/tasks/main.yml b/ansible/roles/download_dpdk/tasks/main.yml new file mode 100644 index 000000000..322f3cd0c --- /dev/null +++ b/ansible/roles/download_dpdk/tasks/main.yml @@ -0,0 +1,38 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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. +--- +- debug: + var: dpdk_version + verbosity: 2 + +- name: fetch dpdk + get_url: + url: "{{ dpdk_url }}" + dest: "{{ dpdk_dest }}" + validate_certs: False + checksum: "{{ dpdk_sha256s[dpdk_version] }}" + +- unarchive: + src: "{{ clone_dest }}/{{ dpdk_file }}" + dest: "{{ clone_dest }}/" + copy: no + +- set_fact: + dpdk_path: "{{ clone_dest }}/{{ dpdk_unarchive }}" + +- set_fact: + RTE_SDK: "{{ dpdk_path }}" + +- set_fact: + RTE_TARGET: "{{ dpdk_make_arch }}" diff --git a/ansible/roles/download_prox/defaults/main.yml b/ansible/roles/download_prox/defaults/main.yml new file mode 100644 index 000000000..797db3125 --- /dev/null +++ b/ansible/roles/download_prox/defaults/main.yml @@ -0,0 +1,12 @@ +--- +prox_version: v037 +prox_suffix: + v035: "zip" + v037: "tar.gz" +prox_url: "https://01.org/sites/default/files/downloads/intelr-data-plane-performance-demonstrators/dppd-prox-{{ prox_version }}.{{ prox_suffix[prox_version] }}" +prox_file: "{{ prox_url|basename }}" +prox_unarchive: "{{ prox_file|regex_replace('[.]zip$', '')|regex_replace('-prox-', '-PROX-') }}" +prox_dest: "{{ clone_dest }}/" +prox_sha256s: + v035: "sha256:f5d3f7c3855ca198d2babbc7045ed4373f0ddc13dc243fedbe23ed395ce65cc9" + v037: "sha256:a12d021fbc0f5ae55ab55a2bbf8f3b260705ce3e61866288f023ccabca010bca" diff --git a/ansible/roles/download_prox/tasks/main.yml b/ansible/roles/download_prox/tasks/main.yml new file mode 100644 index 000000000..0614c74fa --- /dev/null +++ b/ansible/roles/download_prox/tasks/main.yml @@ -0,0 +1,36 @@ +# Copyright (c) 2017 Intel Corporation +# +# 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. +--- +- debug: + var: prox_version + verbosity: 2 + +- name: fetch prox + get_url: + url: "{{ prox_url }}" + dest: "{{ prox_dest }}" + validate_certs: False + checksum: "{{ prox_sha256s[prox_version] }}" + +- unarchive: + src: "{{ clone_dest }}/{{ prox_file }}" + dest: "{{ clone_dest }}/" + copy: no + +- debug: + var: prox_unarchive + verbosity: 2 + +- set_fact: + prox_path: "{{ clone_dest }}/{{ prox_unarchive }}"
\ No newline at end of file diff --git a/ansible/roles/download_ramspeed/defaults/main.yml b/ansible/roles/download_ramspeed/defaults/main.yml new file mode 100644 index 000000000..140ad1197 --- /dev/null +++ b/ansible/roles/download_ramspeed/defaults/main.yml @@ -0,0 +1,5 @@ +--- +ramspeed_repo: "https://github.com/beefyamoeba5/ramspeed.git" +ramspeed_version: master +ramspeed_dest: "{{ clone_dest }}/RAMspeed" +ramspeed_release: ramspeed-2.6.0
\ No newline at end of file diff --git a/ansible/roles/download_ramspeed/tasks/main.yml b/ansible/roles/download_ramspeed/tasks/main.yml new file mode 100644 index 000000000..8b974eb63 --- /dev/null +++ b/ansible/roles/download_ramspeed/tasks/main.yml @@ -0,0 +1,21 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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. +--- +- git: + repo: "{{ ramspeed_repo }}" + dest: "{{ ramspeed_dest }}" + version: "{{ ramspeed_version }}" + accept_hostkey: yes + recursive: no + force: yes diff --git a/ansible/roles/download_samplevnfs/defaults/main.yml b/ansible/roles/download_samplevnfs/defaults/main.yml new file mode 100644 index 000000000..44449af6f --- /dev/null +++ b/ansible/roles/download_samplevnfs/defaults/main.yml @@ -0,0 +1,6 @@ +--- +samplevnf_version: "" +samplevnf_file: "{{ samplevnf_url|basename }}" +samplevnf_unarchive: "{{ samplevnf_file|regex_replace('[.]tar[.]gz$', '') }}" +samplevnf_dest: "{{ clone_dest }}/" +samplevnf_sha256: "sha256:36457cadfd23053c9ce1cf2e6f048cad6a5d04a7371d7a122e133dcbf007989e" diff --git a/ansible/roles/download_samplevnfs/tasks/main.yml b/ansible/roles/download_samplevnfs/tasks/main.yml new file mode 100644 index 000000000..005d57dda --- /dev/null +++ b/ansible/roles/download_samplevnfs/tasks/main.yml @@ -0,0 +1,32 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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. +--- +#- debug: +# var: samplevnf_version +# verbosity: 2 + +- name: fetch samplevnf + get_url: + url: "{{ samplevnf_url }}" + dest: "{{ samplevnf_dest }}" + validate_certs: False + checksum: "{{ samplevnf_sha256 }}" + +- unarchive: + src: "{{ clone_dest }}/{{ samplevnf_file }}" + dest: "{{ clone_dest }}/" + copy: no + +- set_fact: + samplevnf_path: "{{ clone_dest }}/{{ samplevnf_unarchive }}" diff --git a/ansible/roles/download_trex/defaults/main.yml b/ansible/roles/download_trex/defaults/main.yml new file mode 100644 index 000000000..dd2dd27eb --- /dev/null +++ b/ansible/roles/download_trex/defaults/main.yml @@ -0,0 +1,20 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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. +--- +trex_version: v2.20 +trex_url: "https://trex-tgn.cisco.com/trex/release/{{ trex_version }}.tar.gz" +trex_file: "{{ trex_url|basename }}" +trex_unarchive: "{{ trex_file|regex_replace('[.]tar.gz$', '') }}" +trex_dest: "{{ clone_dest }}/" +trex_sha256: "sha256:eb5a069f758a36133a185c7e27af10834ca03d11441165403529fbd7844658fb" diff --git a/ansible/roles/download_trex/tasks/main.yml b/ansible/roles/download_trex/tasks/main.yml new file mode 100644 index 000000000..75a3169f0 --- /dev/null +++ b/ansible/roles/download_trex/tasks/main.yml @@ -0,0 +1,25 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: fetch Trex + get_url: + url: "{{ trex_url }}" + dest: "{{ trex_dest }}" + checksum: "{{ trex_sha256 }}" + +- name: unarchive Trex + unarchive: + src: "{{ clone_dest }}/{{ trex_file }}" + dest: "{{ clone_dest }}/" + copy: no diff --git a/ansible/roles/download_unixbench/defaults/main.yml b/ansible/roles/download_unixbench/defaults/main.yml new file mode 100644 index 000000000..95fe07cdc --- /dev/null +++ b/ansible/roles/download_unixbench/defaults/main.yml @@ -0,0 +1,4 @@ +--- +unixbench_repo: "https://github.com/kdlucas/byte-unixbench.git" +unixbench_version: master +unixbench_dest: "{{ clone_dest }}/UnixBench"
\ No newline at end of file diff --git a/ansible/roles/download_unixbench/tasks/main.yml b/ansible/roles/download_unixbench/tasks/main.yml new file mode 100644 index 000000000..f5550c952 --- /dev/null +++ b/ansible/roles/download_unixbench/tasks/main.yml @@ -0,0 +1,21 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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. +--- +- git: + repo: "{{ unixbench_repo }}" + dest: "{{ unixbench_dest }}" + version: "{{ unixbench_version }}" + accept_hostkey: yes + recursive: no + force: yes diff --git a/ansible/roles/enable_hugepages_on_boot/tasks/main.yml b/ansible/roles/enable_hugepages_on_boot/tasks/main.yml new file mode 100755 index 000000000..f258bb684 --- /dev/null +++ b/ansible/roles/enable_hugepages_on_boot/tasks/main.yml @@ -0,0 +1,59 @@ +# Copyright (c) 2017 Intel Corporation +# +# 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: check if hugepages are set by this role + command: "grep -o '{{ hugepage_param_regex }}' /etc/default/grub" + register: is_mine_huge + ignore_errors: True + +- name: check if hugepages are set by someone else + command: "grep -o 'default_hugepagesz=' /etc/default/grub" + register: is_huge + ignore_errors: True + +- fail: + msg: "Hugepages already set by someone else" + when: is_mine_huge.stdout == "" and is_huge.stdout != "" + +- name: use 16 for auto num_hugepages and 1G size + set_fact: + num_hugepages: 16 + when: num_hugepages|default("auto") == "auto" + +- name: set hugepages in grub + lineinfile: + dest: /etc/default/grub + regexp: '{{ hugepage_param_regex }}' + line: '{{ hugepage_param }}' + state: present + +- name: Update grub + command: "{{ update_grub[ansible_os_family] }}" + +- name: create hugetables mount + file: + path: "{{ hugetable_mount }}" + state: directory + + +- name: mount hugetlbfs + mount: + name: "{{ hugetable_mount }}" + src: nodev + fstype: hugetlbfs + state: present + +- service: + name: procps + enabled: yes diff --git a/ansible/roles/enable_hugepages_on_boot/vars/main.yml b/ansible/roles/enable_hugepages_on_boot/vars/main.yml new file mode 100644 index 000000000..acdf02509 --- /dev/null +++ b/ansible/roles/enable_hugepages_on_boot/vars/main.yml @@ -0,0 +1,26 @@ +# Copyright (c) 2017 Intel Corporation +# +# 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. +--- +hugepage_param_regex: '^GRUB_CMDLINE_LINUX="\$GRUB_CMDLINE_LINUX.*# added by hugepages role' +hugepage_param: 'GRUB_CMDLINE_LINUX="$GRUB_CMDLINE_LINUX default_hugepagesz={{ huge_pagesize_short[huge_pagesize_mb] }} hugepagesz={{ huge_pagesize_short[huge_pagesize_mb] }} hugepages={{ num_hugepages }}" # added by hugepages role' + +update_grub: + Debian: "update-grub2" + RedHat: "grub2-mkconfig -o /boot/grub2/grub.cfg" + +huge_pagesize_short: + 1024: "1G" + 2: "2M" + +hugetable_mount: /mnt/huge diff --git a/ansible/roles/enable_hugepages_runtime/tasks/main.yml b/ansible/roles/enable_hugepages_runtime/tasks/main.yml new file mode 100644 index 000000000..45e1860a6 --- /dev/null +++ b/ansible/roles/enable_hugepages_runtime/tasks/main.yml @@ -0,0 +1,32 @@ +# Copyright (c) 2017 Intel Corporation +# +# 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. +--- +- write_string: + val: "{{ num_hugepages }}" + path: "/sys/kernel/mm/hugepages/hugepages-{{ huge_pagesize_kb[huge_pagesize_mb] }}/nr_hugepages" + +- name: create hugetables mount + file: path="{{ hugetable_mount }}" state=directory + +- name: mount hugetlbfs + mount: + name: "{{ hugetable_mount }}" + src: nodev + fstype: hugetlbfs + state: mounted + +- service: + name: procps + state: started + enabled: yes diff --git a/ansible/roles/enable_hugepages_runtime/vars/main.yml b/ansible/roles/enable_hugepages_runtime/vars/main.yml new file mode 100644 index 000000000..5e1678cbb --- /dev/null +++ b/ansible/roles/enable_hugepages_runtime/vars/main.yml @@ -0,0 +1,6 @@ +--- +huge_pagesize_kb: + 1024: 1048576kB + 2: 2048kB + +hugetable_mount: /mnt/huge diff --git a/ansible/roles/enable_igb_uio_on_boot/tasks/main.yml b/ansible/roles/enable_igb_uio_on_boot/tasks/main.yml new file mode 100644 index 000000000..6fb5aaf6c --- /dev/null +++ b/ansible/roles/enable_igb_uio_on_boot/tasks/main.yml @@ -0,0 +1,18 @@ +# Copyright (c) 2017 Intel Corporation +# +# 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: configure igb_uio to load on boot + copy: + content: 'uio\nigb_uio\n' + dest: /etc/modules-load.d/nsb.conf diff --git a/ansible/roles/install_L4Replay/tasks/main.yml b/ansible/roles/install_L4Replay/tasks/main.yml new file mode 100644 index 000000000..1401d1b13 --- /dev/null +++ b/ansible/roles/install_L4Replay/tasks/main.yml @@ -0,0 +1,9 @@ +--- +# there is no clean for L4Replay +#- my_make: chdir="{{ vnf_build_dir }}/L4Replay" target=clean extra_args="-j {{ ansible_processor_vcpus }}" + +- name: Building L4Replay VNF + my_make: chdir="{{ NSB_INSTALL_DIR }}/L4Replay" params="RTE_SDK={{ dpdk_path }}" extra_args="-j {{ ansible_processor_vcpus }}" + +- command: cp "{{ NSB_INSTALL_DIR }}/L4Replay/build/L4replay" "{{ INSTALL_BIN_PATH }}/" + diff --git a/ansible/roles/install_dependencies/tasks/Debian.yml b/ansible/roles/install_dependencies/tasks/Debian.yml new file mode 100755 index 000000000..ac8332287 --- /dev/null +++ b/ansible/roles/install_dependencies/tasks/Debian.yml @@ -0,0 +1,49 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: Install core packages + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: + - python-minimal + - wget + - curl + - screen + - procps + - git + - socat + - sshpass + - libxslt1-dev + - libffi-dev + - libfuse-dev + - qemu-kvm + - qemu-user-static + - qemu-utils + - libvirt0 + - python-libvirt + - bridge-utils + - ebtables + - openssl + - libssl-dev + - python-dev + - python-virtualenv + - ccze + - libxml2-dev + - libxslt-dev + - libzmq-dev + - nginx-full + - uwsgi + - uwsgi-plugin-python + - supervisor + - python-setuptools + diff --git a/ansible/roles/install_dependencies/tasks/RedHat.yml b/ansible/roles/install_dependencies/tasks/RedHat.yml new file mode 100644 index 000000000..4bb7c318e --- /dev/null +++ b/ansible/roles/install_dependencies/tasks/RedHat.yml @@ -0,0 +1,70 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: Install EPEL if needed + action: "{{ ansible_pkg_mgr }} name=epel-release state=present" + when: ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] + +- name: Install core packages + # we need to recompile the kernel, but we don't need libvirtd it will + # run in a container + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: + - deltarpm + - wget + - expect + - curl + # require python2 version of libselinux-python so ansible can operate in selinux enviroment + - libselinux-python + - screen + - git + - socat + # + - sshpass + - qemu-kvm + - qemu-img + - kpartx + - libxslt-devel + - libffi-devel + - openssl-devel + - zeromq2-devel + - nginx + - uwsgi + - uwsgi-plugin-python + - supervisor + - python-setuptools + - libffi-devel + - python-devel + # don't install kernel-devel here it will trigger unwanted kernel upgrade + # Mandatory Packages: + # Don't use yum groups, they don't work, expand them manually + # CentOS 'Development Tools' group +# - autoconf +# - automake +# - binutils +# - bison +# - flex +# - gcc +# - gcc-c++ +# - gettext +# - libtool +# - make +# - patch +# - pkgconfig +# - redhat-rpm-config +# - rpm-build +# - rpm-sign + # Fedora 'C Development Tools' group + # don't use ccache, it can get weird for kernel compiles +# - ccache diff --git a/ansible/roles/install_dependencies/tasks/main.yml b/ansible/roles/install_dependencies/tasks/main.yml new file mode 100644 index 000000000..27660c3ca --- /dev/null +++ b/ansible/roles/install_dependencies/tasks/main.yml @@ -0,0 +1,15 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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. +--- +- include: "{{ ansible_os_family }}.yml" diff --git a/ansible/roles/install_dpdk/tasks/Debian.yml b/ansible/roles/install_dpdk/tasks/Debian.yml new file mode 100755 index 000000000..486d40e11 --- /dev/null +++ b/ansible/roles/install_dpdk/tasks/Debian.yml @@ -0,0 +1,19 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: Install DPDK build dependencies + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: + - libpcap-dev + diff --git a/ansible/roles/install_dpdk/tasks/RedHat.yml b/ansible/roles/install_dpdk/tasks/RedHat.yml new file mode 100644 index 000000000..af35c9b3e --- /dev/null +++ b/ansible/roles/install_dpdk/tasks/RedHat.yml @@ -0,0 +1,19 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: Install DPDK build dependencies + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: + - libpcap-devel + diff --git a/ansible/roles/install_dpdk/tasks/main.yml b/ansible/roles/install_dpdk/tasks/main.yml new file mode 100644 index 000000000..fca0e33af --- /dev/null +++ b/ansible/roles/install_dpdk/tasks/main.yml @@ -0,0 +1,90 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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. +--- +#- patch: src="{{ item }}" basedir="{{ dpdk_path }}" strip=0 +# with_fileglob: +# - "{{ local_nsb_path }}/patches/dpdk_custom_patch/rte_pipeline.patch" +# +#- patch: src="{{ item }}" basedir="{{ dpdk_path }}" strip=1 +# with_fileglob: +# - "{{ local_nsb_path }}/patches/dpdk_custom_patch/0*.patch" + +- include: "{{ ansible_os_family }}.yml" + +- my_make: + chdir: "{{ dpdk_path }}" + target: config + params: + T: "{{ dpdk_make_arch }}" + O: "{{ dpdk_make_arch }}" + extra_args: "-j {{ ansible_processor_vcpus }}" + +- name: enable RTE_PORT_STATS_COLLECT + lineinfile: + dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config" + regexp: '^CONFIG_RTE_PORT_STATS_COLLECT=n' + line: 'CONFIG_RTE_PORT_STATS_COLLECT=y' + +- name: enable DPDK RTE_PORT_PCAP + lineinfile: + dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config" + regexp: '^CONFIG_RTE_PORT_PCAP=n' + line: 'CONFIG_RTE_PORT_PCAP=y' + +- name: enable DPDK RTE_TABLE_STATS_COLLECT + lineinfile: + dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config" + regexp: '^CONFIG_RTE_TABLE_STATS_COLLECT=n' + line: 'CONFIG_RTE_TABLE_STATS_COLLECT=y' + +- name: enable DPDK RTE_PIPELINE_STATS_COLLECT + lineinfile: + dest: "{{ dpdk_path }}/{{ dpdk_make_arch }}/.config" + regexp: '^CONFIG_RTE_PIPELINE_STATS_COLLECT=n' + line: 'CONFIG_RTE_PIPELINE_STATS_COLLECT=y' + +- my_make: + chdir: "{{ dpdk_path }}/{{ dpdk_make_arch}}" + extra_args: "-j {{ ansible_processor_vcpus }}" + +- file: + path: "{{ dpdk_module_dir}}" + state: directory + +- copy: + src: "{{ dpdk_path }}/{{ dpdk_make_arch }}/kmod/igb_uio.ko" + dest: "{{ dpdk_module_dir }}/igb_uio.ko" + remote_src: yes + +- command: depmod -a + +- file: + path: "{{ INSTALL_BIN_PATH }}" + state: directory + +- name: copy dpdk-devbind.py to correct location + copy: + src: "{{ dpdk_devbind[dpdk_version] }}" + dest: "{{ INSTALL_BIN_PATH }}/dpdk-devbind.py" + remote_src: yes + force: yes + mode: 0755 + +- name: make dpdk_nic_bind.py for backwards compatibility + copy: + src: "{{ dpdk_devbind[dpdk_version] }}" + dest: "{{ INSTALL_BIN_PATH }}/dpdk_nic_bind.py" + remote_src: yes + force: yes + mode: 0755 diff --git a/ansible/roles/install_dpdk/vars/main.yml b/ansible/roles/install_dpdk/vars/main.yml new file mode 100644 index 000000000..730215c90 --- /dev/null +++ b/ansible/roles/install_dpdk/vars/main.yml @@ -0,0 +1,8 @@ +--- +dpdk_make_arch: x86_64-native-linuxapp-gcc +dpdk_module_dir: "/lib/modules/{{ ansible_kernel }}/extra" +hugetable_mount: /mnt/huge +dpdk_devbind: + "16.07": "{{ dpdk_path }}/tools/dpdk-devbind.py" + "17.02": "{{ dpdk_path }}/usertools/dpdk-devbind.py" + "17.04": "{{ dpdk_path }}/usertools/dpdk-devbind.py" diff --git a/ansible/roles/install_image_dependencies/defaults/main.yml b/ansible/roles/install_image_dependencies/defaults/main.yml new file mode 100644 index 000000000..b1695e278 --- /dev/null +++ b/ansible/roles/install_image_dependencies/defaults/main.yml @@ -0,0 +1,46 @@ +--- +pkg_mgr_retries: 3 +epel_rpm_el7: https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + +install_dependencies: + Debian: + - bc + - fio + - git + - gcc + - iperf3 + - ethtool + - iproute2 + - linux-tools-common + - linux-tools-generic + - lmbench + - make + - netperf + - patch + - perl + - rt-tests + - stress + - sysstat + - unzip + # for Trex + - libpython2.7-dev + RedHat: + - bc + - fio + - git + - gcc + - iperf3 + - ethtool + - iproute + - perf + - kernel-tools + - lmbench + - make + - netperf + - patch + - perl + - rt-tests + - stress + - sysstat + - unzip + - python-devel diff --git a/ansible/roles/install_image_dependencies/tasks/Debian.yml b/ansible/roles/install_image_dependencies/tasks/Debian.yml new file mode 100644 index 000000000..a54e115be --- /dev/null +++ b/ansible/roles/install_image_dependencies/tasks/Debian.yml @@ -0,0 +1,15 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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. +--- + diff --git a/ansible/roles/install_image_dependencies/tasks/RedHat.yml b/ansible/roles/install_image_dependencies/tasks/RedHat.yml new file mode 100644 index 000000000..9f5cdce96 --- /dev/null +++ b/ansible/roles/install_image_dependencies/tasks/RedHat.yml @@ -0,0 +1,16 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: Install EPEL if needed + action: "{{ ansible_pkg_mgr }} name={{ epel_rpm_el7 }} state=present" diff --git a/ansible/roles/install_image_dependencies/tasks/main.yml b/ansible/roles/install_image_dependencies/tasks/main.yml new file mode 100644 index 000000000..33d99af06 --- /dev/null +++ b/ansible/roles/install_image_dependencies/tasks/main.yml @@ -0,0 +1,23 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: OS pre-workarounds + include: "{{ target_os_family }}.yml" + + - name: Install core packages + action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest" + register: pkg_mgr_results + retries: "{{ pkg_mgr_retries }}" + until: pkg_mgr_results|success + with_items: "{{ install_dependencies[target_os_family] }}" diff --git a/ansible/roles/install_local_yardstick/tasks/main.yml b/ansible/roles/install_local_yardstick/tasks/main.yml new file mode 100644 index 000000000..1a8227f8e --- /dev/null +++ b/ansible/roles/install_local_yardstick/tasks/main.yml @@ -0,0 +1,19 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: remove yardstick + pip: name=yardstick state=absent + +- name: install yardstack + pip: name="file://{{ YARDSTICK_REPO_DIR }}" state=forcereinstall diff --git a/ansible/roles/install_prox/tasks/Debian.yml b/ansible/roles/install_prox/tasks/Debian.yml new file mode 100755 index 000000000..00a31fc41 --- /dev/null +++ b/ansible/roles/install_prox/tasks/Debian.yml @@ -0,0 +1,24 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: Install PROX build dependencies + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: + - pkg-config + - liblua5.2-dev + - libncurses5 + - libncurses5-dev + - libncursesw5 + - libncursesw5-dev + - libedit-dev diff --git a/ansible/roles/install_prox/tasks/RedHat.yml b/ansible/roles/install_prox/tasks/RedHat.yml new file mode 100644 index 000000000..69fa83b31 --- /dev/null +++ b/ansible/roles/install_prox/tasks/RedHat.yml @@ -0,0 +1,22 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: Install PROX build dependencies + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: + - pkgconfig + - lua-devel + - ncurses-devel + - libedit-devel + diff --git a/ansible/roles/install_prox/tasks/main.yml b/ansible/roles/install_prox/tasks/main.yml new file mode 100644 index 000000000..93025fcb4 --- /dev/null +++ b/ansible/roles/install_prox/tasks/main.yml @@ -0,0 +1,30 @@ +# Copyright (c) 2017 Intel Corporation +# +# 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. +--- +- include: "{{ ansible_os_family }}.yml" + +- name: workaround, make trailing.sh executable + file: + path: "{{ prox_path }}/helper-scripts/trailing.sh" + state: touch + mode: 0755 + when: prox_version == "v035" + +- make: + chdir: "{{ prox_path }}" + environment: + RTE_SDK: "{{ RTE_SDK }}" + RTE_TARGET: "{{ RTE_TARGET }}" + + diff --git a/ansible/roles/install_ramspeed/tasks/main.yml b/ansible/roles/install_ramspeed/tasks/main.yml new file mode 100644 index 000000000..c995661d7 --- /dev/null +++ b/ansible/roles/install_ramspeed/tasks/main.yml @@ -0,0 +1,26 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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. +--- +- file: + path: "{{ ramspeed_dest }}/{{ ramspeed_release }}/temp" + state: directory + +- file: + path: "{{ ramspeed_dest }}/{{ ramspeed_release }}/build.sh" + mode: 744 +- name: install ramspeed + command: "{{ ramspeed_dest }}/{{ ramspeed_release }}/build.sh" + args: + chdir: "{{ ramspeed_dest }}/{{ ramspeed_release }}" + diff --git a/ansible/roles/install_storperf/remove_storperf/tasks/main.yml b/ansible/roles/install_storperf/remove_storperf/tasks/main.yml new file mode 100644 index 000000000..43e799239 --- /dev/null +++ b/ansible/roles/install_storperf/remove_storperf/tasks/main.yml @@ -0,0 +1,16 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: remove storperf + command: yardstick -d plugin remove plugin/CI/storperf.yaml
\ No newline at end of file diff --git a/ansible/roles/install_storperf/tasks/main.yml b/ansible/roles/install_storperf/tasks/main.yml new file mode 100644 index 000000000..8a73d2932 --- /dev/null +++ b/ansible/roles/install_storperf/tasks/main.yml @@ -0,0 +1,16 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: install storperf + command: yardstick -d plugin install plugin/CI/storperf.yaml
\ No newline at end of file diff --git a/ansible/roles/install_trex/defaults/main.yml b/ansible/roles/install_trex/defaults/main.yml new file mode 100644 index 000000000..1b2876301 --- /dev/null +++ b/ansible/roles/install_trex/defaults/main.yml @@ -0,0 +1,17 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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. +--- +#TREX_DOWNLOAD: "https://trex-tgn.cisco.com/trex/release/v2.05.tar.gz" +TREX_VERSION: v2.20 +TREX_DOWNLOAD: "{{ nsb_mirror_url|ternary(nsb_mirror_url, 'https://trex-tgn.cisco.com/trex/release' }}/{{ TREX_VERSION }}.tar.gz" diff --git a/ansible/roles/install_trex/tasks/main.yml b/ansible/roles/install_trex/tasks/main.yml new file mode 100644 index 000000000..4818a8087 --- /dev/null +++ b/ansible/roles/install_trex/tasks/main.yml @@ -0,0 +1,36 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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. +--- +- set_fact: + trex_file: "{{ trex_url|basename|regex_replace('[.]tar.gz', '') }}" + + +- file: path="{{ INSTALL_BIN_PATH }}/trex" state=absent +- file: path="{{ INSTALL_BIN_PATH }}/trex" state=directory + + +- command: mv "{{ clone_dest }}/{{ trex_unarchive }}" "{{ INSTALL_BIN_PATH }}/trex/scripts" + +- file: path="{{ INSTALL_BIN_PATH }}/trex/scripts/automation/trex_control_plane/stl/__init__.py" state=touch + +# Don't use trex/scripts/dpdk_nic_bind.py use DPDK usertools/dpdk-devbind.py +#- command: cp "{{ INSTALL_BIN_PATH }}/trex/scripts/dpdk_nic_bind.py" "{{ INSTALL_BIN_PATH }}" + +- name: add scripts to PYTHONPATH + lineinfile: + dest: /etc/environment + regexp: "^PYTHONPATH=" + line: "PYTHONPATH={{ INSTALL_BIN_PATH }}/trex/scripts/automation/trex_control_plane:{{ INSTALL_BIN_PATH }}/trex/scripts/automation/trex_control_plane/stl" + state: present + create: yes diff --git a/ansible/roles/install_unixbench/tasks/main.yml b/ansible/roles/install_unixbench/tasks/main.yml new file mode 100644 index 000000000..46edc54a0 --- /dev/null +++ b/ansible/roles/install_unixbench/tasks/main.yml @@ -0,0 +1,19 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: install unixbench + make: + # extra subdir for UnixBench + chdir: "{{ unixbench_dest }}/UnixBench" + target: all diff --git a/ansible/roles/install_vnf_vACL/tasks/main.yml b/ansible/roles/install_vnf_vACL/tasks/main.yml new file mode 100644 index 000000000..ff2e769f0 --- /dev/null +++ b/ansible/roles/install_vnf_vACL/tasks/main.yml @@ -0,0 +1,41 @@ +# Copyright (c) 2017 Intel Corporation +# +# 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: vACL_vnf make clean + my_make: chdir="{{ acl_build_dir }}" target=clean extra_args="-j {{ ansible_processor_vcpus }}" + environment: + RTE_SDK: "{{ RTE_SDK }}" + RTE_TARGET: "{{ RTE_TARGET }}" + VNF_CORE: "{{ samplevnf_path }}" + +- name: make vACL VNF + my_make: chdir="{{ acl_build_dir }}" extra_args="-j {{ ansible_processor_vcpus }}" + environment: + RTE_SDK: "{{ RTE_SDK }}" + RTE_TARGET: "{{ RTE_TARGET }}" + VNF_CORE: "{{ samplevnf_path }}" + +#- command: cp "{{ acl_build_dir }}/vACL/build/ip_pipeline" "{{ INSTALL_BIN_PATH }}/vACL_vnf" +- name: Install vACL VNF + copy: + src: "{{ acl_build_dir }}/build/vACL" + dest: "{{ INSTALL_BIN_PATH }}/vACL" + remote_src: True + # make executable + mode: 0755 + +#- command: cp "{{ acl_build_dir }}/vACL/config/full_tm_profile_10G.cfg" "{{ INSTALL_BIN_PATH }}/" +#- copy: +# src: "{{ acl_build_dir }}/vACL/config/full_tm_profile_10G.cfg" +# dest: "{{ INSTALL_BIN_PATH }}/" diff --git a/ansible/roles/install_vnf_vACL/vars/main.yml b/ansible/roles/install_vnf_vACL/vars/main.yml new file mode 100644 index 000000000..ee61bf11c --- /dev/null +++ b/ansible/roles/install_vnf_vACL/vars/main.yml @@ -0,0 +1,2 @@ +--- +acl_build_dir: "{{ samplevnf_path }}/VNFs/vACL"
\ No newline at end of file diff --git a/ansible/roles/install_vnf_vCGNAPT/tasks/main.yml b/ansible/roles/install_vnf_vCGNAPT/tasks/main.yml new file mode 100644 index 000000000..9f8458f6f --- /dev/null +++ b/ansible/roles/install_vnf_vCGNAPT/tasks/main.yml @@ -0,0 +1,41 @@ +# Copyright (c) 2017 Intel Corporation +# +# 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: vCGNAPT_vnf make clean + my_make: chdir="{{ acl_build_dir }}" target=clean extra_args="-j {{ ansible_processor_vcpus }}" + environment: + RTE_SDK: "{{ RTE_SDK }}" + RTE_TARGET: "{{ RTE_TARGET }}" + VNF_CORE: "{{ samplevnf_path }}" + +- name: make vCGNAPT VNF + my_make: chdir="{{ acl_build_dir }}" extra_args="-j {{ ansible_processor_vcpus }}" + environment: + RTE_SDK: "{{ RTE_SDK }}" + RTE_TARGET: "{{ RTE_TARGET }}" + VNF_CORE: "{{ samplevnf_path }}" + +#- command: cp "{{ acl_build_dir }}/vCGNAPT/build/ip_pipeline" "{{ INSTALL_BIN_PATH }}/vCGNAPT_vnf" +- name: Install vCGNAPT VNF + copy: + src: "{{ acl_build_dir }}/build/vCGNAPT" + dest: "{{ INSTALL_BIN_PATH }}/vCGNAPT" + remote_src: True + # make executable + mode: 0755 + +#- command: cp "{{ acl_build_dir }}/vCGNAPT/config/full_tm_profile_10G.cfg" "{{ INSTALL_BIN_PATH }}/" +#- copy: +# src: "{{ acl_build_dir }}/vCGNAPT/config/full_tm_profile_10G.cfg" +# dest: "{{ INSTALL_BIN_PATH }}/" diff --git a/ansible/roles/install_vnf_vCGNAPT/vars/main.yml b/ansible/roles/install_vnf_vCGNAPT/vars/main.yml new file mode 100644 index 000000000..cca1a89a3 --- /dev/null +++ b/ansible/roles/install_vnf_vCGNAPT/vars/main.yml @@ -0,0 +1,2 @@ +--- +acl_build_dir: "{{ samplevnf_path }}/VNFs/vCGNAPT"
\ No newline at end of file diff --git a/ansible/roles/install_vnf_vFW/tasks/main.yml b/ansible/roles/install_vnf_vFW/tasks/main.yml new file mode 100644 index 000000000..cb3df3ed4 --- /dev/null +++ b/ansible/roles/install_vnf_vFW/tasks/main.yml @@ -0,0 +1,50 @@ +# Copyright (c) 2017 Intel Corporation +# +# 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: vFW_vnf make clean + my_make: chdir="{{ vfw_build_dir }}" target=clean extra_args="-j {{ ansible_processor_vcpus }}" + environment: + RTE_SDK: "{{ RTE_SDK }}" + RTE_TARGET: "{{ RTE_TARGET }}" + VNF_CORE: "{{ samplevnf_path }}" + +#- name: make vFW VNF +# my_make: chdir="{{ vfw_build_dir }}" extra_args="-j {{ ansible_processor_vcpus }}" +# environment: +# RTE_SDK: "{{ RTE_SDK }}" +# RTE_TARGET: "{{ RTE_TARGET }}" +# VNF_CORE: "{{ samplevnf_path }}" + +- name: make vFW VNF + command: make chdir="{{ vfw_build_dir }}" extra_args="-j {{ ansible_processor_vcpus }}" all + args: + chdir: "{{ vfw_build_dir }}" + environment: + RTE_SDK: "{{ RTE_SDK }}" + RTE_TARGET: "{{ RTE_TARGET }}" + VNF_CORE: "{{ samplevnf_path }}" + +#- command: cp "{{ vfw_build_dir }}/vFW/build/ip_pipeline" "{{ INSTALL_BIN_PATH }}/vFW_vnf" +- name: Install vFW VNF + copy: + src: "{{ vfw_build_dir }}/build/vFW" + dest: "{{ INSTALL_BIN_PATH }}/vFW" + remote_src: True + # make executable + mode: 0755 + +#- command: cp "{{ vfw_build_dir }}/vFW/config/full_tm_profile_10G.cfg" "{{ INSTALL_BIN_PATH }}/" +#- copy: +# src: "{{ vfw_build_dir }}/vFW/config/full_tm_profile_10G.cfg" +# dest: "{{ INSTALL_BIN_PATH }}/" diff --git a/ansible/roles/install_vnf_vFW/vars/main.yml b/ansible/roles/install_vnf_vFW/vars/main.yml new file mode 100644 index 000000000..8a8a39865 --- /dev/null +++ b/ansible/roles/install_vnf_vFW/vars/main.yml @@ -0,0 +1,2 @@ +--- +vfw_build_dir: "{{ samplevnf_path }}/VNFs/vFW"
\ No newline at end of file diff --git a/ansible/roles/install_vnf_vPE/tasks/main.yml b/ansible/roles/install_vnf_vPE/tasks/main.yml new file mode 100644 index 000000000..91d449a41 --- /dev/null +++ b/ansible/roles/install_vnf_vPE/tasks/main.yml @@ -0,0 +1,37 @@ +# Copyright (c) 2017 Intel Corporation +# +# 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: vPE_vnf make clean + my_make: chdir="{{ vpe_build_dir }}" target=clean extra_args="-j {{ ansible_processor_vcpus }}" + environment: + RTE_SDK: "{{ RTE_SDK }}" + RTE_TARGET: "{{ RTE_TARGET }}" + +- name: make vPE VNF + my_make: chdir="{{ vpe_build_dir }}" extra_args="-j {{ ansible_processor_vcpus }}" + environment: + RTE_SDK: "{{ RTE_SDK }}" + RTE_TARGET: "{{ RTE_TARGET }}" + +#- command: cp "{{ vpe_build_dir }}/vPE/build/ip_pipeline" "{{ INSTALL_BIN_PATH }}/vPE_vnf" +- name: Install vPE_vnf + copy: + src: "{{ vpe_build_dir }}/build/ip_pipeline" + dest: "{{ INSTALL_BIN_PATH }}/vPE_vnf" + remote_src: True + +#- command: cp "{{ vpe_build_dir }}/vPE/config/full_tm_profile_10G.cfg" "{{ INSTALL_BIN_PATH }}/" +#- copy: +# src: "{{ vpe_build_dir }}/vPE/config/full_tm_profile_10G.cfg" +# dest: "{{ INSTALL_BIN_PATH }}/" diff --git a/ansible/roles/install_vnf_vPE/vars/main.yml b/ansible/roles/install_vnf_vPE/vars/main.yml new file mode 100644 index 000000000..fe0a9727f --- /dev/null +++ b/ansible/roles/install_vnf_vPE/vars/main.yml @@ -0,0 +1,2 @@ +--- +vpe_build_dir: "{{ dpdk_path }}/examples/ip_pipeline"
\ No newline at end of file diff --git a/ansible/roles/load_igb_uio/tasks/main.yml b/ansible/roles/load_igb_uio/tasks/main.yml new file mode 100644 index 000000000..d144ea4b7 --- /dev/null +++ b/ansible/roles/load_igb_uio/tasks/main.yml @@ -0,0 +1,19 @@ +# Copyright (c) 2017 Intel Corporation +# +# 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: reload module dependencies + command: "depmod -a" + +- modprobe: name=uio state=present +- modprobe: name=igb_uio state=present diff --git a/ansible/roles/load_msr/tasks/main.yml b/ansible/roles/load_msr/tasks/main.yml new file mode 100644 index 000000000..b8037bd4d --- /dev/null +++ b/ansible/roles/load_msr/tasks/main.yml @@ -0,0 +1,19 @@ +# Copyright (c) 2017 Intel Corporation +# +# 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: load msr kernel module + modprobe: + name: msr + state: present + diff --git a/ansible/roles/modify_cloud_config/files/10_etc_hosts.cfg b/ansible/roles/modify_cloud_config/files/10_etc_hosts.cfg new file mode 100644 index 000000000..84b5985f9 --- /dev/null +++ b/ansible/roles/modify_cloud_config/files/10_etc_hosts.cfg @@ -0,0 +1,4 @@ +manage_etc_hosts: True +password: RANDOM +chpasswd: { expire: False } +ssh_pwauth: True diff --git a/ansible/roles/modify_cloud_config/tasks/main.yml b/ansible/roles/modify_cloud_config/tasks/main.yml new file mode 100644 index 000000000..39b82970a --- /dev/null +++ b/ansible/roles/modify_cloud_config/tasks/main.yml @@ -0,0 +1,18 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: Allow console access via pwd + copy: + src: 10_etc_hosts.cfg + dest: /etc/cloud/cloud.cfg.d/10_etc_hosts.cfg diff --git a/ansible/roles/reset_resolv_conf/tasks/main.yml b/ansible/roles/reset_resolv_conf/tasks/main.yml new file mode 100644 index 000000000..50094f24f --- /dev/null +++ b/ansible/roles/reset_resolv_conf/tasks/main.yml @@ -0,0 +1,29 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: Readlink on /etc/resolv.conf to find original file so we don't break image symlink + stat: + path: /etc/resolv.conf + register: resolv_conf_stat + +- name: pre-create resolv.conf sourc link dest + file: + path: "{{ resolv_conf_stat.stat.lnk_source|dirname }}" + state: directory + mode: 755 + +- name: Override resolv.conf link source with specific nameserver + template: + src: resolv.conf.j2 + dest: "{{ resolv_conf_stat.stat.lnk_source }}"
\ No newline at end of file diff --git a/ansible/roles/reset_resolv_conf/templates/resolv.conf.j2 b/ansible/roles/reset_resolv_conf/templates/resolv.conf.j2 new file mode 100644 index 000000000..b46460d43 --- /dev/null +++ b/ansible/roles/reset_resolv_conf/templates/resolv.conf.j2 @@ -0,0 +1,4 @@ +nameserver {{ nameserver_ip }} +nameserver 8.8.8.8 +nameserver 8.8.4.4 + diff --git a/ansible/roles/set_package_installer_proxy/defaults/main.yml b/ansible/roles/set_package_installer_proxy/defaults/main.yml new file mode 100644 index 000000000..9dcf3e9b6 --- /dev/null +++ b/ansible/roles/set_package_installer_proxy/defaults/main.yml @@ -0,0 +1,2 @@ +--- +connection_timeout: 600
\ No newline at end of file diff --git a/ansible/roles/set_package_installer_proxy/tasks/Debian.yml b/ansible/roles/set_package_installer_proxy/tasks/Debian.yml new file mode 100644 index 000000000..11117e5ed --- /dev/null +++ b/ansible/roles/set_package_installer_proxy/tasks/Debian.yml @@ -0,0 +1,35 @@ +# Copyright (c) 2016, Intel Corporation. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--- + - name: Create apt.conf.d/ proxy config + template: + src: apt_conf.j2 + dest: "/etc/apt/apt.conf.d/20proxy" + + - name: Test proxy connection +# async: "{{ connection_timeout }}" + action: "{{ ansible_pkg_mgr }} name=tar state=latest update_cache=yes" +# poll: 0 + register: test_proxy_job_id diff --git a/ansible/roles/set_package_installer_proxy/tasks/RedHat.yml b/ansible/roles/set_package_installer_proxy/tasks/RedHat.yml new file mode 100644 index 000000000..809e43a60 --- /dev/null +++ b/ansible/roles/set_package_installer_proxy/tasks/RedHat.yml @@ -0,0 +1,57 @@ +# Copyright (c) 2016, Intel Corporation. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--- + # must do this before setting yum proxy + - name: find yum/dnf config + stat: "path={{ item }}" + register: packager_conf_stat + with_items: + - /etc/yum.conf + - /etc/dnf/dnf.conf + + - name: insert yum/dnf proxy(http) + # insert after [main] section + lineinfile: + dest: "{{ item.stat.path }}" + state: present + regexp: "^proxy\\s*=\\s*{{ proxy_env.http_proxy }}" + insertafter: "^\\[main\\]" + line: "proxy={{ proxy_env.http_proxy }}" + when: '"http_proxy" in proxy_env and item.stat.isreg is defined and item.stat.isreg' + with_items: "{{ packager_conf_stat.results }}" + + - name: verify proxy + command: "grep proxy= {{ item.stat.path }}" + when: 'item.stat.isreg is defined and item.stat.isreg' + with_items: "{{ packager_conf_stat.results }}" + register: yum_proxy_lines + +# - name: Test proxy connection +# # try workaround call makecache directly +# # yum module was failing for some reason +# async: "{{ connection_timeout }}" +# command: "{{ ansible_pkg_mgr }} -d2 -y makecache" +# poll: 0 +# register: test_proxy_job_id diff --git a/ansible/roles/set_package_installer_proxy/tasks/main.yml b/ansible/roles/set_package_installer_proxy/tasks/main.yml new file mode 100644 index 000000000..9838cd489 --- /dev/null +++ b/ansible/roles/set_package_installer_proxy/tasks/main.yml @@ -0,0 +1,40 @@ +# Copyright (c) 2016, Intel Corporation. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of Intel Corporation nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--- + - name: Configure package manager proxy + include: "{{ ansible_os_family }}.yml" + +# - async_status: jid={{ test_proxy_job_id.ansible_job_id }} +# register: test_proxy_result +# until: test_proxy_result.finished +# retries: 60 +# delay: 10 +# +# - debug: var=hostvars[item]['test_proxy_result'] +# with_items: "{{ hostvars }}" +# +# - name: Verify proxy test +# fail: msg="proxy test timeout" +# when: "{{ test_proxy_result.get('finished', 0) == 0 }}" diff --git a/ansible/roles/set_package_installer_proxy/templates/apt_conf.j2 b/ansible/roles/set_package_installer_proxy/templates/apt_conf.j2 new file mode 100644 index 000000000..5b57178a7 --- /dev/null +++ b/ansible/roles/set_package_installer_proxy/templates/apt_conf.j2 @@ -0,0 +1,3 @@ +{% if "http_proxy" in proxy_env %} +Acquire::http::Proxy "{{ proxy_env.http_proxy }}"; +{% endif %} diff --git a/ansible/roles/upload_images/tasks/main.yml b/ansible/roles/upload_images/tasks/main.yml new file mode 100644 index 000000000..8629ee716 --- /dev/null +++ b/ansible/roles/upload_images/tasks/main.yml @@ -0,0 +1,26 @@ +# Copyright (c) 2017 Intel Corporation. +# +# 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: upload images + os_image: + state: present + name: "{{ item.key }}" + is_public: true + disk_format: qcow2 + container_format: bare + filename: "{{ local_images_dest }}/{{ item.value }}" + with_dict: "{{ yardstick_images }}" + environment: "{{ openrc }}" + + |