| --- |
| - hosts: all |
| remote_user: chrome-bot |
| become_user: root |
| become: yes |
| become_method: sudo |
| 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: Ensure resolvconf program is not installed |
| apt: name=resolvconf state=absent |
| - name: Configure DNS with /etc/resolv.conf. |
| copy: src=resolv.conf dest=/etc/resolv.conf owner=root group=root mode=0644 |
| |
| - 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 |
| |
| - 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 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\]" |
| |
| - name: Make convenient ~/start_serving_image script |
| lineinfile: |
| dest: /home/chrome-bot/start_serving_image |
| mode: 0755 |
| owner: chrome-bot |
| group: chrome-bot |
| state: present |
| line: 'ansible-playbook -i "localhost," -c local ./skia-buildbot/skolo/raspberry-pi/start_serving_image.yml -v' |
| create: yes |
| |