Browse Source

make buildbot-worker setup work

master
parent
commit
2f4ae3fd70
5 changed files with 82 additions and 2 deletions
  1. +3
    -0
      defaults/main.yaml
  2. +25
    -0
      files/systemd/buildbot-worker@.service
  3. +9
    -0
      handlers/main.yaml
  4. +42
    -2
      tasks/main.yaml
  5. +3
    -0
      vars/main.yaml

+ 3
- 0
defaults/main.yaml View File

@@ -1 +1,4 @@
--- ---
buildbot_worker_name: buildbot-worker
buildbot_worker_admin_info: ""
buildbot_worker_host_info: ""

+ 25
- 0
files/systemd/buildbot-worker@.service View File

@@ -0,0 +1,25 @@
# This template file assumes the buildbot worker lives in a subdirectory od
# /var/lib/buildbot
# Usage:
# cd /var/lib/buildbot
# buildbot-worker create-worker [directory] [master hostname] [name] [password]
# systemctl enable --now buildbot-worker@[directory].service
[Unit]
Description=Buildbot Worker
After=network.target

[Service]
User=%i
Group=%i
WorkingDirectory=/var/lib/buildbot-worker/%i
ExecStart=/usr/local/bin/buildbot-worker start --nodaemon worker
# if using EC2 Latent worker, you want to uncomment following line, and comment out the Restart line
# ExecStopPost=shutdown now
Restart=always
ProtectSystem=full
ProtectHome=yes
PrivateDevices=yes
PrivateTmp=yes

[Install]
WantedBy=multi-user.target

+ 9
- 0
handlers/main.yaml View File

@@ -1 +1,10 @@
--- ---

- name: systemd daemon reload
systemd:
daemon_reload: yes

- name: restart buildbot-worker service
systemd:
state: restarted
name: buildbot-worker@{{buildbot_worker_name}}.service

+ 42
- 2
tasks/main.yaml View File

@@ -6,6 +6,11 @@
- buildbot-worker - buildbot-worker
executable: pip3 executable: pip3


- name: buildbot-worker var directory
file:
path: /var/lib/buildbot-worker
state: directory

- name: buildbot-worker group - name: buildbot-worker group
group: group:
name: "{{ buildbot_worker_group }}" name: "{{ buildbot_worker_group }}"
@@ -14,8 +19,9 @@
user: user:
name: "{{ buildbot_worker_user }}" name: "{{ buildbot_worker_user }}"
group: "{{ buildbot_worker_group }}" group: "{{ buildbot_worker_group }}"
home: "{{ ez_directory }}"
home: "{{ buildbot_worker_home_directory }}"
shell: /usr/bin/fish shell: /usr/bin/fish
password_lock: true


- name: buildbot-worker home directory - name: buildbot-worker home directory
file: file:
@@ -23,4 +29,38 @@
owner: "{{ buildbot_worker_user }}" owner: "{{ buildbot_worker_user }}"
group: "{{ buildbot_worker_group }}" group: "{{ buildbot_worker_group }}"
state: directory state: directory
mode: u=rwx,g=rwx,o=
mode: u=rwx,g=rx,o=

# source of unit file from https://github.com/buildbot/buildbot-contrib/blob/master/worker/contrib/systemd/buildbot-worker%40.service
- name: buildbot-worker systemd service unit
copy:
src: systemd/buildbot-worker@.service
dest: /etc/systemd/system/buildbot-worker@.service
notify:
- systemd daemon reload
- restart buildbot-worker service

- name: initiate buildbot-worker
command: buildbot-worker create-worker worker localhost:9989 "{{buildbot_worker_name}}" "{{buildbot_worker_password}}"
become: true
become_user: "{{buildbot_worker_user}}"
args:
chdir: "{{buildbot_worker_home_directory}}"
creates: /var/lib/buildbot-worker/{{buildbot_worker_name}}/worker
notify: restart buildbot-worker service

- name: buildbot-worker host info
copy:
content: "{{buildbot_worker_host_info}}"
dest: /var/lib/buildbot-worker/{{buildbot_worker_name}}/worker/info/host
owner: "{{ buildbot_worker_user }}"
group: "{{ buildbot_worker_group }}"
notify: restart buildbot-worker service

- name: buildbot-worker admin info
copy:
content: "{{buildbot_worker_admin_info}}"
dest: /var/lib/buildbot-worker/{{buildbot_worker_name}}/worker/info/admin
owner: "{{ buildbot_worker_user }}"
group: "{{ buildbot_worker_group }}"
notify: restart buildbot-worker service

+ 3
- 0
vars/main.yaml View File

@@ -1 +1,4 @@
--- ---
buildbot_worker_user: "{{ buildbot_worker_name }}"
buildbot_worker_group: "{{ buildbot_worker_name }}"
buildbot_worker_home_directory: "/var/lib/buildbot-worker/{{ buildbot_worker_name }}"

Loading…
Cancel
Save