blob: 3039ec322c8691830d16b9d8e24558692e39c709 [file] [log] [blame]
---
- hosts: all
connection: local
remote_user: chrome-bot
become_user: root
become: yes
become_method: sudo
vars:
# override with --extra-vars "nfs_mount_point=/opt/stage"
nfs_mount_point: /opt/prod
tasks:
# Set up mounts in image's fstab
- lineinfile: dest={{nfs_mount_point}}/root/etc/fstab regexp=".*mmcblk0p2.*" state=absent
- lineinfile: dest={{nfs_mount_point}}/root/etc/fstab line="/dev/mmcblk0p3 /b ext4 defaults,noatime 0 2" state=present
- lineinfile: dest={{nfs_mount_point}}/root/etc/fstab line="/dev/mmcblk0p5 /var ext4 defaults,noatime 0 2" state=present
- lineinfile: dest={{nfs_mount_point}}/root/etc/fstab line="/dev/mmcblk0p6 /tmp ext4 defaults,noatime 0 2" state=present
- lineinfile: dest={{nfs_mount_point}}/root/etc/fstab line="/dev/mmcblk0p7 /home/chrome-bot ext4 defaults,noatime 0 2" state=present
# Swarming needs a /b file (which will have an SD card partition mounted to it.)
- file: path={{nfs_mount_point}}/root/b state=directory mode=0777
# Make the hostname be set from the cmdline, not etc/hostname
- file: path={{nfs_mount_point}}/root/etc/hostname state=absent
# Autologin to our user
- lineinfile: dest={{nfs_mount_point}}/root/lib/systemd/system/getty@.service regexp="^ExecStart.*" state=absent
- lineinfile: dest={{nfs_mount_point}}/root/lib/systemd/system/getty@.service line="ExecStart=-/sbin/agetty --autologin chrome-bot --noclear %I $TERM" state=present insertafter="\[Service\]"
- name: Fixing udev rules for Android and NVIDIA devices
copy: src=../common/udev-rules dest={{nfs_mount_point}}/root/etc/udev/rules.d/51-android.rules owner=root group=root mode=0644
- name: Configuring collectd
copy: src=collectd.conf dest={{nfs_mount_point}}/root/etc/collectd/collectd.conf owner=root group=root mode=0644
- name: Copy oauth2_access_token_config.json to swarming_config
copy:
src: ../common/oauth2_access_token_config.json
dest: {{nfs_mount_point}}/root/etc/swarming_config/
owner: root
group: root
mode: 0644
# Some niceties
- lineinfile: dest={{nfs_mount_point}}/root/etc/profile line="alias l='ls -CF'" state=present
- lineinfile: dest={{nfs_mount_point}}/root/etc/profile line="alias la='ls -A'" state=present
- lineinfile: dest={{nfs_mount_point}}/root/etc/profile line="alias ll='ls -alF'" state=present
- lineinfile: dest={{nfs_mount_point}}/root/etc/profile line="alias ls='ls --color=auto'" state=present
- lineinfile: dest={{nfs_mount_point}}/root/etc/ld.so.preload line="#/usr/lib/arm-linux-gnueabihf/libarmmem.so" state=absent
- lineinfile: dest={{nfs_mount_point}}/root/etc/ld.so.preload line="/usr/lib/arm-linux-gnueabihf/libarmmem.so" state=present
# With these unmounted, chroot not work anymore. To make chroot work
# again, run the setup_for_chroot playbook.
- command: umount {{nfs_mount_point}}/root/dev
ignore_errors: true
- command: umount {{nfs_mount_point}}/root/proc
ignore_errors: true
- command: umount {{nfs_mount_point}}/root/sys
ignore_errors: true
- mount: name="{{nfs_mount_point}}/root" src="dontcare" fstype="auto" state="unmounted"
handlers: