diff options
Diffstat (limited to 'ansible')
-rw-r--r-- | ansible/build_yardstick_image.yml | 96 | ||||
-rw-r--r-- | ansible/clean_images.yml | 1 | ||||
-rw-r--r-- | ansible/group_vars/all.yml | 1 | ||||
-rw-r--r-- | ansible/install_dependencies.yml | 1 | ||||
-rw-r--r-- | ansible/load_images.yml | 3 | ||||
-rw-r--r-- | ansible/nsb_setup.yml | 57 | ||||
-rw-r--r-- | ansible/roles/convert_openrc/defaults/main.yml | 1 | ||||
-rw-r--r-- | ansible/roles/docker/defaults/main.yml | 15 | ||||
-rw-r--r-- | ansible/roles/docker/handlers/main.yml | 20 | ||||
-rw-r--r-- | ansible/roles/docker/tasks/Debian.yml | 26 | ||||
-rw-r--r-- | ansible/roles/docker/tasks/RedHat.yml | 20 | ||||
-rw-r--r-- | ansible/roles/docker/tasks/main.yml | 31 | ||||
-rw-r--r-- | ansible/roles/docker/templates/RedHat-repos.j2 | 7 | ||||
-rw-r--r-- | ansible/roles/docker/templates/http-proxy-conf.j2 | 2 | ||||
-rw-r--r-- | ansible/roles/docker/vars/main.yml | 20 | ||||
-rwxr-xr-x | ansible/roles/install_dependencies/tasks/Debian.yml | 1 | ||||
-rw-r--r-- | ansible/roles/install_image_dependencies/defaults/main.yml | 2 | ||||
-rw-r--r-- | ansible/ubuntu_server_baremetal_deploy_samplevnfs.yml | 1 | ||||
-rw-r--r-- | ansible/yardstick-install-inventory.ini | 4 |
19 files changed, 212 insertions, 97 deletions
diff --git a/ansible/build_yardstick_image.yml b/ansible/build_yardstick_image.yml index 025573b4b..5f9158576 100644 --- a/ansible/build_yardstick_image.yml +++ b/ansible/build_yardstick_image.yml @@ -73,7 +73,6 @@ state: absent # download-common - - name: remove {{ workspace }} file: path: "{{ workspace }}" @@ -85,62 +84,9 @@ sha256url: "{{ sha256sums_url }}" dest: "{{ image_dest }}" -# - get_url: -# url: "{{ sha256sums_url }}" -# force: yes -# dest: "{{ workspace }}/{{ sha256sums_filename }}" - - # must use wget to workaround ubuntu cloud SSL certs checking failures -# - command: "curl -sS -o {{ workspace }}/{{ sha256sums_filename }} {{ sha256sums_url }}" - - -# - command: cat "{{ workspace }}/{{ sha256sums_filename }}" -# register: sha256sum_file -# -# - set_fact: -# image_sha256: "{{ sha256sum_file.stdout|regex_search('^([a-f0-9]+).*' ~ img ~ '$', '\\1', multiline=True) }}" - -# - get_url: -# url: "{{ image_url }}" -# force: yes -# dest: "{{ workspace }}/{{ image_filename }}" -# checksum: "sha256:{{ image_sha256 }}" -# register: fetch_image_status -# timeout: 300 -# retries: 2 -# until: fetch_image_status|succeeded - -# - name: "Fetch {{ image_url }}" -# - command: "curl -sS -o {{ workspace }}/{{ image_filename }} {{ image_url }}" -# register: fetch_image_status -# timeout: 300 -# retries: 2 -# until: fetch_image_status|succeeded - -# - name: Verify sha256sum of downloaded image -# - command: "sha256sum -c --ignore-missing {{ workspace }}/{{ sha256sums_filename }}" - -# - name: create loop devices -# command: "mknod -m 660 /dev/loop{{ item }} b 7 {{ item }}" -# args: -# creates: "/dev/loop{{ item }}" -# with_seq: -# - - - # download non-lxd - - name: convert image to raw command: "qemu-img convert {{ image_dest }} {{ raw_imgfile }}" - - # setup non-lxd - -# - shell: echo -e "d\\nn\\np\\n1\\n\\n\\nw" | parted -l "{{ raw_imgfile }}" -# - parted: -# device: "{{ raw_imgfile }}" -# number: 1 -# state: present - - name: create mknod devices in chroot command: "mknod -m 0660 /dev/loop{{ item }} b 7 {{ item }}" args: @@ -148,23 +94,6 @@ with_sequence: start=0 end=9 tags: mknod_devices -# - command: losetup --show --partscan --find "{{ raw_imgfile }}" -# register: loop_device_res -# -# - debug: -# var: loop_device_res -# verbosity: 2 -# -# - set_fact: -# loop_device: "{{ loop_device_res.stdout.strip() }}" -# -# - wait_for: -# path: "{{ loop_device }}" -# state: present -# -# - command: losetup -# - command: dmsetup ls - - name: find first partition device # command: kpartx -l "{{ loop_device }}" command: kpartx -l "{{ raw_imgfile }}" @@ -179,11 +108,9 @@ - name: use kpartx to create device nodes for the raw image loop device # operate on the loop device to avoid /dev namespace missing devices -# command: kpartx -avs "{{ loop_device }}" command: kpartx -avs "{{ raw_imgfile }}" - name: parted dump raw image -# command: parted "{{ loop_device }}" print command: parted "{{ raw_imgfile }}" print register: parted_res @@ -199,7 +126,7 @@ image_fs_type: "{{ blkid_res.stdout.strip() }}" - name: make tmp disposable fstab - command: mktemp fake_fstab.XXXXXXXXXX + command: mktemp --tmpdir fake_fstab.XXXXXXXXXX register: mktemp_res - set_fact: @@ -211,7 +138,9 @@ name: "{{ mountdir }}" # fstype is required fstype: "{{ image_fs_type }}" - #fstab: "{{ fake_fstab }}" + # !!!!!!! this is required otherwise we add entries to /etc/fstab + # and prevent the system from booting + fstab: "{{ fake_fstab }}" state: mounted - name: mount chroot /proc @@ -219,7 +148,9 @@ src: none name: "{{ mountdir }}/proc" fstype: proc - #fstab: "{{ fake_fstab }}" + # !!!!!!! this is required otherwise we add entries to /etc/fstab + # and prevent the system from booting + fstab: "{{ fake_fstab }}" state: mounted - name: if arm copy qemu-aarch64-static into chroot @@ -228,19 +159,6 @@ dest: "{{ mountdir }}/usr/bin" when: 'YARD_IMG_ARCH == "arm64"' - - # setup lxd -# - file: "path={{ mountdir }} state=directory" -# -# - unarchive: -# src: "{{ image_filename }}" -# dest: "{{ mountdir }}" -# remote_src: yes - - # end setup lxd - - # modify - - name: create ubuntu policy-rc.d workaround copy: content: "{{ '#!/bin/sh\nexit 101\n' }}" diff --git a/ansible/clean_images.yml b/ansible/clean_images.yml index a7a6c2af1..f63489d2d 100644 --- a/ansible/clean_images.yml +++ b/ansible/clean_images.yml @@ -18,5 +18,6 @@ - yardstick_config.yml roles: + - convert_openrc - clean_images - clean_flavors diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 2690228c3..edd6564d0 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -3,3 +3,4 @@ clone_dest: /opt/tempT release: xenial
target_os: Ubuntu
ubuntu_image_file: /tmp/workspace/yardstick/yardstick-trusty-server.raw
+proxy_env: {}
\ No newline at end of file diff --git a/ansible/install_dependencies.yml b/ansible/install_dependencies.yml index 001418497..1c7d20170 100644 --- a/ansible/install_dependencies.yml +++ b/ansible/install_dependencies.yml @@ -17,4 +17,3 @@ roles: - install_dependencies - diff --git a/ansible/load_images.yml b/ansible/load_images.yml index 7cf34adec..a4c130d46 100644 --- a/ansible/load_images.yml +++ b/ansible/load_images.yml @@ -59,8 +59,7 @@ - include: build_yardstick_image.yml -# TEMP -#- include: image_uploaders/upload_yardstick_image.yml +- include: image_uploaders/upload_yardstick_image.yml # upload cirros # upload vanilla ubuntu cloud_image diff --git a/ansible/nsb_setup.yml b/ansible/nsb_setup.yml new file mode 100644 index 000000000..e79ccabea --- /dev/null +++ b/ansible/nsb_setup.yml @@ -0,0 +1,57 @@ +# 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: ubuntu_server_baremetal_deploy_samplevnfs.yml + vars: + YARD_IMG_ARCH: amd64 + +- hosts: localhost + roles: + - install_dependencies + - docker + +- include: build_yardstick_image.yml + vars: + YARD_IMG_ARCH: amd64 + release: xenial + when: openrc_file is defined + +- include: clean_images.yml + when: openrc_file is defined + +- hosts: localhost + post_tasks: + - os_image: + name: yardstick-samplevnfs + is_public: yes + disk_format: qcow2 + container_format: bare + filename: "{{ raw_imgfile }}" + environment: "{{ openrc }}" + when: openrc_file is defined + + - name: Start yardstick container + docker_container: + name: yardstick + image: opnfv/yardstick:latest + recreate: yes + state: started + restart_policy: always + network_mode: host + privileged: True + interactive: True + volumes: + - "{{ openrc_file|default('/dev/null') }}:/etc/yardstick/openstack.creds:ro" + - /var/run/docker.sock:/var/run/docker.sock + - /opt/:/opt diff --git a/ansible/roles/convert_openrc/defaults/main.yml b/ansible/roles/convert_openrc/defaults/main.yml index dffca1078..24a7129cc 100644 --- a/ansible/roles/convert_openrc/defaults/main.yml +++ b/ansible/roles/convert_openrc/defaults/main.yml @@ -12,6 +12,5 @@ # 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/docker/defaults/main.yml b/ansible/roles/docker/defaults/main.yml new file mode 100644 index 000000000..e961969a4 --- /dev/null +++ b/ansible/roles/docker/defaults/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. +--- +ubuntu_docker_url: https://apt.dockerproject.org/repo diff --git a/ansible/roles/docker/handlers/main.yml b/ansible/roles/docker/handlers/main.yml new file mode 100644 index 000000000..5e6556031 --- /dev/null +++ b/ansible/roles/docker/handlers/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: systemd daemon reload + command: systemctl daemon-reload + + - name: restart docker + service: name=docker state=restarted + diff --git a/ansible/roles/docker/tasks/Debian.yml b/ansible/roles/docker/tasks/Debian.yml new file mode 100644 index 000000000..cf4128774 --- /dev/null +++ b/ansible/roles/docker/tasks/Debian.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: add Ubuntu docker repo + apt_repository: repo='deb [trusted=yes] {{ ubuntu_docker_url }} ubuntu-{{ ansible_distribution_release }} main' state=present + + - name: ensure correct docker version + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present force=yes" + with_items: "{{ docker_packages[ansible_os_family] }}" + + - name: remove Ubuntu docker repo + apt_repository: + repo: 'deb [trusted=yes] {{ ubuntu_docker_url }} ubuntu-{{ ansible_distribution_release }} main' + state: absent + update_cache: no diff --git a/ansible/roles/docker/tasks/RedHat.yml b/ansible/roles/docker/tasks/RedHat.yml new file mode 100644 index 000000000..2261da3de --- /dev/null +++ b/ansible/roles/docker/tasks/RedHat.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: bootstrap docker project repos + template: "src={{ ansible_os_family }}-repos.j2 dest=/etc/yum.repos.d/docker.repo" + + - name: ensure correct docker version + action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" + with_items: "{{ docker_packages[ansible_os_family] }}" diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml new file mode 100644 index 000000000..bbec371a8 --- /dev/null +++ b/ansible/roles/docker/tasks/main.yml @@ -0,0 +1,31 @@ +# 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 docker + include: "{{ ansible_os_family }}.yml" + + - name: create docker service config dir + file: path=/etc/systemd/system/docker.service.d state=directory + + - name: create docker proxy config + template: src=http-proxy-conf.j2 dest=/etc/systemd/system/docker.service.d/http-proxy.conf owner=root mode=0644 + when: 'proxy_env is defined and "http_proxy" in proxy_env or "https_proxy" in proxy_env' + notify: + - systemd daemon reload + - restart docker + + - name: start docker service + service: name=docker state=started enabled=yes + + - meta: flush_handlers diff --git a/ansible/roles/docker/templates/RedHat-repos.j2 b/ansible/roles/docker/templates/RedHat-repos.j2 new file mode 100644 index 000000000..6d367408c --- /dev/null +++ b/ansible/roles/docker/templates/RedHat-repos.j2 @@ -0,0 +1,7 @@ +[dockerrepo] +name=Docker Repository +# $releasever for RHEL 7 is '7Server' so we can't use $releasever +baseurl={{ docker_project_url }}/repo/main/{{ ansible_distribution|lower|regex_replace('redhat', 'centos') }}/{{ ansible_distribution_major_version }}/ +enabled=1 +gpgcheck=1 +gpgkey={{ docker_project_url }}/gpg diff --git a/ansible/roles/docker/templates/http-proxy-conf.j2 b/ansible/roles/docker/templates/http-proxy-conf.j2 new file mode 100644 index 000000000..854ddfe09 --- /dev/null +++ b/ansible/roles/docker/templates/http-proxy-conf.j2 @@ -0,0 +1,2 @@ +[Service] +Environment={% if "http_proxy" in proxy_env %}"HTTP_PROXY={{ proxy_env.http_proxy }}" {% endif %} {% if "https_proxy" in proxy_env %} "HTTPS_PROXY={{ proxy_env.https_proxy }}" {% endif %} {% if "http_proxy" in proxy_env or "https_proxy" in proxy_env %} "NO_PROXY=localhost,127.0.0.0/8" {% endif %} diff --git a/ansible/roles/docker/vars/main.yml b/ansible/roles/docker/vars/main.yml new file mode 100644 index 000000000..8b5077490 --- /dev/null +++ b/ansible/roles/docker/vars/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. +--- +docker_project_url: https://yum.dockerproject.org +docker_packages: + "RedHat": + - docker-engine-1.13.1 + "Debian": + - docker-engine=1.13.1* diff --git a/ansible/roles/install_dependencies/tasks/Debian.yml b/ansible/roles/install_dependencies/tasks/Debian.yml index 0047a5e3b..7a9911ebf 100755 --- a/ansible/roles/install_dependencies/tasks/Debian.yml +++ b/ansible/roles/install_dependencies/tasks/Debian.yml @@ -47,4 +47,3 @@ - uwsgi-plugin-python - supervisor - python-setuptools - diff --git a/ansible/roles/install_image_dependencies/defaults/main.yml b/ansible/roles/install_image_dependencies/defaults/main.yml index b1695e278..1540806cc 100644 --- a/ansible/roles/install_image_dependencies/defaults/main.yml +++ b/ansible/roles/install_image_dependencies/defaults/main.yml @@ -13,9 +13,7 @@ install_dependencies: - iproute2 - linux-tools-common - linux-tools-generic - - lmbench - make - - netperf - patch - perl - rt-tests diff --git a/ansible/ubuntu_server_baremetal_deploy_samplevnfs.yml b/ansible/ubuntu_server_baremetal_deploy_samplevnfs.yml index 3a1fbd08f..14bdd7eea 100644 --- a/ansible/ubuntu_server_baremetal_deploy_samplevnfs.yml +++ b/ansible/ubuntu_server_baremetal_deploy_samplevnfs.yml @@ -40,4 +40,3 @@ vnf_name: FW - role: install_samplevnf vnf_name: CGNATP - diff --git a/ansible/yardstick-install-inventory.ini b/ansible/yardstick-install-inventory.ini new file mode 100644 index 000000000..e2647b033 --- /dev/null +++ b/ansible/yardstick-install-inventory.ini @@ -0,0 +1,4 @@ +# the group of systems on which to install yardstick +# by default just localhost +[yardstick] +localhost ansible_connection=local |