5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 - name: collect network device PCI addresses
18 shell: dpdk-devbind --status-dev net | egrep "^[0-9a-fA-F]{4}\b.*if=" || true
26 pci: "{{ pci }} + {{ [ item.split()[0][:12] ] }}"
27 iface: "{{ iface }} + {{ [ item.split(' if=')[1].split()[0] ] }}"
28 with_items: "{{ devbind.stdout_lines }}"
31 ifacepcimap: "{{ dict( iface | zip(pci) ) }}"
33 - debug: var=ifacepcimap
35 - name: "create {{ sriovdp_config_path }} directory"
37 path: "{{ sriovdp_config_path }}"
41 - name: "create {{ sriovdp_config_path }}config.yaml"
43 src: sriovdp_config.yaml.j2
44 dest: "{{ sriovdp_config_path }}config.yaml"
46 - name: "convert {{ sriovdp_config_path }}config.yaml to config.json"
47 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"
49 - name: limit file permissions to root user
54 with_fileglob: "{{ sriovdp_config_path }}*"