| --- |
| - hosts: all |
| remote_user: chrome-bot |
| become_user: root |
| become: yes |
| become_method: sudo |
| |
| vars: |
| interface_templ: "interfaces.j2" |
| expanded_interface: "/etc/network/interfaces" |
| |
| vars_prompt: |
| - name: "interface" |
| prompt: "What is ethernet interface? If you don't know, run ip addr first" |
| private: no |
| |
| tasks: |
| |
| - name: Update and Upgrade |
| apt: upgrade=safe update_cache=yes |
| - name: Install openssh-server |
| apt: name=openssh-server |
| |
| # These are needed to run swarming |
| - name: Install libssl-dev |
| apt: name=libssl-dev |
| - name: Install openssl |
| apt: name=openssl |
| - name: Install time |
| apt: name=time |
| - name: Install build-essential |
| apt: name=build-essential |
| - name: Install swig |
| apt: name=swig |
| - name: Install python-m2crypto |
| apt: name=python-m2crypto |
| - name: Install ntpdate |
| apt: name=ntpdate |
| - name: Install python-pip |
| apt: name=python-pip |
| - name: Install ethtool |
| apt: name=ethtool |
| |
| # These are needed to run our swarming tests |
| - name: Install Beignet OpenCL driver |
| apt: name=beignet-opencl-icd,ocl-icd-libopencl1 |
| |
| # These are needed for general use |
| - name: Install collectd, without the JDK |
| apt: name=collectd install_recommends=no |
| |
| - name: Get collectd config situated |
| copy: src=../../common/collectd.conf dest=/etc/collectd/collectd.conf owner=root group=root mode=0644 |
| |
| - name: Fixing udev rules for Android and NVIDIA devices |
| copy: src=../../common/udev-rules dest=/etc/udev/rules.d/51-android.rules owner=root group=root mode=0644 |
| |
| - name: Fix nsswitch.conf |
| copy: src=../nsswitch.conf dest=/etc/nsswitch.conf |
| |
| - name: Start collectd |
| service: name=collectd state=restarted enabled=true |
| |
| - name: create /b |
| file: |
| state: directory |
| path: /b |
| mode: 0777 |
| owner: root |
| group: root |
| |
| - name: Touch .boto |
| file: |
| path: /home/chrome-bot/.boto |
| owner: chrome-bot |
| group: chrome-bot |
| state: touch |
| mode: 0644 |
| |
| - name: make sudo reboot passwordless |
| lineinfile: dest=/etc/sudoers line="chrome-bot ALL=NOPASSWD:/sbin/shutdown -r now" |
| |
| - name: disable wifi |
| command: nmcli radio wifi off |
| |
| - name: Creates lightdm directory if it doesn't exist |
| file: path=/etc/lightdm/lightdm.conf.d/ state=directory |
| |
| - name: enable auto-login |
| blockinfile: |
| dest: /etc/lightdm/lightdm.conf.d/50-myconfig.conf |
| create: yes |
| block: | |
| [SeatDefaults] |
| autologin-user=chrome-bot |
| |
| - name: "Checking MAC pause support" |
| command: "/sbin/ethtool -A {{interface}}" |
| register: mac_pause |
| ignore_errors: True |
| |
| # This takes the pre-existing /etc/network/interfaces template |
| # (which is a jinja2 template, as per ansible spec) and fills in |
| # the interface name. |
| - name: disable ethernet flow control |
| # mac_pause.rc means the return code from the previous command (mac_pause) |
| # The magic number 78 is returned when configuring MAC PAUSE is supported |
| # but no params were passed in (which we did intentionally above.) |
| # If MAC_PAUSE is not supported, something else will be returned |
| # (e.g. 77 "Operation not supported" ) |
| when: mac_pause.rc == 78 |
| template: |
| src: "{{interface_templ}}" |
| dest: "{{expanded_interface}}" |
| owner: root |
| group: root |
| mode: 0644 |
| force: yes |
| backup: yes |