{"id":25685667,"url":"https://github.com/iambotcoder/vagrant-remote-vm-automation","last_synced_at":"2025-08-10T14:09:56.032Z","repository":{"id":279037506,"uuid":"937545404","full_name":"iambotcoder/vagrant-remote-vm-automation","owner":"iambotcoder","description":"provisioning and remote command execution using Vagrant and SSH.","archived":false,"fork":false,"pushed_at":"2025-02-23T10:33:42.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-03T15:38:09.646Z","etag":null,"topics":["automation","devops","linux","remote-access","ssh","vagrant","virtualbox"],"latest_commit_sha":null,"homepage":"","language":null,"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/iambotcoder.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,"zenodo":null}},"created_at":"2025-02-23T10:25:37.000Z","updated_at":"2025-02-23T10:33:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"b96f95e1-3f14-478c-ba7e-a686d8178b42","html_url":"https://github.com/iambotcoder/vagrant-remote-vm-automation","commit_stats":null,"previous_names":["iambotcoder/vagrant-remote-vm-automation"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iambotcoder/vagrant-remote-vm-automation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iambotcoder%2Fvagrant-remote-vm-automation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iambotcoder%2Fvagrant-remote-vm-automation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iambotcoder%2Fvagrant-remote-vm-automation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iambotcoder%2Fvagrant-remote-vm-automation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iambotcoder","download_url":"https://codeload.github.com/iambotcoder/vagrant-remote-vm-automation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iambotcoder%2Fvagrant-remote-vm-automation/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269734149,"owners_count":24466554,"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","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["automation","devops","linux","remote-access","ssh","vagrant","virtualbox"],"created_at":"2025-02-24T18:57:06.560Z","updated_at":"2025-08-10T14:09:56.024Z","avatar_url":"https://github.com/iambotcoder.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Vagrant Virtual Machine Automation - Multi-VM Setup\n\n---\n\n## 📖 Overview\nThis project automates the setup of multiple virtual machines using Vagrant and VirtualBox. The setup includes a **scriptbox** VM and three web servers (**web01, web02, web03**) with SSH-based authentication and remote access configurations.\n\n---\n\n## 📑 Table of Contents\n- [Prerequisites](#-prerequisites) 🔑\n- [Architecture](#-architecture) 🗺️\n- [Setup \u0026 Installation](#-setup-and-installation) 🛠️\n- [Vagrant Setup](#-vagrant-setup) 🐳\n- [Key-Based Authentication](#-key-based-authentication) 🔑\n- [Cleaning Up Resources](#-cleaning-up-resources) 🧹\n- [Conclusion](#-conclusion) ✅\n\n---\n\n## 🔑 Prerequisites\nBefore starting, ensure you have the following installed:\n\n- [Vagrant](https://www.vagrantup.com/downloads)\n- [VirtualBox](https://www.virtualbox.org/wiki/Downloads)\n- A terminal or command prompt with administrative privileges\n\n---\n\n## 🗺️ Architecture\nThis project sets up four virtual machines with the following specifications:\n\n- **scriptbox (192.168.10.12)** - Controls remote access to web servers.\n- **web01 (192.168.10.13)** - Web server 1 (CentOS Stream 9)\n- **web02 (192.168.10.14)** - Web server 2 (CentOS Stream 9)\n- **web03 (192.168.10.15)** - Web server 3 (Ubuntu Jammy 64-bit)\n\n### Workflow:\n1. **Initialize Vagrant** – Start the VMs.\n2. **Modify /etc/hosts** – Map hostnames to IPs.\n3. **Create Users \u0026 Grant Sudo Access** – Add `devops` user with password-less sudo.\n4. **Setup SSH Key Authentication** – Enable key-based access for `devops` user.\n5. **Verify Remote Access** – SSH into the web servers from `scriptbox`.\n\n---\n\n## 🛠️ Setup \u0026 Installation\n\n### 1⃣ Initialize Vagrant:\n```bash\nvagrant up\n```\n\n### 2⃣ Modify `/etc/hosts` on scriptbox:\n```bash\nsudo vim /etc/hosts\n```\nAdd the following lines:\n```plaintext\n192.168.10.13 web01  \n192.168.10.14 web02  \n192.168.10.15 web03  \n```\n\n### 3⃣ Create `devops` User \u0026 Grant Sudo Access\nFor each web server, execute:\n```bash\nssh vagrant@web01\nsudo useradd devops\nsudo passwd devops\nsudo visudo\n- devops ALL=(ALL) NOPASSWD: ALL (add the line in configuration file.)  \n```\nRepeat for `web02` and `web03`.\n\n### 4⃣ Resolve SSH Issues for `web03`\nEdit `/etc/ssh/sshd_config` on `web03`:\n```bash\nsudo vim /etc/ssh/sshd_config\n```\nModify this line:\n```plaintext\nPasswordAuthentication yes\n```\nRestart SSH service:\n```bash\nsudo systemctl restart sshd\n```\nAlternatively, modify the `Vagrantfile`:\n```ruby\nweb03.ssh.insert_key = false\n```\n\n---\n\n## 🐳 Vagrant Setup\nBelow is the `Vagrantfile` used for this project:\n```ruby\nVagrant.configure(\"2\") do |config|\n  config.vm.define \"scriptbox\" do |scriptbox|\n    scriptbox.vm.box = \"eurolinux-vagrant/centos-stream-9\"\n    scriptbox.vm.network \"private_network\", ip: \"192.168.10.12\"\n    scriptbox.vm.hostname = \"scriptbox\"\n    scriptbox.vm.provider \"virtualbox\" do |vb|\n      vb.memory = \"1024\"\n    end\n  end\n\n  config.vm.define \"web01\" do |web01|\n    web01.vm.box = \"eurolinux-vagrant/centos-stream-9\"\n    web01.vm.network \"private_network\", ip: \"192.168.10.13\"\n    web01.vm.hostname = \"web01\"\n  end\n  \n  config.vm.define \"web02\" do |web02|\n    web02.vm.box = \"eurolinux-vagrant/centos-stream-9\"\n    web02.vm.network \"private_network\", ip: \"192.168.10.14\"\n    web02.vm.hostname = \"web02\"\n  end\n\n  config.vm.define \"web03\" do |web03|\n    web03.vm.box = \"ubuntu/jammy64\"\n    web03.vm.network \"private_network\", ip: \"192.168.10.15\"\n    web03.vm.hostname = \"web03\"\n    web03.ssh.insert_key = false\n  end\nend\n```\n\n---\n\n## 🔑 Key-Based Authentication\n### 1⃣ Generate SSH Key:\n```bash\nssh-keygen\n```\n### 2⃣ Copy Public Key to Web Servers:\n```bash\nssh-copy-id devops@web01\nssh-copy-id devops@web02\nssh-copy-id devops@web03\n```\n### 3⃣ Test SSH Access Without Password:\n```bash\nssh devops@web01 uptime\nssh devops@web02 uptime\nssh devops@web03 uptime\n```\n\n---\n\n## 🧹 Cleaning Up Resources\n\nTo remove the VMs and free up system resources:\n\n### 1⃣ Destroy the Virtual Machines:\n```bash\nvagrant destroy -f\n```\n### 2⃣ Remove Unused Vagrant Instances:\n```bash\nvagrant global-status --prune\n```\n\n---\n\n## ✅ Conclusion\nThis project automates the setup of multiple VMs using Vagrant and VirtualBox, configuring remote SSH access and key-based authentication for easy management.\n\n---\n\n## 👨‍🏫 Instructor\nThis project was guided by **Imran Teli**, who provided valuable mentorship throughout the process.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiambotcoder%2Fvagrant-remote-vm-automation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiambotcoder%2Fvagrant-remote-vm-automation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiambotcoder%2Fvagrant-remote-vm-automation/lists"}