[switchboard] Add swarming_needs Ansible role.

Bug: skia:12063
Change-Id: I54e83b4953c3da467f46a71b709b56109529052b
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/434461
Reviewed-by: Ravi Mistry <rmistry@google.com>
diff --git a/skolo/ansible/switchboard/roles/swarming_needs/README.md b/skolo/ansible/switchboard/roles/swarming_needs/README.md
new file mode 100644
index 0000000..a3cdd59
--- /dev/null
+++ b/skolo/ansible/switchboard/roles/swarming_needs/README.md
@@ -0,0 +1,26 @@
+# Role Name
+
+`swarming_needs`
+
+# Description
+
+All the extra things that need to be on a test machine for Swarming to run.
+
+Right now this only works for linux machines, it will need to evolve to support
+all the platforms, at which point the platforms specific tasks should go in
+their own files, e.g. `linux.yml`.
+
+# Variables Required
+
+None.
+
+# Example Playbook
+
+```
+# Copy the authorized_keys files to all the RPis.
+- hosts: "{{ variable_hosts | default('rpis') }}"
+  user: chrome-bot
+
+  roles:
+    - swarming_needs
+```
diff --git a/skolo/ansible/switchboard/roles/swarming_needs/files/oauth2_access_token_config.json b/skolo/ansible/switchboard/roles/swarming_needs/files/oauth2_access_token_config.json
new file mode 100644
index 0000000..fa139e1
--- /dev/null
+++ b/skolo/ansible/switchboard/roles/swarming_needs/files/oauth2_access_token_config.json
@@ -0,0 +1,6 @@
+{
+    "url": "http://metadata/computeMetadata/v1/instance/service-accounts/default/token",
+    "headers": {
+        "Metadata-Flavor": "Google"
+    }
+}
\ No newline at end of file
diff --git a/skolo/ansible/switchboard/roles/swarming_needs/tasks/linux.yml b/skolo/ansible/switchboard/roles/swarming_needs/tasks/linux.yml
new file mode 100644
index 0000000..dffe1ed
--- /dev/null
+++ b/skolo/ansible/switchboard/roles/swarming_needs/tasks/linux.yml
@@ -0,0 +1,61 @@
+---
+# Still need .boto.
+- name: touch .boto
+  file:
+    state: touch
+    path: /home/chrome-bot/.boto
+    owner: chrome-bot
+    mode: 0644
+
+# Our recipes hard code a specific adb.
+- name: link adb to /usr/bin/adb.1.0.35
+  become: yes
+  file:
+    src: /usr/bin/adb
+    dest: /usr/bin/adb.1.0.35
+    owner: root
+    group: root
+    state: link
+
+- name: Install applications.
+  become: yes
+  apt:
+    pkg:
+      - python3-distutils
+      - python3-certifi
+
+# Recipes need a /usr/bin/python.
+- name: link /usr/bin/python to /usr/bin/python3
+  become: yes
+  file:
+    src: /usr/bin/python3
+    dest: /usr/bin/python
+    owner: root
+    group: root
+    state: link
+
+- name: Create /b/s directory
+  become: yes
+  file:
+    path: /b/s
+    state: directory
+    recurse: yes
+    owner: chrome-bot
+    mode: 0755
+
+- name: Create /etc/swarming_config directory
+  become: yes
+  file:
+    path: /etc/swarming_config
+    state: directory
+    recurse: yes
+    owner: chrome-bot
+    mode: 0755
+
+- name: Copy oauth2 config file
+  become: yes
+  copy:
+    src: files/oauth2_access_token_config.json
+    dest: /etc/swarming_config/oauth2_access_token_config.json
+    owner: chrome-bot
+    mode: 0644
diff --git a/skolo/ansible/switchboard/roles/swarming_needs/tasks/main.yml b/skolo/ansible/switchboard/roles/swarming_needs/tasks/main.yml
new file mode 100644
index 0000000..80d95d5
--- /dev/null
+++ b/skolo/ansible/switchboard/roles/swarming_needs/tasks/main.yml
@@ -0,0 +1,9 @@
+---
+- name: Swarming needs for Linux
+  import_tasks: linux.yml
+  when: ansible_facts['system']|lower == "linux"
+
+- name: Other platforms
+  fail:
+    msg: This system isn't supported, please add support.
+  when: ansible_facts['system']|lower != "linux"