ソースを参照

make buildbot-worker setup work

master
コミット
2f4ae3fd70
5個のファイルの変更82行の追加2行の削除
  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 ファイルの表示

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

+ 25
- 0
files/systemd/buildbot-worker@.service ファイルの表示

@@ -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 ファイルの表示

@@ -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 ファイルの表示

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

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

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

- name: buildbot-worker home directory
file:
@@ -23,4 +29,38 @@
owner: "{{ buildbot_worker_user }}"
group: "{{ buildbot_worker_group }}"
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 ファイルの表示

@@ -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 }}"

読み込み中…
キャンセル
保存