Add Buildbot worker setup to Ansible playbook
Currently assumes the host uses systemd
This commit is contained in:
parent
046c3d4f24
commit
6ff5a13497
|
@ -0,0 +1,17 @@
|
|||
[Unit]
|
||||
Description=Buildbot worker
|
||||
Wants=network.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
PIDFile=/home/{{ buildbot_worker_user }}/{{ buildbot_worker_name }}/twistd.pid
|
||||
WorkingDirectory=/home/{{ buildbot_worker_user }}
|
||||
ExecStart=/usr/local/bin/buildbot-worker start {{ buildbot_worker_name }}
|
||||
ExecReload=/usr/local/bin/buildbot-worker restart {{ buildbot_worker_name }}
|
||||
ExecStop=/usr/local/bin/buildbot-worker stop {{ buildbot_worker_name }}
|
||||
Restart=always
|
||||
User={{ buildbot_worker_user }}
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,4 @@
|
|||
OS: {{ ansible_distribution }} {{ ansible_distribution_version }}
|
||||
Memory: {{ ansible_memtotal_mb }} MB
|
||||
CPU: {{ ansible_processor[1] }}
|
||||
{{ buildbot_worker_version.stdout }}
|
|
@ -6,6 +6,17 @@
|
|||
|
||||
vars_files:
|
||||
- vars/default.yml
|
||||
- vars/buildbot.yml
|
||||
|
||||
vars_prompt:
|
||||
- name: "buildbot_worker_admin"
|
||||
prompt: "Admin details"
|
||||
default: "Zcash <sysadmin@z.cash>"
|
||||
- name: "buildbot_worker_name"
|
||||
prompt: "Buildbot worker name (provided by ZECC)"
|
||||
private: no
|
||||
- name: "buildbot_worker_password"
|
||||
prompt: "Buildbot worker password (provided by ZECC)"
|
||||
|
||||
pre_tasks:
|
||||
- name: Install Python 2 for Ansible and Buildbot
|
||||
|
@ -67,3 +78,60 @@
|
|||
name: "{{ item }}"
|
||||
state: latest
|
||||
with_items: "{{ python_modules }}"
|
||||
notify: restart buildbot-worker
|
||||
|
||||
- name: Get installed Buildbot version
|
||||
command: buildbot-worker --version
|
||||
register: buildbot_worker_version
|
||||
|
||||
- name: Set up the Buildbot worker user
|
||||
user:
|
||||
name: "{{ buildbot_worker_user }}"
|
||||
comment: Buildbot worker
|
||||
shell: /bin/bash
|
||||
state: present
|
||||
|
||||
- name: Create Buildbot worker
|
||||
command: >
|
||||
buildbot-worker create-worker ~/{{ buildbot_worker_name }}
|
||||
{{ buildbot_master_host }}:{{ buildbot_master_port }}
|
||||
{{ buildbot_worker_name|quote }} {{ buildbot_worker_password|quote }}
|
||||
args:
|
||||
creates: "~/{{ buildbot_worker_name }}/buildbot.tac"
|
||||
become_user: "{{ buildbot_worker_user }}"
|
||||
|
||||
- name: Set admin details for Buildbot worker
|
||||
copy:
|
||||
content: "{{ buildbot_worker_admin }}"
|
||||
dest: "~/{{ buildbot_worker_name }}/info/admin"
|
||||
become_user: "{{ buildbot_worker_user }}"
|
||||
|
||||
- name: Set host details for Buildbot worker
|
||||
template:
|
||||
src: templates/host.j2
|
||||
dest: "~/{{ buildbot_worker_name }}/info/host"
|
||||
become_user: "{{ buildbot_worker_user }}"
|
||||
|
||||
- name: Copy Buildbot worker systemd service unit
|
||||
template:
|
||||
src: templates/buildbot-worker.service.j2
|
||||
dest: "/etc/systemd/system/buildbot-worker.service"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify: reload systemd
|
||||
|
||||
- name: Start Buildbot worker.
|
||||
service:
|
||||
name: buildbot-worker
|
||||
state: started
|
||||
enabled: yes
|
||||
|
||||
handlers:
|
||||
- name: restart buildbot-worker
|
||||
service:
|
||||
name: buildbot-worker
|
||||
state: restarted
|
||||
|
||||
- name: reload systemd
|
||||
command: /bin/systemctl daemon-reload
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
buildbot_worker_user: zcbbworker
|
||||
buildbot_master_host: dev-ci.z.cash
|
||||
buildbot_master_port: 9899
|
Loading…
Reference in New Issue