aboutsummaryrefslogtreecommitdiffstats
path: root/ansible
diff options
context:
space:
mode:
Diffstat (limited to 'ansible')
-rw-r--r--ansible/infra_deploy.yml2
-rw-r--r--ansible/nsb_setup.yml24
-rw-r--r--ansible/roles/convert_openrc/tasks/main.yml10
-rw-r--r--ansible/roles/create_storperf_admin_rc/tasks/main.yml9
-rw-r--r--ansible/roles/create_storperf_admin_rc/templates/storperf_admin-rc.j24
-rw-r--r--ansible/roles/infra_create_network/tasks/create_xml.yaml106
-rw-r--r--ansible/roles/infra_create_network/tasks/main.yml22
-rw-r--r--ansible/roles/infra_create_vms/tasks/configure_vm.yml342
-rw-r--r--ansible/roles/infra_create_vms/tasks/create_interfaces.yml65
-rw-r--r--ansible/roles/infra_create_vms/tasks/main.yml28
-rw-r--r--ansible/roles/infra_destroy_previous_configuration/tasks/delete_vm.yml29
-rw-r--r--ansible/roles/infra_destroy_previous_configuration/tasks/main.yml15
-rw-r--r--ansible/roles/install_dpdk/tasks/main.yml8
-rw-r--r--ansible/roles/install_trex/tasks/main.yml3
14 files changed, 613 insertions, 54 deletions
diff --git a/ansible/infra_deploy.yml b/ansible/infra_deploy.yml
index 948dd338a..4ad21af00 100644
--- a/ansible/infra_deploy.yml
+++ b/ansible/infra_deploy.yml
@@ -17,3 +17,5 @@
roles:
- infra_check_requirements
- infra_destroy_previous_configuration
+ - infra_create_network
+ - infra_create_vms
diff --git a/ansible/nsb_setup.yml b/ansible/nsb_setup.yml
index bfe5d2349..98a59f984 100644
--- a/ansible/nsb_setup.yml
+++ b/ansible/nsb_setup.yml
@@ -12,18 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
---
-#- name: Prepare baremetal machine
-# include: ubuntu_server_baremetal_deploy_samplevnfs.yml
-# vars:
-# YARD_IMG_ARCH: amd64
-#
-#- name: Install jumphost dependencies and configure docker
-# hosts: jumphost
-# environment:
-# "{{ proxy_env }}"
-# roles:
-# - install_dependencies
-# - docker
+- name: Prepare baremetal machine
+ include: ubuntu_server_baremetal_deploy_samplevnfs.yml
+ vars:
+ YARD_IMG_ARCH: amd64
+
+- name: Install jumphost dependencies and configure docker
+ hosts: jumphost
+ environment:
+ "{{ proxy_env }}"
+ roles:
+ - install_dependencies
+ - docker
- name: "handle all openstack stuff when: openrc_file is defined"
include: prepare_openstack.yml
diff --git a/ansible/roles/convert_openrc/tasks/main.yml b/ansible/roles/convert_openrc/tasks/main.yml
index 1606b0bc5..be621f0af 100644
--- a/ansible/roles/convert_openrc/tasks/main.yml
+++ b/ansible/roles/convert_openrc/tasks/main.yml
@@ -29,14 +29,8 @@
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_name: "{{ openrc.OS_PROJECT_NAME|default(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
@@ -44,7 +38,7 @@
clouds:
demo:
# must specify API version here
- identity_api_version: "{{ openrc.OS_IDENTITY_API_VERSION }}"
+ identity_api_version: "{{ openrc.OS_IDENTITY_API_VERSION|default(3) }}"
auth: "{{ os_auth }}"
- template:
diff --git a/ansible/roles/create_storperf_admin_rc/tasks/main.yml b/ansible/roles/create_storperf_admin_rc/tasks/main.yml
index bd1418e89..f63d1d814 100644
--- a/ansible/roles/create_storperf_admin_rc/tasks/main.yml
+++ b/ansible/roles/create_storperf_admin_rc/tasks/main.yml
@@ -12,15 +12,6 @@
# 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
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
index 410ab24df..888e87118 100644
--- a/ansible/roles/create_storperf_admin_rc/templates/storperf_admin-rc.j2
+++ b/ansible/roles/create_storperf_admin_rc/templates/storperf_admin-rc.j2
@@ -1,7 +1,5 @@
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 }}"
+OS_PROJECT_NAME="{{ openrc.OS_PROJECT_NAME|openrc.OS_TENANT_NAME|default('admin') }}"
diff --git a/ansible/roles/infra_create_network/tasks/create_xml.yaml b/ansible/roles/infra_create_network/tasks/create_xml.yaml
new file mode 100644
index 000000000..a01c7974a
--- /dev/null
+++ b/ansible/roles/infra_create_network/tasks/create_xml.yaml
@@ -0,0 +1,106 @@
+# Copyright (c) 2017-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: Define XML file name
+ set_fact:
+ xml_file: "{{ '/tmp/'+item.name+'.xml' }}"
+
+- name: Delete the file, if exists
+ file:
+ path: "{{ xml_file }}"
+ state: absent
+
+- name: Create a new empty file
+ file:
+ path: "{{ xml_file }}"
+ state: touch
+
+- name: Add root "network" node
+ blockinfile:
+ path: "{{ xml_file }}"
+ marker: ""
+ content: |
+ <network>
+ </network>
+
+- name: Add new children nodes to "network" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /network
+ add_children:
+ - name: "{{ item.name }}"
+ - bridge
+ - ip
+ pretty_print: yes
+
+- name: Add "name" attribute to "bridge" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /network/bridge
+ attribute: name
+ value: "{{ item.name }}"
+ pretty_print: yes
+
+- name: Add "stp" attribute to "bridge" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /network/bridge
+ attribute: stp
+ value: "on"
+ pretty_print: yes
+
+- name: Add "delay" attribute to "bridge" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /network/bridge
+ attribute: delay
+ value: "0"
+ pretty_print: yes
+
+- name: Add "address" attribute to "ip" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /network/ip
+ attribute: address
+ value: "{{ item.host_ip }}"
+ pretty_print: yes
+
+- name: Add "netmask" attribute to "ip" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /network/ip
+ attribute: netmask
+ value: "{{ item.netmask }}"
+ pretty_print: yes
+
+- name: Define the networks
+ virt_net:
+ command: define
+ name: "{{ item.name }}"
+ xml: "{{ lookup('file', xml_file) }}"
+
+- name: Set autostart to yes
+ virt_net:
+ autostart: yes
+ name: "{{ item.name }}"
+
+- name: Start the networks
+ virt_net:
+ command: start
+ name: "{{ item.name }}"
+
+- name: Remove XML file
+ file:
+ path: "{{ xml_file }}"
+ state: absent
diff --git a/ansible/roles/infra_create_network/tasks/main.yml b/ansible/roles/infra_create_network/tasks/main.yml
new file mode 100644
index 000000000..eba4a3a49
--- /dev/null
+++ b/ansible/roles/infra_create_network/tasks/main.yml
@@ -0,0 +1,22 @@
+# Copyright (c) 2017-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: Include
+ include_vars:
+ file: "{{ rs_file }}"
+ name: infra_deploy_vars
+
+- name: Create XML file
+ include_tasks: create_xml.yaml
+ with_items: "{{ infra_deploy_vars.networks }}"
diff --git a/ansible/roles/infra_create_vms/tasks/configure_vm.yml b/ansible/roles/infra_create_vms/tasks/configure_vm.yml
new file mode 100644
index 000000000..10201cf2a
--- /dev/null
+++ b/ansible/roles/infra_create_vms/tasks/configure_vm.yml
@@ -0,0 +1,342 @@
+# Copyright (c) 2017-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: Remove directory
+ file:
+ path: "{{ '/tmp/'+node_item.hostname }}"
+ state: absent
+
+- name: Create directory
+ file:
+ path: "{{ '/tmp/'+node_item.hostname }}"
+ state: directory
+ mode: 0755
+
+- name: Define user-data file name
+ set_fact:
+ user_data: "{{ '/tmp/'+node_item.hostname+'/user-data' }}"
+
+- name: Define image-dir
+ set_fact:
+ image_dir: "{{ '/var/lib/libvirt/images/' }}"
+
+- name: Create a new empty file for user-data
+ file:
+ path: "{{ user_data }}"
+ state: touch
+
+- name: Add user-data
+ blockinfile:
+ path: "{{ user_data }}"
+ marker: "MARKER"
+ content: |
+ #cloud-config
+ preserve_hostname: False
+ hostname: {{ node_item.hostname }}
+ output:
+ all: ">> /var/log/cloud-init.log"
+ ssh_pwauth: True
+ bootcmd:
+ - echo 127.0.0.1 {{ node_item.hostname }} >> /etc/hosts
+ users:
+ - name: {{ node_item.user }}
+ lock-passwd: False
+ plain_text_passwd: {{ node_item.password }}
+ chpasswd: { expire: False }
+ sudo: ALL=(ALL) NOPASSWD:ALL
+ ssh_pwauth: True
+
+- name: Remove the marker
+ lineinfile:
+ dest: "{{ user_data }}"
+ state: absent
+ regexp: "MARKER"
+
+- name: Define network-config file name
+ set_fact:
+ network_config: "{{ '/tmp/'+node_item.hostname+'/network-config' }}"
+
+- name: Create a new empty file for network-config
+ file:
+ path: "{{ network_config }}"
+ state: touch
+
+- name: Add network-data
+ blockinfile:
+ path: "{{ network_config }}"
+ marker: "MARKER"
+ content: |
+ version: 2
+ ethernets:
+
+- name: Define meta-data file name
+ set_fact:
+ meta_data: "{{ '/tmp/'+node_item.hostname+'/meta-data' }}"
+
+- name: Create a new empty file for meta-data
+ file:
+ path: "{{ meta_data }}"
+ state: touch
+
+- name: Add meta-data
+ blockinfile:
+ path: "{{ meta_data }}"
+ marker: "MARKER"
+ content: |
+ instance-id: {{ node_item.hostname }}
+ local-hostname: {{ node_item.hostname }}
+
+- name: Remove the marker
+ lineinfile:
+ dest: "{{ meta_data }}"
+ state: absent
+ regexp: "MARKER"
+
+- name: Define xml file name
+ set_fact:
+ xml_file: "{{ '/tmp/'+node_item.hostname+'/'+node_item.hostname+'.xml' }}"
+
+- name: Create a new empty file for xml file
+ file:
+ path: "{{ xml_file }}"
+ state: touch
+
+- name: Add root "domain" node
+ blockinfile:
+ path: "{{ xml_file }}"
+ marker: ""
+ content: |
+ <domain>
+ </domain>
+
+- name: Add "type" attribute to "domain" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain
+ attribute: type
+ value: "kvm"
+ pretty_print: yes
+
+- name: Add new children nodes to "domain" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain
+ add_children:
+ - name: "{{ node_item.hostname }}"
+ - memory: "{{ node_item.ram }}"
+ - vcpu: "{{ node_item.vcpus }}"
+ - os
+ - cpu
+ - devices
+ pretty_print: yes
+
+- name: Add "unit" attribute to "memory" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain/memory
+ attribute: unit
+ value: "MB"
+ pretty_print: yes
+
+- name: Add "placement" attribute to "vcpu" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain/vcpu
+ attribute: placement
+ value: "static"
+ pretty_print: yes
+
+- name: Add new children nodes to "os" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain/os
+ add_children:
+ - type: "hvm"
+ - boot
+ pretty_print: yes
+
+- name: Add "arch" attribute to "type" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain/os/type
+ attribute: arch
+ value: "x86_64"
+ pretty_print: yes
+
+- name: Add "dev" attribute to "boot" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain/os/boot
+ attribute: dev
+ value: "hd"
+ pretty_print: yes
+
+- name: Add new children nodes to "cpu" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain/cpu
+ add_children:
+ - cache
+ pretty_print: yes
+
+- name: Add "mode" attribute to "cpu" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain/cpu
+ attribute: mode
+ value: "host-passthrough"
+ pretty_print: yes
+
+- name: Add "mode" attribute to "cache" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain/cpu/cache
+ attribute: mode
+ value: "passthrough"
+ pretty_print: yes
+
+- name: Add new children nodes to "devices" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain/devices
+ add_children:
+ - disk:
+ type: file
+ device: disk
+ - controller:
+ type: virtio-serial
+ index: '0'
+ - serial:
+ type: pty
+ - console:
+ type: pty
+ tty: '/dev/pts/14'
+ pretty_print: yes
+
+- name: Add new children nodes to "disk" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain/devices/disk
+ add_children:
+ - driver:
+ name: qemu
+ type: qcow2
+ - source:
+ file: "{{ '/var/lib/libvirt/images/'+node_item.hostname+'.qcow2' }}"
+ - target:
+ dev: vda
+ bus: virtio
+ - alias:
+ name: virtio-disk0
+ pretty_print: yes
+
+- name: Add new children nodes to "devices" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain/devices
+ add_children:
+ - disk:
+ type: file
+ device: cdrom
+ pretty_print: yes
+
+- name: Add new children nodes to "disk" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain/devices/disk
+ add_children:
+ - source:
+ file: "{{ '/var/lib/libvirt/images/'+node_item.hostname+'-ci-data.img' }}"
+ - target:
+ dev: hdb
+ bus: ide
+ - readonly
+ pretty_print: yes
+
+- name: Configure controller
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain/devices/controller
+ add_children:
+ - alias:
+ name: virtio-serial0
+ pretty_print: yes
+
+- name: Configure serial
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain/devices/serial
+ add_children:
+ - source:
+ path: '/dev/pts/14'
+ - target:
+ port: '0'
+ - alias:
+ name: 'serial0'
+ pretty_print: yes
+
+- name: Configure console
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain/devices/console
+ add_children:
+ - source:
+ path: '/dev/pts/14'
+ - target:
+ port: '0'
+ type: 'serial'
+ - alias:
+ name: 'serial0'
+ pretty_print: yes
+
+- set_fact:
+ slot_address: 5
+
+- name: Populate network-config and add interface to xml file
+ include_tasks: create_interfaces.yml
+ extra_vars: "{{ network_config, xml_file , slot_address, mac_address_counter }}"
+ loop_control:
+ loop_var: interface_item
+ with_items: "{{ node_item.interfaces }}"
+
+- name: Create directory
+ file:
+ path: "{{ '/tmp/'+node_item.hostname }}"
+ state: directory
+ mode: 0755
+
+- name: Generate iso image
+ shell: >
+ genisoimage -output {{ image_dir+node_item.hostname+'-ci-data.img' }} -volid cidata -joliet
+ -r {{ '/tmp/'+node_item.hostname+'/network-config' }} {{ '/tmp/'+node_item.hostname+'/user-data' }} {{ '/tmp/'+node_item.hostname+'/meta-data' }}
+ &>> {{ '/tmp/'+node_item.hostname+'/hostname.log' }}
+
+- name: Copy and convert the ubuntu image
+ shell: >
+ qemu-img convert -O qcow2 {{ node_item.image }} {{ image_dir+node_item.hostname+'.qcow2' }}
+
+- name: Copy and convert the ubuntu image
+ shell: >
+ qemu-img resize {{ image_dir+node_item.hostname+'.qcow2' }} {{ node_item.disk }}MB
+
+- name: Define the VMs
+ virt:
+ command: define
+ name: "{{ node_item.hostname }}"
+ xml: "{{ lookup('file', '/tmp/'+node_item.hostname+'/'+node_item.hostname+'.xml') }}"
+
+- name: Start the VMs
+ virt:
+ command: create
+ name: "{{ node_item.hostname }}"
diff --git a/ansible/roles/infra_create_vms/tasks/create_interfaces.yml b/ansible/roles/infra_create_vms/tasks/create_interfaces.yml
new file mode 100644
index 000000000..124421b56
--- /dev/null
+++ b/ansible/roles/infra_create_vms/tasks/create_interfaces.yml
@@ -0,0 +1,65 @@
+# Copyright (c) 2017-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: Add network-data
+ blockinfile:
+ path: "{{ network_config }}"
+ insertafter: 'ethernets:'
+ marker: "MARKER"
+ block: |2
+ {{ 'enp0s%d:'| format( slot_address | int) }}
+ match:
+ mac_address: {{ '52:54:00:5d:7d:%02x'| format( mac_address_counter | int) }}
+ addresses:
+ - {{ interface_item.ip }}/{{ interface_item.netmask }}
+
+
+- name: Remove the marker introduced in network-data
+ lineinfile:
+ dest: "{{ network_config }}"
+ state: absent
+ regexp: "MARKER"
+
+- name: Add new children nodes to "domain" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain/devices
+ add_children:
+ - interface:
+ type: 'bridge'
+ pretty_print: yes
+
+- name: Add new children nodes to "domain" node
+ xml:
+ path: "{{ xml_file }}"
+ xpath: /domain/devices/interface
+ add_children:
+ - source:
+ bridge: "{{ interface_item.network }}"
+ - model:
+ type: 'virtio'
+ - address:
+ type: 'pci'
+ domain: '0x0000'
+ bus: '0x00'
+ slot: "{{ '0x%02x'| format( slot_address | int) }}"
+ function: '0x0'
+ - mac:
+ address: "{{ '52:54:00:5d:7d:%02x'| format( mac_address_counter | int) }}"
+ pretty_print: yes
+
+- set_fact:
+ slot_address: "{{ slot_address | int + 1 }}"
+- set_fact:
+ mac_address_counter: "{{ mac_address_counter | int + 1 }}"
diff --git a/ansible/roles/infra_create_vms/tasks/main.yml b/ansible/roles/infra_create_vms/tasks/main.yml
new file mode 100644
index 000000000..62a023e7e
--- /dev/null
+++ b/ansible/roles/infra_create_vms/tasks/main.yml
@@ -0,0 +1,28 @@
+# Copyright (c) 2017-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: Include
+ include_vars:
+ file: "{{ rs_file }}"
+ name: infra_deploy_vars
+
+- set_fact:
+ mac_address_counter: 0
+
+- name: Create XML file
+ include_tasks: configure_vm.yml
+ extra_vars: "{{ mac_address_counter }}"
+ loop_control:
+ loop_var: node_item
+ with_items: "{{ infra_deploy_vars.nodes }}"
diff --git a/ansible/roles/infra_destroy_previous_configuration/tasks/delete_vm.yml b/ansible/roles/infra_destroy_previous_configuration/tasks/delete_vm.yml
new file mode 100644
index 000000000..5e43ee81e
--- /dev/null
+++ b/ansible/roles/infra_destroy_previous_configuration/tasks/delete_vm.yml
@@ -0,0 +1,29 @@
+# Copyright (c) 2017-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.
+---
+# Ignore errors as VM can be destroyed without been undefined.
+- name: Destroy old VMs
+ virt:
+ command: destroy
+ name: "{{ node_item.hostname }}"
+ when: node_item.hostname in virt_vms.list_vms
+ ignore_errors: yes
+
+# Ignore errors as VM can be running while undefined
+- name: Undefine old VMs
+ virt:
+ command: undefine
+ name: "{{ node_item.hostname }}"
+ when: node_item.hostname in virt_vms.list_vms
+ ignore_errors: yes
diff --git a/ansible/roles/infra_destroy_previous_configuration/tasks/main.yml b/ansible/roles/infra_destroy_previous_configuration/tasks/main.yml
index 5595cd501..e6c2c0229 100644
--- a/ansible/roles/infra_destroy_previous_configuration/tasks/main.yml
+++ b/ansible/roles/infra_destroy_previous_configuration/tasks/main.yml
@@ -26,17 +26,10 @@
register: virt_vms
- name: Destroy old VMs
- virt:
- command: destroy
- name: "{{ item.hostname }}"
- when: item.hostname in virt_vms.list_vms
- with_items: "{{ infra_deploy_vars.nodes }}"
-
-- name: Undefine old VMs
- virt:
- command: undefine
- name: "{{ item.hostname }}"
- when: item.hostname in virt_vms.list_vms
+ include_tasks: delete_vm.yml
+ extra_vars: "{{ virt_vms }}"
+ loop_control:
+ loop_var: node_item
with_items: "{{ infra_deploy_vars.nodes }}"
- name: Delete old networks
diff --git a/ansible/roles/install_dpdk/tasks/main.yml b/ansible/roles/install_dpdk/tasks/main.yml
index 01ad4baf1..e82ad8363 100644
--- a/ansible/roles/install_dpdk/tasks/main.yml
+++ b/ansible/roles/install_dpdk/tasks/main.yml
@@ -121,11 +121,3 @@
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_trex/tasks/main.yml b/ansible/roles/install_trex/tasks/main.yml
index 7ba1fc833..9113c887f 100644
--- a/ansible/roles/install_trex/tasks/main.yml
+++ b/ansible/roles/install_trex/tasks/main.yml
@@ -31,9 +31,6 @@
dest: "{{ INSTALL_BIN_PATH }}/trex_client"
state: link
-# 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