blob: 0925baf59f03bae1b525f61424c096b29de87a13 [file] [log] [blame]
---
- hosts: all
remote_user: chrome-bot
become_user: root
become: yes
become_method: sudo
vars:
net: 192.168.1.0
tasks:
- name: Update and Upgrade
apt: upgrade=dist update_cache=yes
- name: Install openssh-server
apt: name=openssh-server
- name: Install binfmt-support
apt: name=binfmt-support
- name: Install qemu
apt: name=qemu
- name: Install qemu-user-sta
apt: name=qemu-user-static
- name: Install unzip
apt: name=unzip
- name: Install nfs-kernel-server
apt: name=nfs-kernel-server
- name: Install SSHPass
apt: name=sshpass
- name: Install collectd, without the JDK
apt: name=collectd install_recommends=no
# Create some directories that will be used by mounting image and pulld
- file: path=/opt/prod mode=0775 state=directory
- file: path=/opt/stage mode=0775 state=directory
- file: path=/opt/rpi_img mode=0777 state=directory
- file: path=/var/log/logserver mode=0777 state=directory
- file: path=/var/pulld mode=0777 state=directory
- name: Get collectd config situated
copy: src=collectd.conf dest=/etc/collectd/collectd.conf owner=root group=root mode=0644
- name: Start collectd
service: name=collectd state=restarted enabled=true
# It is very important to specify different fsids for these two different entries.
# It seems that if this is not done, both directories end up with the same fsid, which
# means they are indistinguishable to any nfs client. This means in practice that the
# first nfs rule listed will be what all RPIs attach to.
- name: make prod nfs sharing rule
lineinfile: dest=/etc/exports line="/opt/prod/root {{net}}/24(ro,sync,no_root_squash,no_subtree_check,fsid=1)"
- name: make stage nfs sharing rule
lineinfile: dest=/etc/exports line="/opt/stage/root {{net}}/24(ro,sync,no_root_squash,no_subtree_check,fsid=2)"
- name: make sudo passwordless
lineinfile: "dest=/etc/sudoers line='chrome-bot ALL=(ALL) NOPASSWD: ALL'"
- name: generate chrome-bot ssh
user: name=chrome-bot generate_ssh_key=yes ssh_key_bits=2048 ssh_key_file=.ssh/id_rsa
#http://docs.ansible.com/ansible/intro_getting_started.html#host-key-checking
- name: Disabling host key host key checking
file: path=/etc/ansible/ansible.cfg mode=0777 state=touch
- lineinfile: dest=/etc/ansible/ansible.cfg line="[defaults]"
- lineinfile: dest=/etc/ansible/ansible.cfg line="host_key_checking = False" insertafter="\[defaults\]"