env-ansible/tasks/miner/cron/ansible.yml

33 lines
1.0 KiB
YAML
Raw Normal View History

---
# Jobs for miners.
2021-02-15 18:31:36 -06:00
# Move this to system facts?
- 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
- name: Miner | Account Management | Cron | Stop Jobs
cron:
user: mfn
name: "Stop {{ item.name }}"
minute: "*/5"
2021-02-15 18:31:36 -06:00
job: "killall {{ item.command }}"
state: present
2021-02-15 12:10:40 -06:00
disabled: "{{ item.enabled }}"
loop: "{{ miners }}"
- name: Miner | Account Management | Cron | Start Jobs
cron:
user: mfn
name: "Start {{ item.name }}"
minute: "*/5"
2021-02-15 18:41:58 -06:00
job: "[[ ps -ef | grep -v 'grep' | grep -c '{{ item.command }}' == '0' ]] && {{ item.command }}"
state: present
2021-02-15 12:13:49 -06:00
disabled: "{{ not(item.enabled) }}"
loop: "{{ miners }}"