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

32 lines
1000 B
YAML
Raw Normal View History

---
# Jobs for miners.
- name: Miner | Account Management | Cron | Miner Names
set_fact:
miners:
- { "name": "xmr_stak_cpu", "enabled": '{{ (xmr_stak_cpu is defined) }}', "exec": "{{ user_mfn.home }}/xmr_stak_cpu.sh" }
- { "name": "ethminer", "enabled": '{{ (ethminer is defined) }}', "exec": "{{ user_mfn.home }}/ethminer.sh" }
- { "name": "nanominer", "enabled": '{{ (nanominer is defined) }}', "exec": "{{ 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"
job: "killall {{ item.exec }}"
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:19:32 -06:00
job: "ps -ef | grep '{{ item.exec }}' | grep -v 'grep' && {{ item.exec }}"
state: present
2021-02-15 12:13:49 -06:00
disabled: "{{ not(item.enabled) }}"
loop: "{{ miners }}"