--- /dev/null
+[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
vars_files:
- vars/default.yml
+ - vars/buildbot.yml
+
+ vars_prompt:
+ - name: "buildbot_worker_admin"
+ prompt: "Admin details"
+ - 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
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