Dumbify variables a bit and take some hints from finally discovered documentation on boolean functions.

This commit is contained in:
Hyperling 2021-02-15 14:13:04 -06:00
parent 67c2a54256
commit ced0e9e752
5 changed files with 21 additions and 18 deletions

4
hosts
View File

@ -7,5 +7,5 @@ dell-laptop
usb
[miner]
usb driver=[amdgpu] miner=[]
x570 driver=[amdgpu] miner=[nanominer,test] nanominer_config={"cpu":"xmr","gpu":"eth","gpus":[1,2,3]}
usb amdgpu
x570 amdgpu nanominer nanominer_cpu=xmr nanominer_gpu=eth nanominer_gpus=1

View File

@ -82,19 +82,19 @@
### CPU SECTION ###
# Monero #
- include: tasks/miner/software/xmr-stak-cpu.yml
when: '"xmr_stak_cpu" in miner'
when: xmr_stak_cpu is defined
### GPU Section ###
## Drivers ##
- include: tasks/miner/drivers/amdgpu.yml
when: ansible_distribution == "Ubuntu" and "amdgpu" in driver
when: ansible_distribution == "Ubuntu" and amdgpu is defined
# Ethereum #
- include: tasks/miner/software/ethminer.yml
when: '"ethminer" in miner'
when: ethminer is defined
- include: tasks/miner/software/ethminer.yml
when: '"nanominer" in miner'
- include: tasks/miner/software/nanominer.yml
when: nanominer is defined
# Scheduling
post_tasks:

View File

@ -4,9 +4,9 @@
- name: Miner | Account Management | Cron | Miner Names
set_fact:
miners:
- { "name": "xmr_stak_cpu", "enabled": ("xmr_stak_cpu" in miner) }
- { "name": "ethminer", "enabled": ("ethminer" in miner) }
#- { "name": "nanominer", "enabled": ("nanominer" in miner) }
- { "name": "xmr_stak_cpu", "enabled": {{(xmr_stak_cpu is defined)}} }
- { "name": "ethminer", "enabled": {{(ethminer is defined)}} }
#- { "name": "nanominer", "enabled": (nanominer is defined) }
- name: Miner | Account Management | Cron | Stop Jobs

View File

@ -5,6 +5,8 @@
debug:
var: "{{ item }}"
loop:
- driver
- miner
- nanominer_config
- amdgpu
- nanominer
- nanominer_cpu
- nanominer_gpu
- nanominer_gpus

View File

@ -1,5 +1,7 @@
---
# Nanominer from nanopool.org
# Good documentation that might help with how to do variables.
# https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html
## Install ##
@ -9,12 +11,12 @@
- name: Miner | Software | nanominer | Mine with CPU (Optional)
debug:
var: nanominer_config.cpu
when: nanominer_config.cpu is defined
when: nanominer_cpu is defined
- name: Miner | Software | nanominer | Mine with GPU (Optional)
debug:
var: nanominer_config.gpu
when: nanominer_config.gpu is defined
when: nanominer_gpu is defined
#- name: Miner | Software | nanominer | Mine with GPU (Optional)
# blockinfile:
@ -25,11 +27,10 @@
# state: present
# create: yes
# backup: yes
# loop: "{{ nanominer_config.gpu }}"
# when: nanominer_config.gpu is defined
# when: nanominer_gpu is defined
- name: Miner | Software | nanominer | Choose GPUS (Optional)
debug:
var: "{{ item }}"
loop: "{{ nanominer_config.gpus }}"
when: nanominer_config.gpus is defined
when: nanominer_gpus is defined