From 2a6edcb788311111794016efa1953ce4a42000cc Mon Sep 17 00:00:00 2001 From: Hyperling Date: Thu, 11 Feb 2021 08:05:34 -0600 Subject: [PATCH] Beginning to put together tasks for ETH mining. --- local.yml | 27 ++++++++++++++++++++ tasks/miner/acct_mgmt/mfn.yml | 8 ++++++ tasks/miner/cron/ansible.yml | 11 ++++++++ tasks/miner/driver/amdgpu.yml | 17 +++++++++++++ tasks/miner/gpu/eth.yml | 2 -- tasks/miner/gpu/ethminer.yml | 48 +++++++++++++++++++++++++++++++++++ 6 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 tasks/miner/acct_mgmt/mfn.yml create mode 100644 tasks/miner/cron/ansible.yml create mode 100644 tasks/miner/driver/amdgpu.yml delete mode 100644 tasks/miner/gpu/eth.yml create mode 100644 tasks/miner/gpu/ethminer.yml diff --git a/local.yml b/local.yml index 2f68fb9..760e444 100644 --- a/local.yml +++ b/local.yml @@ -63,6 +63,33 @@ - include: tasks/workstation/settings/gnome.yml +# Additional setup for miners! +- name: Main | Workstation UI Setup + hosts: miner + connection: local + become: true + + pre_tasks: + - include: tasks/miner/acct_mgmt/mfn.yml + + tasks: + # Monero + - include: tasks/miner/cpu/xmr.yml + become_user: mfn + when: mine.xmr is defined + + # Ethereum + - include: tasks/miner/driver/amdgpu.yml + when: ansible_distribution == "Ubuntu" and mine.eth is defined + + - include: tasks/miner/gpu/eth/ethminer.yml + become_user: mfn + when: ansible_distribution == "Ubuntu" and mine.eth is defined + + post_tasks: + - include: tasks/miner/cron/ansible.yml + + # Create reports to analyze security. - name: Main | Hardness Tests hosts: localhost diff --git a/tasks/miner/acct_mgmt/mfn.yml b/tasks/miner/acct_mgmt/mfn.yml new file mode 100644 index 0000000..c0629e2 --- /dev/null +++ b/tasks/miner/acct_mgmt/mfn.yml @@ -0,0 +1,8 @@ +--- +# Account to do mining tasks. + +- name: Miner | Account Management | User | Miner Forty Niner + user: + name: mfn + comment: Miner Forty Niner + system: yes diff --git a/tasks/miner/cron/ansible.yml b/tasks/miner/cron/ansible.yml new file mode 100644 index 0000000..c6f9401 --- /dev/null +++ b/tasks/miner/cron/ansible.yml @@ -0,0 +1,11 @@ +--- +# Jobs for miners. + +- name: Cron | XMR + shell: "" + when: mine.xmr is defined + +#- name: Cron | ETH +# cron: +# name: Mine Ethereum +# when: mine.eth is defined \ No newline at end of file diff --git a/tasks/miner/driver/amdgpu.yml b/tasks/miner/driver/amdgpu.yml new file mode 100644 index 0000000..ebf74de --- /dev/null +++ b/tasks/miner/driver/amdgpu.yml @@ -0,0 +1,17 @@ +--- +# Install OpenCL drivers. + +- name: Folder + shell: 'mkdir -p Downloads' + +- name: Download + shell: 'scp ling@leet:InstallFiles/Drivers/amdgpu-pro-20.45-1188099-ubuntu-20.04.tar.xz Downloads/' + +- name: Extract + shell: 'cd Downloads; tar -xvf amdgpu-pro-20.45-1188099-ubuntu-20.04.tar.xz' + +- name: Install 1 - All + shell: 'cd Downloads/amdgpu-pro-20.45-1188099-ubuntu-20.04; amdgpu-install -y' + +- name: Install 2 - Pro + shell: 'cd Downloads/amdgpu-pro-20.45-1188099-ubuntu-20.04; amdgpu-pro-install -y --opencl=pal,legacy' diff --git a/tasks/miner/gpu/eth.yml b/tasks/miner/gpu/eth.yml deleted file mode 100644 index 8c34fd3..0000000 --- a/tasks/miner/gpu/eth.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# Mine Ethereum with GPU! diff --git a/tasks/miner/gpu/ethminer.yml b/tasks/miner/gpu/ethminer.yml new file mode 100644 index 0000000..7e26060 --- /dev/null +++ b/tasks/miner/gpu/ethminer.yml @@ -0,0 +1,48 @@ +--- +# Mine Ethereum with GPU! + +- name: Install Dependencies + package: + name: build-essential dkms cmake perl libdbus-1-dev mesa-common-dev + state: present + become: true + +- name: Add PPA + shell: 'add-apt-repository ppa:ethereum/ethereum; apt update' + become: true + +- name: Install Ethereum + package: + name: ethereum + state: present + become: true + +- name: Clone Git Repo + shell: 'git clone https://github.com/ethereum-mining/ethminer.git' + +- name: Update Repo's Repos + shell: 'cd ethminer; git submodule update --init --recursive' + +- name: Create Build Folder + shell: 'cd ethminer; mkdir -p build' + +- name: cmake Flags + shell: 'cd ethminer/build; cmake .. -DETHASHCL=ON -DETHASHCUDA=OFF -DAPICORE=ON -DBINKERN=ON -DETHDBUS=ON -DUSE_SYS_OPENCL=ON -ETHASHCPU=ON -DEVBUILD=ON' + +- name: cmake Build + shell: 'cd ethminer/build; cmake --build .' + +- name: cmake Build + shell: 'cd /home/mfn/ethminer/build; make install' + become: true + +- name: Download Script + shell: 'scp ling@leet:InstallFiles/Miners/ETH/ethminer.sh /home/mfn/; chmod 755 /home/mfn/ethminer.sh' + become: true + +- name: Kill Current Jobs + shell: 'killall ethminer.sh' + become: true + +- name: Start Mining + shell: 'time ethminer.sh' \ No newline at end of file