--- /dev/null
+---
+
+# Copyright 2019 Nokia
+
+# 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 network device PCI addresses
+ shell: dpdk-devbind --status-dev net | grep "^0000.*if=en"
+ register: devbind
+
+- set_fact:
+ pci: []
+ iface: []
+
+- set_fact:
+ pci: "{{ pci }} + {{ [ item.split()[0][5:12] ] }}"
+ iface: "{{ iface }} + {{ [ item.split(' if=')[1].split()[0] ] }}"
+ with_items: "{{ devbind.stdout_lines }}"
+
+- set_fact:
+ ifacepcimap: "{{ dict( iface | zip(pci) ) }}"
+
+- debug: var=ifacepcimap
+
+- name: "create {{ sriovdp_config_path }} directory"
+ file:
+ path: "{{ sriovdp_config_path }}"
+ mode: "0700"
+ state: directory
+
+- name: "create {{ sriovdp_config_path }}config.yaml"
+ template:
+ src: sriovdp_config.yaml.j2
+ dest: "{{ sriovdp_config_path }}config.yaml"
+
+- name: "convert {{ sriovdp_config_path }}config.yaml to config.json"
+ shell: "python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' <{{ sriovdp_config_path }}config.yaml >{{ sriovdp_config_path }}config.json"
+
+- name: limit file permissions to root user
+ file:
+ path: "{{ item }}"
+ state: file
+ mode: "0600"
+ with_fileglob: "{{ sriovdp_config_path }}*"