--- # Copyright 2019 Red Hat, Inc. # All Rights Reserved. # # 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: Install ptp packages package: name: "{{ tripleo_ptp_packages }}" state: present register: _ptp_install_result # NOTE(cloudnull): In the future, we could potentially revisit this once the Heat # template for the "kernel" sysctl settings has been converted into # an Ansible role and re-use the functionality of that. # https://github.com/openstack/tripleo-heat-templates/blob/master/deployment/kernel/kernel-baremetal-puppet.yaml - name: Enable multi-nic ptp when: - (tripleo_ptp_interfaces | length) > 1 block: - name: Relax rp filter sysctl: name: "net.ipv4.conf.{{ item }}.rp_filter" value: 2 sysctl_set: true sysctl_file: /etc/sysctl.d/99-tripleo-ptp.conf state: present reload: true with_items: "{{ tripleo_ptp_interfaces }}" - name: Check for hardware capabilities command: "ethtool -T {{ item }}" changed_when: false failed_when: false with_items: "{{ tripleo_ptp_interfaces }}" register: device_capabilities - name: Validate hardware offload set_fact: tripleo_ptp_hardware_offload: "{{ (device_capabilities.results | map(attribute='rc') | list | sum) == 0 }}" - name: Create ptp config template: src: "ptp4l.conf.j2" dest: /etc/ptp4l.conf register: _ptp_config_result - name: Create ptp service config copy: content: |- OPTIONS="-f /etc/ptp4l.conf" dest: /etc/sysconfig/ptp4l register: _ptp_sysconfig_result - name: Enable and start the ptp service become: true systemd: name: ptp4l state: restarted enabled: true when: - _ptp_install_result.changed or _ptp_config_result.changed or _ptp_sysconfig_result.changed