Adds initial usrp ansible role content
Change-Id: I4e1e308aa7e9e2f6db04bc8a344b8a4f8f63c61a
diff --git a/tasks/Debian.yml b/tasks/Debian.yml
new file mode 100644
index 0000000..a4368df
--- /dev/null
+++ b/tasks/Debian.yml
@@ -0,0 +1,106 @@
+---
+# usrp tasks/Debian.yml
+#
+# SPDX-FileCopyrightText: © 2021 Open Networking Foundation <support@opennetworking.org>
+# SPDX-License-Identifier: Apache-2.0
+
+- name: Install apt related prereqs
+ apt:
+ name:
+ - "apt-transport-https"
+ - "ca-certificates"
+ - "gpg"
+ - "software-properties-common"
+ state: "present"
+ update_cache: true
+
+- name: Add ettusresearch apt repo
+ apt_repository:
+ repo: 'ppa:ettusresearch/uhd'
+ mode: 0644
+ update_cache: true
+
+- name: Add ettusresearch apt repo key
+ apt_key:
+ data: "{{ lookup('file','ettusresearch.gpg') }}"
+ state: "present"
+
+- name: Add Official ettusresearch apt repo
+ apt_repository:
+ repo: >-
+ deb http://ppa.launchpad.net/ettusresearch/uhd/ubuntu
+ {{ ansible_lsb['codename'] }} main
+ mode: 0644
+ update_cache: true
+
+- name: Install usrp related packages
+ apt:
+ name:
+ - "linux-image-lowlatency"
+ - "linux-headers-lowlatency"
+ - "cpufrequtils"
+ - "libuhd-dev"
+ - "libuhd003"
+ - "uhd-host"
+ state: "present"
+ update_cache: true
+
+- name: Update grub
+ replace:
+ path: /etc/default/grub
+ regexp: '(^GRUB_CMDLINE_LINUX_DEFAULT=)(.*)$'
+ replace: |
+ '\1"quiet intel_pstate=disable processor.max_cstate=1 intel_idle.max_cstate=0 idle=poll"'
+ backup: true
+ notify:
+ - update-grub2
+
+- name: Blacklist intel powerclamp
+ blockinfile:
+ dest: /etc/modprobe.d/blacklist.conf
+ block: |
+ # for OAI
+ blacklist intel_powerclamp
+ backup: true
+
+- name: Check for existence of file cpufrequtils
+ stat:
+ path: /etc/default/cpufrequtils
+ register: cpufrequtils_file_register
+
+- name: Create file cpufrequtils
+ when: not cpufrequtils_file_register.stat.exists
+ file:
+ path: /etc/default/cpufrequtils
+ state: touch
+ owner: root
+ group: root
+ mode: '0644'
+
+- name: Set cpufrequtils
+ blockinfile:
+ dest: /etc/default/cpufrequtils
+ block: |
+ # for OAI/USRP
+ GOVERNOR="performance"
+ backup: true
+
+- name: Disable ondemand service
+ systemd:
+ name: ondemand.service
+ enabled: false
+ notify:
+ - restart-cpufrequtils
+
+- name: Reboot necessary, flushing handlers
+ meta: flush_handlers
+
+- name: Reboot
+ when: usrp_reboot
+ reboot:
+ msg: "Reboot initiated by Ansible"
+ connect_timeout: 5
+ reboot_timeout: 600
+ pre_reboot_delay: 0
+ post_reboot_delay: 30
+ test_command: whoami