-
Notifications
You must be signed in to change notification settings - Fork 1
/
playbook.yml
77 lines (67 loc) · 1.86 KB
/
playbook.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
---
- name: Install XMR mining software
hosts: all
vars:
pool_host: rx.unmineable.com:3333
worker_name: xmrig-1
ansible_python_interpreter: /usr/bin/python3
token: "XXX"
payout_account: "ABCEDFGHJIKL..."
referral_code: "66p1-atgf"
install_dir: "/home/{{ansible_user}}/mining"
build_dir: "{{ install_dir }}/build"
screen_session: "miner"
exe_path: "{{ build_dir }}/xmrig"
begin_mining_command: "{{ exe_path }} -o {{ pool_host }} -a rx -k -u {{ token }}:{{ payout_account }}.{{ worker_name }}#{{ referral_code }} "
tasks:
- name: Create dest dir
file:
path: "{{install_dir}}"
state: directory
- name: Install deps
apt:
update_cache: yes
name:
- git
- build-essential
- cmake
- libuv1-dev
- libssl-dev
- libhwloc-dev
- screen
state: present
become: yes
- name: Clone git repo
git:
repo: 'https://github.com/xmrig/xmrig.git'
dest: "{{install_dir}}"
- name: Check if build directory already exists or not
stat:
path: "{{ build_dir }}"
register: build_location
- name: Build directory
file:
path: "{{build_dir}}"
state: directory
when: not build_location.stat.exists
- name: Check if xmr exe exists
stat:
path: "{{ exe_path }}"
register: exe_location
- name: Build from source
command:
cmd: cmake ..
chdir: "{{build_dir}}"
when: not build_location.stat.exists
- name: Run make command
make:
chdir: "{{build_dir}}"
when: not exe_location.stat.exists
- name: Install crontab for case of reboot
cron:
name: "Start xmr mining on reboot"
special_time: reboot
job: "/usr/bin/screen -m -d -S {{ screen_session }} {{ begin_mining_command }}"
- name: Rebooting machine
command: /sbin/shutdown -r +1
become: yes