Skip to main content

A Comprehensive Tool for Setting Up Virtual Machines.

Project description

VM Setup Tool

A Comprehensive Solution for Streamlining Virtual Machine Configuration

Overview

The VM Setup Tool is an efficient, user-friendly solution designed to simplify the process of setting up and managing virtual machines (VMs) using Ansible. Ideal for automating VM deployment and configuration, this tool ensures consistency and enhances operational efficiency across your infrastructure.


Pre-requisites

This tool supports projects utilizing Docker Compose. Ensure that a docker-compose.yml file is present at the root of your project directory before proceeding.


Installation

Install the VM Setup Tool using pip, the Python package manager:

pip install vm-tool

Example Usage

Automated VM Setup

Use the following example to configure and run the VM setup:

from vm_tool.runner import SetupRunner

runner = SetupRunner(
    github_username='your_github_username',  # e.g., username
    github_token='your_github_token',        # e.g., token
    github_project_url='your_github_project_url',  # e.g., https://github.com/username/repo
    docker_compose_file_path='path_to_your_docker_compose_file'  # Optional, defaults to 'docker-compose.yml' e.g. backend/docker-compose.prod.yml
)

runner.run_setup()

What Happens During Setup

The VM Setup Tool will:

  1. Clone the specified GitHub repository to your local machine.
  2. Install Docker if it’s not already available on the target machine.
  3. Install Docker Compose for managing multi-container applications.
  4. Create, enable, and start the Docker service.
  5. Ensure the Docker container remains active, providing a robust environment for your applications.

By automating these tasks, the tool minimizes errors and saves time, allowing you to focus on development and deployment.


Cloud Setup

The VM Setup Tool also supports cloud setup for VMs. Use the following example to configure and run the cloud setup:

from vm_tool.runner import SetupRunner

runner = SetupRunner(
    github_username='your_github_username',  # e.g., username
    github_token='your_github_token',        # e.g., token
    github_project_url='your_github_project_url',  # e.g., https://github.com/username/repo
    docker_compose_file_path='path_to_your_docker_compose_file'  # Optional, defaults to 'docker-compose.yml' e.g. backend/docker-compose.prod.yml
)

runner.run_cloud_setup(
    ssh_username='your_ssh_username',        # e.g., ssh_user
    ssh_password='your_ssh_password',        # e.g., ssh_password
    ssh_hostname='your_ssh_hostname'         # e.g., ssh.example.com
)

What Happens During Cloud Setup

When you run the cloud setup, the tool will:

  1. Connect to the specified cloud VM using SSH.
  2. Clone the specified GitHub repository to the VM.
  3. Install Docker if it’s not already available on the VM.
  4. Install Docker Compose for managing multi-container applications.
  5. Create, enable, and start the Docker service on the VM.
  6. Ensure the Docker container remains active, providing a robust environment for your applications.

SSH Client Feature

The VM Setup Tool also includes a dedicated SSH client feature to simplify the configuration of SSH access for VMs, including automated SSH key generation and management.

Example Usage

from vm_tool.ssh import SSHSetup

ssh_setup = SSHSetup(
    hostname='your_vm_hostname',  # e.g., vm.example.com
    username='your_vm_username',  # e.g., user
    password='your_vm_password',  # e.g., password
    email='your_email_for_ssh_key'  # e.g., user@example.com
)

ssh_setup.setup()

What Happens During SSH Setup

When you run the SSH setup, the tool will:

  1. Generate an SSH key pair if none exists.
  2. Read the public SSH key or create a new one if necessary.
  3. Configure the VM by adding the public key to the VM's authorized_keys file.
  4. Update the local SSH configuration file with the VM's details.
  5. Establish an SSH connection to verify the setup.
  6. Close the connection once setup is complete.

With its comprehensive features, the VM Setup Tool eliminates the hassle of manual configurations and enables seamless integration of VMs into your workflows. Start using the tool today to automate and optimize your virtual machine setup process.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vm_tool-1.0.18.tar.gz (10.2 kB view details)

Uploaded Source

File details

Details for the file vm_tool-1.0.18.tar.gz.

File metadata

  • Download URL: vm_tool-1.0.18.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for vm_tool-1.0.18.tar.gz
Algorithm Hash digest
SHA256 41085b98b0e77b1d2df0f21184ad49117322872512b307564454cc03cbc10784
MD5 d3945504871587dc11c2872f8697def8
BLAKE2b-256 016b89c4c115f3b0bcd7113b5f4e9515e99728d2a18118205148c415be80a73c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page