Markus Katharina Brechtel 4 лет назад
Родитель
Сommit
0de4cbac14
3 измененных файлов: 83 добавлений и 79 удалений
  1. +69
    -0
      tasks/buildbot-worker.yaml
  2. +2
    -79
      tasks/main.yaml
  3. +12
    -0
      tasks/setup.yaml

+ 69
- 0
tasks/buildbot-worker.yaml Просмотреть файл

@@ -0,0 +1,69 @@
---

- name: buildbot-worker group
group:
name: "{{ buildbot_worker_group }}"

- name: buildbot-worker user
user:
name: "{{ buildbot_worker_user }}"
group: "{{ buildbot_worker_group }}"
home: "{{ buildbot_worker_home_directory }}"
shell: /usr/bin/fish
password_lock: true

- name: buildbot-worker home directory
file:
path: "{{ buildbot_worker_home_directory }}"
owner: "{{ buildbot_worker_user }}"
group: "{{ buildbot_worker_group }}"
state: directory
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 name
lineinfile:
path: /var/lib/buildbot-worker/{{buildbot_worker_name}}/worker/buildbot.tac
regexp: '^workername *='
line: workername = '{{buildbot_worker_name}}'
notify: restart buildbot-worker service

- name: buildbot-worker password
lineinfile:
path: /var/lib/buildbot-worker/{{buildbot_worker_name}}/worker/buildbot.tac
regexp: '^passwd *='
line: passwd = '{{buildbot_worker_password}}'
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

+ 2
- 79
tasks/main.yaml Просмотреть файл

@@ -1,82 +1,5 @@
---

- import_tasks: local_facts.yaml

- name: pip3 packages for buildbot-worker
pip:
name:
- 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 }}"

- name: buildbot-worker user
user:
name: "{{ buildbot_worker_user }}"
group: "{{ buildbot_worker_group }}"
home: "{{ buildbot_worker_home_directory }}"
shell: /usr/bin/fish
password_lock: true

- name: buildbot-worker home directory
file:
path: "{{ buildbot_worker_home_directory }}"
owner: "{{ buildbot_worker_user }}"
group: "{{ buildbot_worker_group }}"
state: directory
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 name
lineinfile:
path: /var/lib/buildbot-worker/{{buildbot_worker_name}}/worker/buildbot.tac
regexp: '^workername *='
line: workername = '{{buildbot_worker_name}}'
notify: restart buildbot-worker service

- name: buildbot-worker password
lineinfile:
path: /var/lib/buildbot-worker/{{buildbot_worker_name}}/worker/buildbot.tac
regexp: '^passwd *='
line: passwd = '{{buildbot_worker_password}}'
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
- import_tasks: setup.yaml
- import_tasks: buildbot-worker.yaml

+ 12
- 0
tasks/setup.yaml Просмотреть файл

@@ -0,0 +1,12 @@
---

- name: pip3 packages for buildbot-worker
pip:
name:
- buildbot-worker
executable: pip3

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

Загрузка…
Отмена
Сохранить