Raphael Vicente Rosa | 760229a | 2021-03-17 21:15:59 -0300 | [diff] [blame^] | 1 | --- |
| 2 | # usrp tasks/Debian.yml |
| 3 | # |
| 4 | # SPDX-FileCopyrightText: © 2021 Open Networking Foundation <support@opennetworking.org> |
| 5 | # SPDX-License-Identifier: Apache-2.0 |
| 6 | |
| 7 | - name: Install apt related prereqs |
| 8 | apt: |
| 9 | name: |
| 10 | - "apt-transport-https" |
| 11 | - "ca-certificates" |
| 12 | - "gpg" |
| 13 | - "software-properties-common" |
| 14 | state: "present" |
| 15 | update_cache: true |
| 16 | |
| 17 | - name: Add ettusresearch apt repo |
| 18 | apt_repository: |
| 19 | repo: 'ppa:ettusresearch/uhd' |
| 20 | mode: 0644 |
| 21 | update_cache: true |
| 22 | |
| 23 | - name: Add ettusresearch apt repo key |
| 24 | apt_key: |
| 25 | data: "{{ lookup('file','ettusresearch.gpg') }}" |
| 26 | state: "present" |
| 27 | |
| 28 | - name: Add Official ettusresearch apt repo |
| 29 | apt_repository: |
| 30 | repo: >- |
| 31 | deb http://ppa.launchpad.net/ettusresearch/uhd/ubuntu |
| 32 | {{ ansible_lsb['codename'] }} main |
| 33 | mode: 0644 |
| 34 | update_cache: true |
| 35 | |
| 36 | - name: Install usrp related packages |
| 37 | apt: |
| 38 | name: |
| 39 | - "linux-image-lowlatency" |
| 40 | - "linux-headers-lowlatency" |
| 41 | - "cpufrequtils" |
| 42 | - "libuhd-dev" |
| 43 | - "libuhd003" |
| 44 | - "uhd-host" |
| 45 | state: "present" |
| 46 | update_cache: true |
| 47 | |
| 48 | - name: Update grub |
| 49 | replace: |
| 50 | path: /etc/default/grub |
| 51 | regexp: '(^GRUB_CMDLINE_LINUX_DEFAULT=)(.*)$' |
| 52 | replace: | |
| 53 | '\1"quiet intel_pstate=disable processor.max_cstate=1 intel_idle.max_cstate=0 idle=poll"' |
| 54 | backup: true |
| 55 | notify: |
| 56 | - update-grub2 |
| 57 | |
| 58 | - name: Blacklist intel powerclamp |
| 59 | blockinfile: |
| 60 | dest: /etc/modprobe.d/blacklist.conf |
| 61 | block: | |
| 62 | # for OAI |
| 63 | blacklist intel_powerclamp |
| 64 | backup: true |
| 65 | |
| 66 | - name: Check for existence of file cpufrequtils |
| 67 | stat: |
| 68 | path: /etc/default/cpufrequtils |
| 69 | register: cpufrequtils_file_register |
| 70 | |
| 71 | - name: Create file cpufrequtils |
| 72 | when: not cpufrequtils_file_register.stat.exists |
| 73 | file: |
| 74 | path: /etc/default/cpufrequtils |
| 75 | state: touch |
| 76 | owner: root |
| 77 | group: root |
| 78 | mode: '0644' |
| 79 | |
| 80 | - name: Set cpufrequtils |
| 81 | blockinfile: |
| 82 | dest: /etc/default/cpufrequtils |
| 83 | block: | |
| 84 | # for OAI/USRP |
| 85 | GOVERNOR="performance" |
| 86 | backup: true |
| 87 | |
| 88 | - name: Disable ondemand service |
| 89 | systemd: |
| 90 | name: ondemand.service |
| 91 | enabled: false |
| 92 | notify: |
| 93 | - restart-cpufrequtils |
| 94 | |
| 95 | - name: Reboot necessary, flushing handlers |
| 96 | meta: flush_handlers |
| 97 | |
| 98 | - name: Reboot |
| 99 | when: usrp_reboot |
| 100 | reboot: |
| 101 | msg: "Reboot initiated by Ansible" |
| 102 | connect_timeout: 5 |
| 103 | reboot_timeout: 600 |
| 104 | pre_reboot_delay: 0 |
| 105 | post_reboot_delay: 30 |
| 106 | test_command: whoami |