summaryrefslogtreecommitdiffstats
path: root/ansible
diff options
context:
space:
mode:
Diffstat (limited to 'ansible')
-rw-r--r--ansible/group_vars/all.yml1
-rw-r--r--ansible/infra_deploy.yml1
-rw-r--r--ansible/install-inventory.ini3
-rw-r--r--ansible/install.yaml59
-rw-r--r--ansible/roles/infra_create_vms/tasks/create_interfaces.yml13
-rw-r--r--ansible/roles/infra_install_dependencies/tasks/Debian.yml34
-rw-r--r--ansible/roles/infra_install_dependencies/tasks/main.yml15
7 files changed, 111 insertions, 15 deletions
diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml
index 9f5293272..596560508 100644
--- a/ansible/group_vars/all.yml
+++ b/ansible/group_vars/all.yml
@@ -7,6 +7,7 @@ release: xenial
normal_image_file: "{{ workspace }}/yardstick-image.img"
nsb_image_file: "{{ workspace }}/yardstick-nsb-image.img"
ubuntu_image_file: /tmp/workspace/yardstick/yardstick-trusty-server.raw
+installation_mode: "{{ INSTALLATION_MODE | default('baremetal') }}"
proxy_env:
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/bin
http_proxy: "{{ lookup('env', 'http_proxy') }}"
diff --git a/ansible/infra_deploy.yml b/ansible/infra_deploy.yml
index 8cf5dffef..4a5716eee 100644
--- a/ansible/infra_deploy.yml
+++ b/ansible/infra_deploy.yml
@@ -27,6 +27,7 @@
proxy_host_ip: "{{ lookup('dig', proxy_host) }}"
roles:
+ - infra_install_dependencies
- infra_destroy_previous_configuration
- infra_check_requirements
- infra_create_network
diff --git a/ansible/install-inventory.ini b/ansible/install-inventory.ini
index e15a2e96a..4e8629428 100644
--- a/ansible/install-inventory.ini
+++ b/ansible/install-inventory.ini
@@ -17,8 +17,9 @@ jumphost
[all:vars]
arch_amd64=amd64
arch_arm64=arm64
-inst_mode_container=container
inst_mode_baremetal=baremetal
+inst_mode_container=container
+inst_mode_container_pull=container_pull
ubuntu_archive={"amd64": "http://archive.ubuntu.com/ubuntu/", "arm64": "http://ports.ubuntu.com/ubuntu-ports/"}
# Uncomment credentials below if needed
# ansible_user=root
diff --git a/ansible/install.yaml b/ansible/install.yaml
index fa8419b53..0800ee534 100644
--- a/ansible/install.yaml
+++ b/ansible/install.yaml
@@ -15,7 +15,6 @@
- hosts: jumphost
become: yes
vars:
- installation_mode: "{{ INSTALLATION_MODE | default('baremetal') }}"
yardstick_dir: "{{ YARDSTICK_DIR | default('/home/opnfv/repos/yardstick') }}"
virtual_environment: "{{ VIRTUAL_ENVIRONMENT | default(False) }}"
nsb_dir: "{{ NSB_DIR | default('/opt/nsb_bin/') }}"
@@ -28,27 +27,30 @@
state: directory
owner: root
mode: 0777
+ when:
+ - installation_mode != inst_mode_container_pull
roles:
- - add_repos_jumphost
- - install_dependencies_jumphost
- - install_yardstick
- - configure_uwsgi
- - configure_nginx
- - configure_gui
- - download_trex
- - install_trex
- - configure_rabbitmq
+ - { role: add_repos_jumphost, when: installation_mode != inst_mode_container_pull }
+ - { role: install_dependencies_jumphost, when: installation_mode != inst_mode_container_pull }
+ - { role: install_yardstick, when: installation_mode != inst_mode_container_pull }
+ - { role: configure_uwsgi, when: installation_mode != inst_mode_container_pull }
+ - { role: configure_nginx, when: installation_mode != inst_mode_container_pull }
+ - { role: configure_gui, when: installation_mode != inst_mode_container_pull }
+ - { role: download_trex, when: installation_mode != inst_mode_container_pull }
+ - { role: install_trex, when: installation_mode != inst_mode_container_pull }
+ - { role: configure_rabbitmq, when: installation_mode != inst_mode_container_pull }
+
post_tasks:
- service:
name: nginx
state: restarted
- when: installation_mode != inst_mode_container
+ when: installation_mode == inst_mode_baremetal
- shell: uwsgi -i /etc/yardstick/yardstick.ini
- when: installation_mode != inst_mode_container
+ when: installation_mode == inst_mode_baremetal
- name: Prepare baremetal and standalone servers
@@ -106,6 +108,7 @@
include_role:
name: build_yardstick_image
tasks_from: pre_build.yml
+ when: installation_mode != inst_mode_container
- hosts: chroot_image
@@ -120,6 +123,7 @@
include_role:
name: build_yardstick_image
tasks_from: "cloudimg_modify_{{ img_property }}.yml"
+ when: installation_mode != inst_mode_container
- hosts: jumphost
@@ -130,3 +134,34 @@
include_role:
name: build_yardstick_image
tasks_from: post_build.yml
+ when: installation_mode != inst_mode_container
+
+
+- name: start yardstick container on jumphost
+ hosts: jumphost
+
+ tasks:
+ - include_role:
+ name: install_dependencies_jumphost
+ when: installation_mode == inst_mode_container_pull
+
+ - include_role:
+ name: docker
+ when: installation_mode == inst_mode_container_pull
+
+ - name: Start yardstick container
+ docker_container:
+ name: yardstick
+ pull: yes
+ recreate: yes
+ image: "{{ yardstick_docker_image|default('opnfv/yardstick:latest') }}"
+ state: started
+ restart_policy: always
+ privileged: yes
+ interactive: yes
+ volumes:
+ - "{{ openrc_file|default('/dev/null') }}:/etc/yardstick/openstack.creds:ro"
+ - /var/run/docker.sock:/var/run/docker.sock
+ - /opt:/opt
+ - /etc/localtime:/etc/localtime:ro
+ when: installation_mode == inst_mode_container_pull
diff --git a/ansible/roles/infra_create_vms/tasks/create_interfaces.yml b/ansible/roles/infra_create_vms/tasks/create_interfaces.yml
index 34bfd1b71..12b2726dc 100644
--- a/ansible/roles/infra_create_vms/tasks/create_interfaces.yml
+++ b/ansible/roles/infra_create_vms/tasks/create_interfaces.yml
@@ -12,6 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
---
+- set_fact:
+ mac_address_arg: "mac_address"
+
+- set_fact:
+ mac_address_arg: "macaddress"
+ when:
+ - ansible_distribution == 'Ubuntu'
+ - ansible_distribution_major_version|int >= 18
+
- name: Add network-data
blockinfile:
path: "{{ network_config }}"
@@ -20,9 +29,9 @@
block: |2
{{ 'enp0s%d:'| format( slot_address | int) }}
match:
- mac_address: {{ '52:54:00:5d:7d:%02x'| format( mac_address_counter | int) }}
+ {{ mac_address_arg }}: {{ '52:54:00:5d:7d:%02x'| format( mac_address_counter | int) }}
addresses:
- - {{ interface_item.ip }}/{{ interface_item.netmask }}
+ - {{ interface_item.ip }}/{{ (interface_item.ip + '/' + interface_item.netmask) | ipaddr('prefix') }}
- name: Add default gateway
blockinfile:
diff --git a/ansible/roles/infra_install_dependencies/tasks/Debian.yml b/ansible/roles/infra_install_dependencies/tasks/Debian.yml
new file mode 100644
index 000000000..9f4dc1046
--- /dev/null
+++ b/ansible/roles/infra_install_dependencies/tasks/Debian.yml
@@ -0,0 +1,34 @@
+# Copyright (c) 2018 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: Update repositories
+ apt:
+ update_cache: yes
+
+- name: Install core packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
+ with_items:
+ - python-libvirt
+ - genisoimage
+ when: ansible_distribution_major_version|int == 16
+
+- name: Install core packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
+ with_items:
+ - python-pip
+ - python-libvirt
+ - python-lxml
+ - python-netaddr
+ - genisoimage
+ when: ansible_distribution_major_version|int >= 18
diff --git a/ansible/roles/infra_install_dependencies/tasks/main.yml b/ansible/roles/infra_install_dependencies/tasks/main.yml
new file mode 100644
index 000000000..115b1e3b9
--- /dev/null
+++ b/ansible/roles/infra_install_dependencies/tasks/main.yml
@@ -0,0 +1,15 @@
+# Copyright (c) 2018 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_tasks: "{{ ansible_os_family }}.yml"