1 # Ansible playbook to setup buildbot instance.
2 # Edit buildbot.hosts to set builder and pass variables.
5 # ansible-playbook -i buildbot.hosts buildbot.yml
7 # botuser can be overridden from command line:
9 # ansible-playbook -i hosts buildbot.yml -e 'botuser=sconsy'
11 # Tested with Ansible 1.5.0, based on
12 # https://github.com/SCons/scons/wiki/InstallingBuildbotSlaves
15 # anatoly techtonik <techtonik@gmail.com>
18 # host is overridable with --extra-vars 'host=address'
19 - hosts: "{{ host | default('localhost') }}"
21 # botuser can be overridden with -e 'botuser=scons2'
23 - hgrc: /home/{{ botuser }}/.hgrc
24 - venv: /home/{{ botuser }}/buildbot-virtualenv
25 - work: /home/{{ botuser }}/buildbot-workdir
29 prompt: contact details of the builbot owner
30 default: name <mail@example.com>
34 # --- install requirements ---
35 - name: ubuntu/debian - make sure mercurial is installed
41 # --- enable mercurial purge extension ---
42 - name: create .hgrc if necessary
45 - file: path={{ hgrc }} owner={{ botuser }} state=touch
46 when: not st.stat.exists
47 - name: enable mercurial purge extension
48 ini_file: dest={{ hgrc }}
49 section=extensions option=hgext.purge
52 - name: install buildbot-slave in virtualenv
53 pip: name=buildbot-slave virtualenv={{ venv }}
55 - name: create buildbot environment
56 command: "{{ venv }}/bin/buildslave create-slave
57 {{ work }} buildbot.scons.org:9989 {{ builder }} {{ pass }}
60 sudo_user: "{{ botuser }}"
62 - name: set contact details of the buildbot owner
63 copy: dest="{{ work }}/info/admin" content="{{ maintainer }}"
67 - name: update host information
68 copy: dest="{{ work }}/info/host"
69 content="{{ansible_lsb.description}}
70 {{'\n'}}{{ansible_machine}}
71 {{'\n'}}{{ansible_memtotal_mb}}MB RAM
72 {{'\n'}}Python {{ansible_python_version}}"
77 - name: restart buildbot
78 command: "{{ venv }}/bin/buildslave restart {{ work }}"
80 sudo_user: "{{ botuser }}"