X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=roles%2Fsriov_nodes%2Ftasks%2Fsriov.yaml;fp=roles%2Fsriov_nodes%2Ftasks%2Fsriov.yaml;h=27703d358733b3cb8345391516fed9c9c1137ca7;hb=74a49ba6ef2ea715fa492db0bcd85c30398688e8;hp=0000000000000000000000000000000000000000;hpb=a936af362724cca0c5dc2c424902d398f9833410;p=ta%2Finfra-ansible.git diff --git a/roles/sriov_nodes/tasks/sriov.yaml b/roles/sriov_nodes/tasks/sriov.yaml new file mode 100644 index 0000000..27703d3 --- /dev/null +++ b/roles/sriov_nodes/tasks/sriov.yaml @@ -0,0 +1,53 @@ +--- + +# 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: Set sriov config dir variable + set_fact: + sriov_conf_dir: "/etc/sriov" + +- name: ensure sriov config dir exists + file: + path: "{{ sriov_conf_dir }}" + recurse: "yes" + state: "directory" + mode: "0755" + +- name: Create /etc/sriov/sriov.conf file + template: + src: "sriov.conf.j2" + dest: "{{ sriov_conf_dir }}/sriov.conf" + owner: "root" + mode: "0644" + +- name: Configure VF count + script: configure_vf_count.sh + register: configure_vf_count_result + failed_when: not (configure_vf_count_result.rc == 0 or configure_vf_count_result.rc == 2) + changed_when: configure_vf_count_result.rc == 2 + +- debug: var=configure_vf_count_result.stdout_lines + when: configure_vf_count_result.rc != 0 + +- debug: var=configure_vf_count_result.stderr_lines + when: configure_vf_count_result.rc != 0 + +- name: Restart sriov service + systemd: + service: sriov + state: restarted + when: + - hostname == installation_controller + - ('caas_master' in hosts[hostname]['service_profiles']) or ('caas_worker' in hosts[hostname]['service_profiles'])