2021-02-14 07:12:05 -06:00
|
|
|
---
|
|
|
|
# Nanominer from nanopool.org
|
2021-02-15 14:13:04 -06:00
|
|
|
# Good documentation that might help with how to do variables.
|
|
|
|
# https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html
|
2021-02-15 13:57:22 -06:00
|
|
|
|
2021-02-15 17:48:04 -06:00
|
|
|
## Installation ##
|
2021-02-15 13:57:22 -06:00
|
|
|
|
2021-02-15 18:23:03 -06:00
|
|
|
- name: Miner | Software | Nanominer | Installation | Create Home
|
2021-02-15 17:48:04 -06:00
|
|
|
shell: "mkdir -p {{ nanominer_home }}"
|
2021-02-15 18:00:12 -06:00
|
|
|
become_user: mfn
|
2021-02-15 13:57:22 -06:00
|
|
|
|
2021-02-15 18:23:03 -06:00
|
|
|
- name: Miner | Software | Nanominer | Installation | Download Tarball
|
2021-02-15 18:11:48 -06:00
|
|
|
shell: "scp {{ file_server }}:{{ nanominer_tar_remote }} {{ nanominer_tar_local }}; chown mfn {{ nanominer_tar_local }}"
|
2021-02-15 13:57:22 -06:00
|
|
|
|
2021-02-15 18:23:03 -06:00
|
|
|
- name: Miner | Software | Nanominer | Installation | Extract Tarball
|
2021-02-15 17:55:23 -06:00
|
|
|
shell: "tar -xvf {{ nanominer_tar_local }}"
|
|
|
|
args:
|
|
|
|
chdir: "{{ nanominer_home }}"
|
|
|
|
become_user: mfn
|
2021-02-15 17:48:04 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Configuration ##
|
|
|
|
|
|
|
|
# Delete Old Config #
|
|
|
|
|
2021-02-15 18:23:03 -06:00
|
|
|
- name: Miner | Software | Nanominer | Configuration | Reset
|
2021-02-15 17:48:04 -06:00
|
|
|
shell: "mv {{ nanominer_config }} ~/TRASH/"
|
2021-02-15 18:03:09 -06:00
|
|
|
ignore_errors: yes
|
2021-02-15 17:48:04 -06:00
|
|
|
|
|
|
|
# CPU #
|
|
|
|
|
2021-02-15 18:23:03 -06:00
|
|
|
- name: Miner | Software | Nanominer | Configuration | CPU Header Info
|
2021-02-15 17:48:04 -06:00
|
|
|
blockinfile:
|
|
|
|
path: "{{ nanominer_config }}"
|
|
|
|
block: |
|
|
|
|
[{{ item.algorithm }}]
|
|
|
|
wallet = {{ item.wallet }}
|
|
|
|
watchdog = true
|
|
|
|
rigName = {{ ansible_hostname }}
|
|
|
|
logpath = {{ nanominer_logs }}
|
|
|
|
webPassword = {{ ansible_hostname }}
|
|
|
|
useSSL = true
|
|
|
|
marker: '; {mark} MANAGED BY ANSIBLE - CPU Headers'
|
|
|
|
state: "{{ item.state }}"
|
|
|
|
create: yes
|
|
|
|
loop:
|
|
|
|
- { "algorithm": "RandomX", "wallet": '{{ wallet_xmr }}', "state": "{{ (nanominer_cpu == 'xmr') | ternary('present', 'absent') }}"}
|
2021-02-15 17:55:23 -06:00
|
|
|
become_user: mfn
|
2021-02-15 17:48:04 -06:00
|
|
|
when: nanominer_cpu is defined
|
|
|
|
|
2021-02-15 18:23:03 -06:00
|
|
|
- name: Miner | Software | Nanominer | Configuration | CPU Pools
|
2021-02-15 17:48:04 -06:00
|
|
|
lineinfile:
|
|
|
|
path: "{{ nanominer_config }}"
|
|
|
|
line: "pool{{item.priority}} = {{ item.name }}"
|
|
|
|
state: present
|
2021-02-15 18:23:03 -06:00
|
|
|
create: no
|
2021-02-15 17:48:04 -06:00
|
|
|
loop: "{{ cpu_pool }}"
|
2021-02-15 17:55:23 -06:00
|
|
|
become_user: mfn
|
2021-02-15 14:13:04 -06:00
|
|
|
when: nanominer_cpu is defined
|
2021-02-15 13:57:22 -06:00
|
|
|
|
2021-02-15 18:23:03 -06:00
|
|
|
# Add Spacing #
|
|
|
|
|
|
|
|
- name: Miner | Software | Nanominer | Configuration | Spacing
|
|
|
|
blockinfile:
|
|
|
|
path: "{{ nanominer_config }}"
|
|
|
|
block: |
|
|
|
|
;
|
|
|
|
marker: ';'
|
2021-02-15 18:25:24 -06:00
|
|
|
state: present
|
2021-02-15 18:23:03 -06:00
|
|
|
create: no
|
|
|
|
become_user: mfn
|
|
|
|
when: nanominer_config is file
|
|
|
|
|
2021-02-15 17:48:04 -06:00
|
|
|
# GPU #
|
|
|
|
|
2021-02-15 18:23:03 -06:00
|
|
|
- name: Miner | Software | Nanominer | Configuration | GPU Header Info
|
2021-02-15 17:48:04 -06:00
|
|
|
blockinfile:
|
|
|
|
path: "{{ nanominer_config }}"
|
|
|
|
block: |
|
|
|
|
[{{ item.algorithm }}]
|
|
|
|
wallet = {{ item.wallet }}
|
|
|
|
watchdog = true
|
|
|
|
rigName = {{ ansible_hostname }}
|
|
|
|
logpath = {{ nanominer_logs }}
|
|
|
|
webPassword = {{ ansible_hostname }}
|
|
|
|
devices = {{ nanominer_gpus }}
|
|
|
|
useSSL = true
|
|
|
|
marker: '; {mark} MANAGED BY ANSIBLE - GPU Headers'
|
|
|
|
state: "{{ item.state }}"
|
|
|
|
create: yes
|
|
|
|
loop:
|
|
|
|
- { "algorithm": "Ethash", "wallet": '{{ wallet_eth }}', "state": "{{ (nanominer_gpu == 'eth') | ternary('present', 'absent') }}"}
|
2021-02-15 17:55:23 -06:00
|
|
|
become_user: mfn
|
2021-02-15 17:48:04 -06:00
|
|
|
when: nanominer_gpu is defined
|
|
|
|
|
2021-02-15 18:23:03 -06:00
|
|
|
- name: Miner | Software | Nanominer | Configuration | Add Pools
|
2021-02-15 17:48:04 -06:00
|
|
|
lineinfile:
|
|
|
|
path: "{{ nanominer_config }}"
|
|
|
|
line: "pool{{item.priority}} = {{ item.name }}"
|
|
|
|
state: present
|
2021-02-15 18:23:03 -06:00
|
|
|
create: no
|
2021-02-15 17:48:04 -06:00
|
|
|
loop: "{{ gpu_pool }}"
|
2021-02-15 17:55:23 -06:00
|
|
|
become_user: mfn
|
2021-02-15 14:13:04 -06:00
|
|
|
when: nanominer_gpu is defined
|
2021-02-15 13:57:22 -06:00
|
|
|
|
2021-02-15 17:48:04 -06:00
|
|
|
|
|
|
|
|
|
|
|
## Executable ##
|
|
|
|
|
2021-02-15 18:23:03 -06:00
|
|
|
- name: Miner | Software | Nanominer | Executable | Create
|
2021-02-15 17:48:04 -06:00
|
|
|
blockinfile:
|
|
|
|
path: "{{ nanominer_script }}"
|
|
|
|
block: |
|
|
|
|
# 2021-02-15 - Automate nanominer script creation.
|
|
|
|
|
|
|
|
date
|
|
|
|
whoami
|
|
|
|
pwd
|
|
|
|
|
2021-02-15 18:10:21 -06:00
|
|
|
time {{ nanominer_exec }} {{ nanominer_config }}
|
2021-02-15 17:55:23 -06:00
|
|
|
|
2021-02-15 17:48:04 -06:00
|
|
|
marker: '{mark}'
|
|
|
|
marker_begin: "#!{{ bash_exec.stdout }}"
|
|
|
|
marker_end: "exit 0"
|
|
|
|
state: present
|
2021-02-15 17:55:23 -06:00
|
|
|
create: yes
|
2021-02-15 18:10:21 -06:00
|
|
|
become_user: mfn
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Permissions ##
|
|
|
|
|
2021-02-15 18:23:03 -06:00
|
|
|
- name: Miner | Software | Nanominer | Permissions
|
2021-02-15 18:10:21 -06:00
|
|
|
shell: "chmod -R 755 {{ user_mfn.home }}/nanominer*"
|
2021-02-15 17:55:23 -06:00
|
|
|
become_user: mfn
|