2021-02-11 08:05:34 -06:00
|
|
|
---
|
|
|
|
# Jobs for miners.
|
|
|
|
|
2021-02-15 18:31:36 -06:00
|
|
|
# Move this to system facts?
|
2021-02-15 11:09:34 -06:00
|
|
|
- name: Miner | Account Management | Cron | Miner Names
|
|
|
|
set_fact:
|
|
|
|
miners:
|
2021-02-15 18:31:36 -06:00
|
|
|
- { "name": "xmr_stak_cpu", "enabled": '{{ (xmr_stak_cpu is defined) }}', "command": "{{ user_mfn.home }}/xmr_stak_cpu.sh" }
|
|
|
|
- { "name": "ethminer", "enabled": '{{ (ethminer is defined) }}', "command": "{{ user_mfn.home }}/ethminer.sh" }
|
|
|
|
- { "name": "nanominer", "enabled": '{{ (nanominer is defined) }}', "command": "{{ nanominer_script }}" }
|
2021-02-15 12:09:25 -06:00
|
|
|
|
2021-02-15 11:09:34 -06:00
|
|
|
|
|
|
|
- name: Miner | Account Management | Cron | Stop Jobs
|
|
|
|
cron:
|
|
|
|
user: mfn
|
2021-02-15 12:18:07 -06:00
|
|
|
name: "Stop {{ item.name }}"
|
2021-02-15 18:27:44 -06:00
|
|
|
minute: "*/5"
|
2021-02-15 18:31:36 -06:00
|
|
|
job: "killall {{ item.command }}"
|
2021-02-15 11:09:34 -06:00
|
|
|
state: present
|
2021-02-15 12:10:40 -06:00
|
|
|
disabled: "{{ item.enabled }}"
|
2021-02-15 11:09:34 -06:00
|
|
|
loop: "{{ miners }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Miner | Account Management | Cron | Start Jobs
|
|
|
|
cron:
|
|
|
|
user: mfn
|
2021-02-15 12:18:07 -06:00
|
|
|
name: "Start {{ item.name }}"
|
2021-02-15 18:27:44 -06:00
|
|
|
minute: "*/5"
|
2021-02-15 18:41:58 -06:00
|
|
|
job: "[[ ps -ef | grep -v 'grep' | grep -c '{{ item.command }}' == '0' ]] && {{ item.command }}"
|
2021-02-15 11:09:34 -06:00
|
|
|
state: present
|
2021-02-15 12:13:49 -06:00
|
|
|
disabled: "{{ not(item.enabled) }}"
|
2021-02-15 11:09:34 -06:00
|
|
|
loop: "{{ miners }}"
|