First commit for creating nanomine config file.
This commit is contained in:
		| @@ -4,7 +4,7 @@ | |||||||
| ## Load Config File ## | ## Load Config File ## | ||||||
|  |  | ||||||
| - name: Miner | Facts | Config File | Download | - name: Miner | Facts | Config File | Download | ||||||
|   shell: "scp {{ config_server }}:{{ config_file_remote }} {{ config_file_local }}; chmod 700 {{ config_file_local }}" |   shell: "scp {{ file_server }}:{{ config_file_remote }} {{ config_file_local }}; chmod 700 {{ config_file_local }}" | ||||||
|  |  | ||||||
| - name: Miner | Facts | Config File | Load Wallets | - name: Miner | Facts | Config File | Load Wallets | ||||||
|   set_fact: |   set_fact: | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ | |||||||
|       - { "priority": 5, "name": "xmr-asia1.nanopool.org:14433" } |       - { "priority": 5, "name": "xmr-asia1.nanopool.org:14433" } | ||||||
|       - { "priority": 6, "name": "xmr-jp1.nanopool.org:14433" } |       - { "priority": 6, "name": "xmr-jp1.nanopool.org:14433" } | ||||||
|       - { "priority": 7, "name": "xmr-au1.nanopool.org:14433" } |       - { "priority": 7, "name": "xmr-au1.nanopool.org:14433" } | ||||||
|     nanoool_eth: |     nanopool_eth: | ||||||
|       - { "priority": 1, "name": "eth-us-east1.nanopool.org:9999" } |       - { "priority": 1, "name": "eth-us-east1.nanopool.org:9999" } | ||||||
|       - { "priority": 2, "name": "eth-us-west1.nanopool.org:9999" } |       - { "priority": 2, "name": "eth-us-west1.nanopool.org:9999" } | ||||||
|       - { "priority": 3, "name": "eth-eu1.nanopool.org:9999" } |       - { "priority": 3, "name": "eth-eu1.nanopool.org:9999" } | ||||||
| @@ -27,3 +27,40 @@ | |||||||
|     f2pool_eth: |     f2pool_eth: | ||||||
|       - { "priority": 1, "name": "eth-na.f2pool.com:6688" } |       - { "priority": 1, "name": "eth-na.f2pool.com:6688" } | ||||||
|       - { "priority": 2, "name": "eth-backup.f2pool.com:6688" } |       - { "priority": 2, "name": "eth-backup.f2pool.com:6688" } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ## Determine What Miners Should Use ## | ||||||
|  |  | ||||||
|  | # CPU # | ||||||
|  |  | ||||||
|  | - name: Miner | Facts | Pools | Set GPU to Nanopool Eth | ||||||
|  |   set_fact: | ||||||
|  |     cpu_pool: "{{ nanopool_xmr }}" | ||||||
|  |   when: nanominer_cpu == "xmr" and nanominer_gpu_pool == "nanopool" | ||||||
|  |  | ||||||
|  | # GPU # | ||||||
|  |  | ||||||
|  | - name: Miner | Facts | Pools | Set GPU to Nanopool Eth | ||||||
|  |   set_fact: | ||||||
|  |     gpu_pool: "{{ nanopool_eth }}" | ||||||
|  |   when: nanominer_gpu == "eth" and nanominer_gpu_pool == "nanopool" | ||||||
|  |  | ||||||
|  | - name: Miner | Facts | Pools | Set GPU to Etherpool Eth | ||||||
|  |   set_fact: | ||||||
|  |     gpu_pool: "{{ ethermine_eth }}" | ||||||
|  |   when: nanominer_gpu == "eth" and nanominer_gpu_pool == "etherpool" | ||||||
|  |  | ||||||
|  | - name: Miner | Facts | Pools | Set GPU to F2Pool Eth | ||||||
|  |   set_fact: | ||||||
|  |     gpu_pool: "{{ f2pool_eth }}" | ||||||
|  |   when: nanominer_gpu == "eth" and nanominer_gpu_pool == "f2pool" | ||||||
|  |    | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ## Validate ## | ||||||
|  |  | ||||||
|  | - name: Miner | Facts | Pools | DEBUG | ||||||
|  |   debug: | ||||||
|  |     var: | ||||||
|  |       - cpu_pool | ||||||
|  |       - gpu_pool | ||||||
| @@ -1,9 +1,41 @@ | |||||||
| --- | --- | ||||||
| # Define file, folder, and other facts per OS. | # Define file, folder, and other facts per OS. | ||||||
|  |  | ||||||
| - name: Miner | Facts | System | Config File | ## Global ## | ||||||
|  |  | ||||||
|  | - name: Miner | Facts | System | My Config File | ||||||
|  |   set_fact: | ||||||
|  |     file_server: 'ling@leet' | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ## Config file ## | ||||||
|  | - name: Miner | Facts | System | My Config File | ||||||
|   set_fact: |   set_fact: | ||||||
|     config_server: 'ling@leet' |  | ||||||
|     config_file_remote: "InstallFiles/Miners/miner.ini" |     config_file_remote: "InstallFiles/Miners/miner.ini" | ||||||
|     config_file_local: "{{ user_mfn.home }}/miner.ini" |     config_file_local: "{{ user_mfn.home }}/miner.ini" | ||||||
|     config_section_wallet: wallet |     config_section_wallet: wallet | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ## nanominer ## | ||||||
|  |  | ||||||
|  | - name: Miner | Facts | System | nanominer 1 | ||||||
|  |   set_fact: | ||||||
|  |     nanominer_home: "{{ user_mfn.home }}/nanominer" | ||||||
|  |     nanominer_version: "3.2.2" | ||||||
|  |     nanominer_script: "{{ user_mfn.home }}/nanominer.sh" | ||||||
|  |     nanominer_tar_remote: "InstallFiles/Miners/nanominer/*.tar.gz" | ||||||
|  |   when: nanominer is defined | ||||||
|  |  | ||||||
|  | - name: Miner | Facts | System | nanominer 2 | ||||||
|  |   set_fact: | ||||||
|  |     nanominer_bin: "{{ nanominer_home }}/nanominer-linux-{{ nanominer_version }}" | ||||||
|  |     nanominer_tar_remote: "InstallFiles/Miners/nanominer/*{{ nanominer_version }}*.tar.gz" | ||||||
|  |     nanominer_config: "{{ nanominer_home }}/config.ini" | ||||||
|  |     nanominer_logs: "{{ nanominer_home}}/logs" | ||||||
|  |   when: nanominer is defined | ||||||
|  |  | ||||||
|  | - name: Miner | Facts | System | nanominer 3 | ||||||
|  |   set_fact: | ||||||
|  |     nanominer_tar_local: "{{ nanominer_bin }}.tar.gz" | ||||||
|  |     nanominer_exec: "{{ nanominer_bin }}/nanominer" | ||||||
|  |   when: nanominer is defined | ||||||
							
								
								
									
										2
									
								
								hosts
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								hosts
									
									
									
									
									
								
							| @@ -8,4 +8,4 @@ usb | |||||||
|  |  | ||||||
| [miner] | [miner] | ||||||
| usb  amdgpu=true | usb  amdgpu=true | ||||||
| x570 amdgpu=true nanominer=true nanominer_cpu=xmr nanominer_gpu=eth nanominer_gpus=1 | x570 amdgpu=true nanominer=true nanominer_cpu=xmr nanominer_cpu_pool=nanopool nanominer_gpu=eth nanominer_gpus=1 nanominer_gpu_pool=nanopool | ||||||
| @@ -3,33 +3,101 @@ | |||||||
| # Good documentation that might help with how to do variables. | # Good documentation that might help with how to do variables. | ||||||
| # https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html | # https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html | ||||||
|  |  | ||||||
| ## Install ## | ## Installation ## | ||||||
|  |  | ||||||
|  | - name: Miner | Software | nanominer | Installation | Create Home | ||||||
|  |   shell: "mkdir -p {{ nanominer_home }}" | ||||||
|  |  | ||||||
|  | - name: Miner | Software | nanominer | Installation | Download Tarball | ||||||
|  |   shell: "scp {{ file_server }}:{{ nanominer_tar_remote }} {{ nanominer_tar_local }}" | ||||||
|  |  | ||||||
|  | - name: Miner | Software | nanominer | Installation | Extract Tarball | ||||||
|  |   shell: "tar -xvfC {{ nanominer_home }} {{ nanominer_tar_local }}" | ||||||
|  |  | ||||||
|  |  | ||||||
| ## Settings ## |  | ||||||
|  |  | ||||||
| - name: Miner | Software | nanominer | Mine with CPU (Optional) | ## Configuration ## | ||||||
|   debug: |  | ||||||
|     var: nanominer_cpu | # Delete Old Config # | ||||||
|  |  | ||||||
|  | - name: Miner | Software | nanominer | Configuration | Reset | ||||||
|  |   shell: "mv {{ nanominer_config }} ~/TRASH/" | ||||||
|  |  | ||||||
|  | # CPU # | ||||||
|  |  | ||||||
|  | - name: Miner | Software | nanominer | Configuration | CPU Header Info | ||||||
|  |   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') }}"} | ||||||
|   when: nanominer_cpu is defined |   when: nanominer_cpu is defined | ||||||
|  |  | ||||||
| - name: Miner | Software | nanominer | Mine with GPU (Optional) | - name: Miner | Software | nanominer | Configuration | CPU Pools | ||||||
|   debug: |   lineinfile: | ||||||
|     var: nanominer_gpu |     path: "{{ nanominer_config }}" | ||||||
|  |     line: "pool{{item.priority}} = {{ item.name }}" | ||||||
|  |     state: present | ||||||
|  |   loop: "{{ cpu_pool }}" | ||||||
|  |   when: nanominer_cpu is defined | ||||||
|  |  | ||||||
|  | # GPU # | ||||||
|  |  | ||||||
|  | - name: Miner | Software | nanominer | Configuration | GPU Header Info | ||||||
|  |   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') }}"} | ||||||
|   when: nanominer_gpu is defined |   when: nanominer_gpu is defined | ||||||
|  |  | ||||||
| #- name: Miner | Software | nanominer | Mine with GPU (Optional) | - name: Miner | Software | nanominer | Configuration | Add Pools | ||||||
| #  blockinfile: |   lineinfile: | ||||||
| #    path: "{{ item }}/.bashrc" |     path: "{{ nanominer_config }}" | ||||||
| #    block: | |     line: "pool{{item.priority}} = {{ item.name }}" | ||||||
| #      watchdog = true |     state: present | ||||||
| #    marker: '# {mark} MANAGED BY ANSIBLE | Aliases' |   loop: "{{ gpu_pool }}" | ||||||
| #    state: present |   when: nanominer_gpu is defined | ||||||
| #    create: yes |  | ||||||
| #    backup: yes |  | ||||||
| #  when: nanominer_gpu is defined |  | ||||||
|  |  | ||||||
| - name: Miner | Software | nanominer | Choose GPUS (Optional) |  | ||||||
|   debug: |  | ||||||
|     var: nanominer_gpus | ## Executable ## | ||||||
|   when: nanominer_gpus is defined |  | ||||||
|  | - name: Miner | Software | nanominer | Executable | Create | ||||||
|  |   blockinfile: | ||||||
|  |     path: "{{ nanominer_script }}" | ||||||
|  |     block: | | ||||||
|  |       # 2021-02-15 - Automate nanominer script creation. | ||||||
|  |        | ||||||
|  |       date | ||||||
|  |       whoami | ||||||
|  |       pwd | ||||||
|  |  | ||||||
|  |       time {{ nanominer_exec }} | ||||||
|  |        | ||||||
|  |     marker: '{mark}' | ||||||
|  |     marker_begin: "#!{{ bash_exec.stdout }}" | ||||||
|  |     marker_end: "exit 0" | ||||||
|  |     state: present | ||||||
|  |     create: yes | ||||||
		Reference in New Issue
	
	Block a user