This repository has been archived by the owner on Aug 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nodes-boinc-setup.yml
106 lines (104 loc) · 2.8 KB
/
nodes-boinc-setup.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
- hosts: controller
tasks:
- name: Get BOINC and related packages
shell:
cmd: cat /homefarm/files/pkgs-compute.txt
register: boincpkgs
- name: Ensure node config dir exists
file:
path: ./nodes
owner: root
state: directory
mode: 0755
- name: Ensure project config file for all nodes
command: cp --update=none ./files/node.yml ./nodes/{{ item }}.yml
loop: "{{ groups['boinc_nodes'] }}"
- name: Ensure cc_config file for all nodes
command: cp --update=none ./files/cc_config.xml ./nodes/{{ item }}-cc.xml
loop: "{{ groups['boinc_nodes'] }}"
- hosts: managed_nodes
remote_user: farmer
tasks:
- name: Update pacman.conf
become: true
copy:
src: ./srv/homefarm/pacman.conf
dest: /etc/pacman.conf
owner: root
group: root
mode: 0644
- hosts: boinc_nodes
remote_user: farmer
tasks:
- name: Install BOINC and related packages
become: true
pacman:
name: "{{ hostvars['localhost'].boincpkgs.stdout_lines }}"
state: present
update_cache: true
when: hostvars['localhost'].boincpkgs.stdout != ""
- name: Update BOINC client config
become: true
copy:
src: ./nodes/{{ inventory_hostname }}-cc.xml
dest: /var/lib/boinc/cc_config.xml
owner: root
group: root
mode: 0644
register: ccconfig
- name: Update BOINC unit file
become: true
copy:
src: ./files/boinc-client.service
dest: /usr/lib/systemd/system/boinc-client.service
owner: root
group: root
mode: 0644
register: unitfile
- name: Reload unit files
become: true
systemd:
daemon_reload: true
- name: Enable BOINC client
become: true
ansible.builtin.systemd:
name: boinc-client
enabled: true
masked: false
- name: Update Python common module
become: true
copy:
src: ./files/homefarm.py
dest: /usr/local/lib/homefarm.py
owner: root
group: root
mode: 0644
- name: Update query util
become: true
copy:
src: ./bin/utils/query
dest: /usr/local/bin/query
owner: root
group: root
mode: 0755
- name: Update boinccmdcmd
become: true
copy:
src: ./bin/utils/boinccmdcmd
dest: /usr/local/bin/boinccmdcmd
owner: root
group: root
mode: 0755
- name: Reload BOINC client config
become: true
shell: |
cd /var/lib/boinc
/bin/boinccmd --read_cc_config
when: ccconfig.changed and (unitfile.changed is false)
- name: Restart BOINC
become: true
service:
name: boinc-client
state: restarted
when: unitfile.changed