[switchboard] Add install_collectd Ansible role.
Bug: skia:12063
Change-Id: I5dd3fdd9670ce621ae6091703095a2a031ce3be7
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/434469
Reviewed-by: Ravi Mistry <rmistry@google.com>
diff --git a/skolo/ansible/switchboard/roles/install_collectd/README.md b/skolo/ansible/switchboard/roles/install_collectd/README.md
new file mode 100644
index 0000000..e32ac48
--- /dev/null
+++ b/skolo/ansible/switchboard/roles/install_collectd/README.md
@@ -0,0 +1,15 @@
+# Role Name
+
+`install_collectd`
+
+## Description
+
+Installs `collectd` along with a configuration file that sends the data to
+Prometheus.
+
+## Example Playbook
+
+ - hosts: '{{ variable_hosts }}'
+
+ roles:
+ - install_collectd
diff --git a/skolo/ansible/switchboard/roles/install_collectd/files/collectd.conf b/skolo/ansible/switchboard/roles/install_collectd/files/collectd.conf
new file mode 100644
index 0000000..261d836
--- /dev/null
+++ b/skolo/ansible/switchboard/roles/install_collectd/files/collectd.conf
@@ -0,0 +1,35 @@
+FQDNLookup false
+Interval 60
+
+# Logs grow forever. Just uncomment the lines below if logs are needed for
+# debugging purposes.
+
+#LoadPlugin "logfile"
+#<Plugin "logfile">
+# LogLevel "info"
+# File "/var/log/collectd.log"
+# Timestamp true
+#</Plugin>
+
+LoadPlugin syslog
+<Plugin syslog>
+ LogLevel info
+</Plugin>
+
+LoadPlugin cpu
+LoadPlugin df
+LoadPlugin disk
+LoadPlugin interface
+LoadPlugin load
+LoadPlugin memory
+LoadPlugin processes
+LoadPlugin swap
+LoadPlugin users
+
+LoadPlugin write_http
+<Plugin write_http>
+ <URL "https://collectd.skia.org/collectd-post">
+ Format "JSON"
+ </URL>
+</Plugin>
+
diff --git a/skolo/ansible/switchboard/roles/install_collectd/tasks/main.yml b/skolo/ansible/switchboard/roles/install_collectd/tasks/main.yml
new file mode 100644
index 0000000..df436d9
--- /dev/null
+++ b/skolo/ansible/switchboard/roles/install_collectd/tasks/main.yml
@@ -0,0 +1,18 @@
+---
+# tasks file for collectd
+- name: Install applications.
+ become: yes
+ apt:
+ pkg:
+ - collectd
+ - collectd-core
+ - collectd-utils
+
+- name: Configure collectd
+ become: yes
+ copy:
+ src: files/collectd.conf
+ dest: /etc/collectd/collectd.conf
+ owner: root
+ group: root
+ mode: 0644