{"id":18330005,"url":"https://github.com/88plug/presearch-node-ansible-playbook","last_synced_at":"2025-04-09T17:39:13.978Z","repository":{"id":203616306,"uuid":"710015338","full_name":"88plug/presearch-node-ansible-playbook","owner":"88plug","description":"Setup a Presearch node in minutes on any VPS with Ansible Playbook.","archived":false,"fork":false,"pushed_at":"2023-10-26T00:55:21.000Z","size":77,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-15T10:31:44.112Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/88plug.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-25T20:47:51.000Z","updated_at":"2023-10-25T22:17:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"192a9053-735f-496b-953e-cde1c470dcb1","html_url":"https://github.com/88plug/presearch-node-ansible-playbook","commit_stats":null,"previous_names":["88plug/presearch-node-ansible-playbook"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/88plug%2Fpresearch-node-ansible-playbook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/88plug%2Fpresearch-node-ansible-playbook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/88plug%2Fpresearch-node-ansible-playbook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/88plug%2Fpresearch-node-ansible-playbook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/88plug","download_url":"https://codeload.github.com/88plug/presearch-node-ansible-playbook/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248078761,"owners_count":21044171,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T19:19:33.742Z","updated_at":"2025-04-09T17:39:13.942Z","avatar_url":"https://github.com/88plug.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Setup a [Presearch](https://presearch.com/signup?rid=4613404) node on any VPS with this Ansible playbook\n[![image](https://github.com/88plug/presearch-node-ansible-playbook/assets/19512127/1ff18269-7e08-4135-ad1d-858df85c171f)\n](https://presearch.com/signup?rid=4613404) \n\n# Requirements for Setup:\n\n\n1. **[MetaMask](https://metamask.io/)**:\n   - Install Metamask\n   - Click 'Import tokens' in the wallet\n   - On the top header click \"Custom token\"\n   - Paste the Presearch (PRE) Contract Address : `0xEC213F83defB583af3A000B1c0ada660b1902A0F`\n   - Click \"Next\" and then \"Import\"\n   - Swap your Ethereum, USDT, or WETH for at least 4,000 PRE\n   - Each additional node requires at least 4,000 PRE\n\n2. **[Presearch Account](https://presearch.com/signup?rid=4613404)**: \n   - Signup and get familiar with the interface.\n   - You must now deposit at least 4,000 PRE from Metamask to your [Presearch deposit address](https://keywords.presearch.com/transfer-tokens/blockchain?rid=4613404).\n   - Once the PRE has arrived to your account it will be visible in you [account wallet](https://account.presearch.com/tokens/pre-wallet?rid=4613404).\n\n3. **Control Machine**: \n   - Must be Linux-based.\n   - Used to edit the `hosts.ini` file.\n   - This is where you'll run the Ansible Playbook targeting the VPS.\n   - Ensure Ansible is set up on the control machine:\n     ```bash\n     apt-get install ansible\n     ```\n\n4. **VPS/VM Minimum Requirements**:\n   - 1 CPU | 1GB Memory | 10GB SSD/NVMe Disk\n   - Debian 9/10 or Ubuntu Server 18.04/20.04\n   - [HostHatch](https://cloud.hosthatch.com/a/1577) |\n[Racknerd](https://my.racknerd.com/aff.php?aff=9475) |\n[Vultr](https://www.vultr.com/?ref=7703094) |\n[DigitalOcean](https://m.do.co/c/d9874e8ceba7)\n\n5. **IP Configuration**:\n   - Currently the Ansible playbook only supports a single IPv4 address only per VPS.\n\n\n\n## Installation:\n\nOnce you have bought a new VPS or created a new set of VM's it's time to set them up! \n\n1.  **On the control machine**:\n\n```\ngit clone https://github.com/88plug/presearch-node-ansible-playbook\ncd presearch-node-ansible-playbook\n```\n\n2. **Edit** hosts.ini and update with your IP addresses\n```\nnano hosts.ini\n```\n\n3. **Run** add-key.sh to copy your public key to each server.\n```\nchmod +x add-key.sh \u0026\u0026 ./add-key.sh\n```\n\n4. **Run the playbook for real and create new Presearch nodes.** Change XXXXX to your registration code from [dashboard](https://nodes.presearch.com/dashboard?rid=4613404).\n\n![image](https://github.com/88plug/presearch-node-ansible-playbook/assets/19512127/63b853a7-aa42-4347-96cb-fb26ac299aae)\n```\nansible-playbook -i hosts.ini playbook.yml -e \"PRESEARCH_REGISTRATION_CODE=XXXXX\"\n```\n\n5. **[Check Presearch Dashboard](https://nodes.presearch.com/dashboard?rid=4613404)** You should see the new nodes appear after each succesful installation.\n\n![image](https://github.com/88plug/presearch-node-ansible-playbook/assets/19512127/62f94bc8-28fa-4c44-b280-161c52afbbc2)\n\n7. **Click** Stake button next to each node to add at least 4,000 PRE and update the description with a user-friendly name.\n8. **Click** Stats button next to each node to see IP address and other information.\n\n---\n\n## Succesful output example:\n```\nPLAY [all] ***************************************************************************************************************************************************************************************************************************************************\n\nTASK [Gathering Facts] ***************************************************************************************************************************************************************************************************************************************\nok: [root@45.32.129.161]\n\nTASK [Ensure the system timezone is set to UTC] **************************************************************************************************************************************************************************************************************\nok: [root@45.32.129.161]\n\nTASK [Update and upgrade all packages] ***********************************************************************************************************************************************************************************************************************\nchanged: [root@45.32.129.161]\n\nTASK [Upgrade all packages non-interactively and install additional tools] ***********************************************************************************************************************************************************************************\nchanged: [root@45.32.129.161]\n\nTASK [Install UFW] *******************************************************************************************************************************************************************************************************************************************\nok: [root@45.32.129.161]\n\nTASK [Set UFW default incoming policy to deny] ***************************************************************************************************************************************************************************************************************\nok: [root@45.32.129.161]\n\nTASK [Set UFW default outgoing policy to allow] **************************************************************************************************************************************************************************************************************\nok: [root@45.32.129.161]\n\nTASK [Allow SSH through UFW] *********************************************************************************************************************************************************************************************************************************\nok: [root@45.32.129.161]\n\nTASK [Enable UFW] ********************************************************************************************************************************************************************************************************************************************\nok: [root@45.32.129.161]\n\nTASK [Install fail2ban] **************************************************************************************************************************************************************************************************************************************\nok: [root@45.32.129.161]\n\nTASK [Configure fail2ban for permanent jailing] **************************************************************************************************************************************************************************************************************\nchanged: [root@45.32.129.161]\n\nTASK [Ensure fail2ban service is enabled and running] ********************************************************************************************************************************************************************************************************\nok: [root@45.32.129.161]\n\nTASK [Set GRUB timeout] **************************************************************************************************************************************************************************************************************************************\nchanged: [root@45.32.129.161]\n\nTASK [Ensure chrony (NTP) package is installed] **************************************************************************************************************************************************************************************************************\nchanged: [root@45.32.129.161]\n\nTASK [Ensure chrony service is enabled and running] **********************************************************************************************************************************************************************************************************\nok: [root@45.32.129.161]\n\nTASK [Force an immediate synchronization of the time] ********************************************************************************************************************************************************************************************************\nok: [root@45.32.129.161]\n\nTASK [Check if NTP is synchronized] **************************************************************************************************************************************************************************************************************************\nok: [root@45.32.129.161]\n\nTASK [Display NTP synchronization status] ********************************************************************************************************************************************************************************************************************\nok: [root@45.32.129.161] =\u003e {\n    \"ntp_status.stdout_lines\": [\n        \"Reference ID    : 00000000 ()\",\n        \"Stratum         : 0\",\n        \"Ref time (UTC)  : Thu Jan 01 00:00:00 1970\",\n        \"System time     : 0.000000000 seconds fast of NTP time\",\n        \"Last offset     : +0.000000000 seconds\",\n        \"RMS offset      : 0.000000000 seconds\",\n        \"Frequency       : 65.433 ppm slow\",\n        \"Residual freq   : +0.000 ppm\",\n        \"Skew            : 0.000 ppm\",\n        \"Root delay      : 1.000000000 seconds\",\n        \"Root dispersion : 1.000000000 seconds\",\n        \"Update interval : 0.0 seconds\",\n        \"Leap status     : Not synchronised\"\n    ]\n}\n\nTASK [Increase max FD limit / ulimit] ************************************************************************************************************************************************************************************************************************\nchanged: [root@45.32.129.161]\n\nTASK [Add sysctl.conf parameters] ****************************************************************************************************************************************************************************************************************************\nchanged: [root@45.32.129.161] =\u003e (item={'name': 'vm.min_free_kbytes', 'value': '131072'})\nchanged: [root@45.32.129.161] =\u003e (item={'name': 'vm.swappiness', 'value': '0'})\nchanged: [root@45.32.129.161] =\u003e (item={'name': 'fs.inotify.max_queued_events', 'value': '1048576'})\nchanged: [root@45.32.129.161] =\u003e (item={'name': 'fs.inotify.max_user_instances', 'value': '1048576'})\nchanged: [root@45.32.129.161] =\u003e (item={'name': 'fs.inotify.max_user_watches', 'value': '1048576'})\nchanged: [root@45.32.129.161] =\u003e (item={'name': 'vm.max_map_count', 'value': '262144'})\nchanged: [root@45.32.129.161] =\u003e (item={'name': 'fs.aio-max-nr', 'value': '524288'})\n\nTASK [Clear all journald logs] *******************************************************************************************************************************************************************************************************************************\nchanged: [root@45.32.129.161]\n\nTASK [Mask and stop systemd-journald] ************************************************************************************************************************************************************************************************************************\nchanged: [root@45.32.129.161]\n\nTASK [Configure Docker to not store logs] ********************************************************************************************************************************************************************************************************************\nchanged: [root@45.32.129.161]\n\nTASK [Run BleachBit] *****************************************************************************************************************************************************************************************************************************************\nchanged: [root@45.32.129.161]\n\nTASK [Restart server] ****************************************************************************************************************************************************************************************************************************************\nchanged: [root@45.32.129.161]\n\nTASK [Stop and remove existing Presearch containers] *********************************************************************************************************************************************************************************************************\nok: [root@45.32.129.161] =\u003e (item=presearch-node)\nok: [root@45.32.129.161] =\u003e (item=presearch-auto-updater)\n\nTASK [Start Watchtower container] ****************************************************************************************************************************************************************************************************************************\nchanged: [root@45.32.129.161]\n\nTASK [Start Presearch Node container] ************************************************************************************************************************************************************************************************************************\nchanged: [root@45.32.129.161]\n\nPLAY RECAP ***************************************************************************************************************************************************************************************************************************************************\nroot@45.32.129.161         : ok=28   changed=14   unreachable=0    failed=0    skipped=0    rescued=0    ignored=0\n```\n\n## Tags in the Playbook\n\n### In the Ansible playbook, various tasks are organized with tags. Using these tags, you can run specific sections of the playbook. Below is a description of each tag:\n\n    timezone:\n        Ensures the system timezone is set to UTC.\n\n    apt:\n        Tasks related to the APT package manager.\n        Updates and upgrades all system packages.\n        Installs additional tools such as htop, bmon, jq, etc.\n\n    ufw:\n        Firewall configurations using UFW (Uncomplicated Firewall).\n        Sets default policies, allows SSH, and ensures the firewall is enabled.\n\n    fail2ban:\n        Installs and configures fail2ban for security.\n        Configures fail2ban for permanent jailing of IP addresses that fail authentication.\n\n    grub-timeout:\n        Sets the GRUB bootloader timeout to 0 seconds for faster booting.\n\n    ntp:\n        Ensures the chrony (NTP) package is installed for time synchronization.\n        Forces immediate time synchronization and displays the NTP status.\n\n    tune-filesystem-limits:\n        Increases the system's file descriptor limits for better performance.\n\n    tune-kernel-limits:\n        Adjusts various kernel parameters using sysctl for optimized performance.\n\n    clear-journald-logs:\n        Clears all systemd journald logs.\n\n    disable-systemd-journald:\n        Masks and stops the systemd-journald service.\n\n    disable-docker-logs:\n        Configures Docker to not store logs.\n\n    bleachbit:\n        Runs the BleachBit system cleaning tool.\n\n    reboot:\n        Reboots the server to apply system changes.\n\n    presearch:\n        Manages Docker containers related to Presearch, including stopping/removing and starting them.\n\nTo run specific sections of the playbook, use the --tags option with the ansible-playbook command. For example, to only run the timezone tasks:\n\n## Run tags like reboot for example.\n\n```\nansible-playbook -i hosts.ini playbook.yml -e \"PRESEARCH_REGISTRATION_CODE=XXXXX\" --tags reboot\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F88plug%2Fpresearch-node-ansible-playbook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F88plug%2Fpresearch-node-ansible-playbook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F88plug%2Fpresearch-node-ansible-playbook/lists"}