vm-tool 1.0.2__tar.gz → 1.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vm_tool-1.0.4/PKG-INFO +97 -0
- {vm_tool-1.0.2 → vm_tool-1.0.4}/setup.py +2 -1
- vm_tool-1.0.4/vm_tool/ssh.py +53 -0
- vm_tool-1.0.4/vm_tool.egg-info/PKG-INFO +97 -0
- {vm_tool-1.0.2 → vm_tool-1.0.4}/vm_tool.egg-info/SOURCES.txt +1 -0
- {vm_tool-1.0.2 → vm_tool-1.0.4}/vm_tool.egg-info/requires.txt +1 -0
- vm_tool-1.0.2/PKG-INFO +0 -60
- vm_tool-1.0.2/vm_tool.egg-info/PKG-INFO +0 -60
- {vm_tool-1.0.2 → vm_tool-1.0.4}/LICENSE +0 -0
- {vm_tool-1.0.2 → vm_tool-1.0.4}/setup.cfg +0 -0
- {vm_tool-1.0.2 → vm_tool-1.0.4}/vm_tool/__init__.py +0 -0
- {vm_tool-1.0.2 → vm_tool-1.0.4}/vm_tool/cli.py +0 -0
- {vm_tool-1.0.2 → vm_tool-1.0.4}/vm_tool/runner.py +0 -0
- {vm_tool-1.0.2 → vm_tool-1.0.4}/vm_tool.egg-info/dependency_links.txt +0 -0
- {vm_tool-1.0.2 → vm_tool-1.0.4}/vm_tool.egg-info/entry_points.txt +0 -0
- {vm_tool-1.0.2 → vm_tool-1.0.4}/vm_tool.egg-info/top_level.txt +0 -0
vm_tool-1.0.4/PKG-INFO
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: vm_tool
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Summary: A Comprehensive Tool for Setting Up Virtual Machines Using Ansible.
|
|
5
|
+
License: MIT
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: ansible
|
|
9
|
+
Requires-Dist: ansible-runner
|
|
10
|
+
Requires-Dist: paramiko
|
|
11
|
+
Dynamic: description
|
|
12
|
+
Dynamic: description-content-type
|
|
13
|
+
Dynamic: license
|
|
14
|
+
Dynamic: requires-dist
|
|
15
|
+
Dynamic: summary
|
|
16
|
+
|
|
17
|
+
# **VM Setup Tool**
|
|
18
|
+
### **A Comprehensive Solution for Streamlining Virtual Machine Configuration with Ansible**
|
|
19
|
+
|
|
20
|
+
## **Overview**
|
|
21
|
+
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.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## **Pre-requisites**
|
|
26
|
+
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.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## **Installation**
|
|
31
|
+
Install the VM Setup Tool using **pip**, the Python package manager:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install vm-tool
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## **Example Usage**
|
|
40
|
+
|
|
41
|
+
### **Automated VM Setup**
|
|
42
|
+
Use the following example to configure and run the VM setup:
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from vm_tool.runner import SetupRunner
|
|
46
|
+
|
|
47
|
+
runner = SetupRunner(
|
|
48
|
+
github_username='your_github_username', # e.g., username
|
|
49
|
+
github_token='your_github_token', # e.g., token
|
|
50
|
+
github_project_url='your_github_project_url' # e.g., https://github.com/username/repo
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
runner.run_setup()
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### **What Happens During Setup**
|
|
57
|
+
The VM Setup Tool will:
|
|
58
|
+
1. Clone the specified GitHub repository to your local machine.
|
|
59
|
+
2. Install **Docker** if it’s not already available on the target machine.
|
|
60
|
+
3. Install **Docker Compose** for managing multi-container applications.
|
|
61
|
+
4. Create, enable, and start the Docker service.
|
|
62
|
+
5. Ensure the Docker container remains active, providing a robust environment for your applications.
|
|
63
|
+
|
|
64
|
+
By automating these tasks, the tool minimizes errors and saves time, allowing you to focus on development and deployment.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## **SSH Client Feature**
|
|
69
|
+
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.
|
|
70
|
+
|
|
71
|
+
### **Example Usage**
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from vm_tool.ssh import SSHSetup
|
|
75
|
+
|
|
76
|
+
ssh_setup = SSHSetup(
|
|
77
|
+
hostname='your_vm_hostname', # e.g., vm.example.com
|
|
78
|
+
username='your_vm_username', # e.g., user
|
|
79
|
+
password='your_vm_password', # e.g., password
|
|
80
|
+
email='your_email_for_ssh_key' # e.g., user@example.com
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
ssh_setup.setup()
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### **What Happens During SSH Setup**
|
|
87
|
+
When you run the SSH setup, the tool will:
|
|
88
|
+
1. Generate an SSH key pair if none exists.
|
|
89
|
+
2. Read the public SSH key or create a new one if necessary.
|
|
90
|
+
3. Configure the VM by adding the public key to the VM's **authorized_keys** file.
|
|
91
|
+
4. Update the local SSH configuration file with the VM's details.
|
|
92
|
+
5. Establish an SSH connection to verify the setup.
|
|
93
|
+
6. Close the connection once setup is complete.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
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.
|
|
@@ -7,7 +7,7 @@ with open(os.path.join(os.path.dirname(__file__), 'Readme.md'), encoding='utf-8'
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name='vm_tool',
|
|
10
|
-
version='1.0.
|
|
10
|
+
version='1.0.4', # This will be updated by bump2version
|
|
11
11
|
packages=find_packages(),
|
|
12
12
|
description='A Comprehensive Tool for Setting Up Virtual Machines Using Ansible.',
|
|
13
13
|
long_description=long_description,
|
|
@@ -15,6 +15,7 @@ setup(
|
|
|
15
15
|
install_requires=[
|
|
16
16
|
'ansible',
|
|
17
17
|
'ansible-runner',
|
|
18
|
+
'paramiko'
|
|
18
19
|
],
|
|
19
20
|
entry_points={
|
|
20
21
|
'console_scripts': [
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import paramiko
|
|
3
|
+
|
|
4
|
+
class SSHSetup:
|
|
5
|
+
def __init__(self, hostname, username, password, email):
|
|
6
|
+
self.hostname = hostname
|
|
7
|
+
self.username = username
|
|
8
|
+
self.password = password
|
|
9
|
+
self.email = email
|
|
10
|
+
self.private_key_path = os.path.expanduser('~/.ssh/id_rsa')
|
|
11
|
+
self.client = paramiko.SSHClient()
|
|
12
|
+
self.client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
13
|
+
|
|
14
|
+
def _generate_ssh_key(self, email):
|
|
15
|
+
os.system(f'ssh-keygen -t rsa -b 4096 -C "{email}"')
|
|
16
|
+
|
|
17
|
+
def _read_or_generate_public_key(self, email):
|
|
18
|
+
public_key_path = f'{self.private_key_path}.pub'
|
|
19
|
+
if not os.path.exists(public_key_path):
|
|
20
|
+
self._generate_ssh_key(email)
|
|
21
|
+
with open(public_key_path, 'r') as file:
|
|
22
|
+
return file.read()
|
|
23
|
+
|
|
24
|
+
def _configure_vm(self, vm_ip, vm_password, public_key):
|
|
25
|
+
self.client.connect(vm_ip, username=self.username, password=vm_password)
|
|
26
|
+
self.client.exec_command(f'echo "{public_key}" >> ~/.ssh/authorized_keys')
|
|
27
|
+
self.client.close()
|
|
28
|
+
|
|
29
|
+
def _update_ssh_config(self):
|
|
30
|
+
config = f"""
|
|
31
|
+
Host {self.hostname}
|
|
32
|
+
HostName {self.hostname}
|
|
33
|
+
User {self.username}
|
|
34
|
+
StrictHostKeyChecking no
|
|
35
|
+
IdentityFile {self.private_key_path}
|
|
36
|
+
ForwardAgent yes
|
|
37
|
+
"""
|
|
38
|
+
with open(f'{os.path.expanduser("~")}/.ssh/config', 'a') as file:
|
|
39
|
+
file.write(config)
|
|
40
|
+
|
|
41
|
+
def _establish_connection(self):
|
|
42
|
+
self.client.connect(self.hostname, username=self.username, key_filename=self.private_key_path)
|
|
43
|
+
|
|
44
|
+
def _close_connection(self):
|
|
45
|
+
if self.client:
|
|
46
|
+
self.client.close()
|
|
47
|
+
|
|
48
|
+
def setup(self):
|
|
49
|
+
public_key = self._read_or_generate_public_key(self.email)
|
|
50
|
+
self._configure_vm(self.hostname, self.password, public_key)
|
|
51
|
+
self._update_ssh_config()
|
|
52
|
+
self._establish_connection()
|
|
53
|
+
self._close_connection()
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: vm_tool
|
|
3
|
+
Version: 1.0.4
|
|
4
|
+
Summary: A Comprehensive Tool for Setting Up Virtual Machines Using Ansible.
|
|
5
|
+
License: MIT
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: ansible
|
|
9
|
+
Requires-Dist: ansible-runner
|
|
10
|
+
Requires-Dist: paramiko
|
|
11
|
+
Dynamic: description
|
|
12
|
+
Dynamic: description-content-type
|
|
13
|
+
Dynamic: license
|
|
14
|
+
Dynamic: requires-dist
|
|
15
|
+
Dynamic: summary
|
|
16
|
+
|
|
17
|
+
# **VM Setup Tool**
|
|
18
|
+
### **A Comprehensive Solution for Streamlining Virtual Machine Configuration with Ansible**
|
|
19
|
+
|
|
20
|
+
## **Overview**
|
|
21
|
+
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.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## **Pre-requisites**
|
|
26
|
+
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.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## **Installation**
|
|
31
|
+
Install the VM Setup Tool using **pip**, the Python package manager:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install vm-tool
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## **Example Usage**
|
|
40
|
+
|
|
41
|
+
### **Automated VM Setup**
|
|
42
|
+
Use the following example to configure and run the VM setup:
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from vm_tool.runner import SetupRunner
|
|
46
|
+
|
|
47
|
+
runner = SetupRunner(
|
|
48
|
+
github_username='your_github_username', # e.g., username
|
|
49
|
+
github_token='your_github_token', # e.g., token
|
|
50
|
+
github_project_url='your_github_project_url' # e.g., https://github.com/username/repo
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
runner.run_setup()
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### **What Happens During Setup**
|
|
57
|
+
The VM Setup Tool will:
|
|
58
|
+
1. Clone the specified GitHub repository to your local machine.
|
|
59
|
+
2. Install **Docker** if it’s not already available on the target machine.
|
|
60
|
+
3. Install **Docker Compose** for managing multi-container applications.
|
|
61
|
+
4. Create, enable, and start the Docker service.
|
|
62
|
+
5. Ensure the Docker container remains active, providing a robust environment for your applications.
|
|
63
|
+
|
|
64
|
+
By automating these tasks, the tool minimizes errors and saves time, allowing you to focus on development and deployment.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## **SSH Client Feature**
|
|
69
|
+
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.
|
|
70
|
+
|
|
71
|
+
### **Example Usage**
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from vm_tool.ssh import SSHSetup
|
|
75
|
+
|
|
76
|
+
ssh_setup = SSHSetup(
|
|
77
|
+
hostname='your_vm_hostname', # e.g., vm.example.com
|
|
78
|
+
username='your_vm_username', # e.g., user
|
|
79
|
+
password='your_vm_password', # e.g., password
|
|
80
|
+
email='your_email_for_ssh_key' # e.g., user@example.com
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
ssh_setup.setup()
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### **What Happens During SSH Setup**
|
|
87
|
+
When you run the SSH setup, the tool will:
|
|
88
|
+
1. Generate an SSH key pair if none exists.
|
|
89
|
+
2. Read the public SSH key or create a new one if necessary.
|
|
90
|
+
3. Configure the VM by adding the public key to the VM's **authorized_keys** file.
|
|
91
|
+
4. Update the local SSH configuration file with the VM's details.
|
|
92
|
+
5. Establish an SSH connection to verify the setup.
|
|
93
|
+
6. Close the connection once setup is complete.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
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.
|
vm_tool-1.0.2/PKG-INFO
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.2
|
|
2
|
-
Name: vm_tool
|
|
3
|
-
Version: 1.0.2
|
|
4
|
-
Summary: A Comprehensive Tool for Setting Up Virtual Machines Using Ansible.
|
|
5
|
-
License: MIT
|
|
6
|
-
Description-Content-Type: text/markdown
|
|
7
|
-
License-File: LICENSE
|
|
8
|
-
Requires-Dist: ansible
|
|
9
|
-
Requires-Dist: ansible-runner
|
|
10
|
-
Dynamic: description
|
|
11
|
-
Dynamic: description-content-type
|
|
12
|
-
Dynamic: license
|
|
13
|
-
Dynamic: requires-dist
|
|
14
|
-
Dynamic: summary
|
|
15
|
-
|
|
16
|
-
# VM Setup Tool
|
|
17
|
-
|
|
18
|
-
### A Comprehensive Tool for Setting Up Virtual Machines Using Ansible
|
|
19
|
-
|
|
20
|
-
## Overview
|
|
21
|
-
|
|
22
|
-
The VM Setup Tool is designed to simplify the process of setting up virtual machines (VMs) using Ansible. This tool is particularly useful for automating the deployment and configuration of VMs, ensuring consistency and efficiency across your infrastructure.
|
|
23
|
-
|
|
24
|
-
## Pre-requisites
|
|
25
|
-
|
|
26
|
-
Currently, the tool supports projects that use Docker Compose. Ensure you have a `docker-compose.yml` file at the root level of your project.
|
|
27
|
-
|
|
28
|
-
## Installation
|
|
29
|
-
|
|
30
|
-
To install the VM Setup Tool, you can use pip, the Python package installer. Run the following command in your terminal:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
pip install vm-tool
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Example Usage
|
|
37
|
-
|
|
38
|
-
```python
|
|
39
|
-
from vm_tool import SetupRunner
|
|
40
|
-
|
|
41
|
-
runner = SetupRunner(
|
|
42
|
-
github_username='your_github_username', # e.g. username
|
|
43
|
-
github_token='your_github_token', # e.g. token
|
|
44
|
-
github_project_url='your_github_project_url' # e.g. https://github.com/username/repo
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
runner.run_setup()
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## What This Will Do
|
|
51
|
-
|
|
52
|
-
### When you run the setup, the VM Setup Tool will perform the following actions:
|
|
53
|
-
|
|
54
|
-
- Clone the specified GitHub repository to your local machine.
|
|
55
|
-
- Install Docker on the target machine if it is not already installed.
|
|
56
|
-
- Install Docker Compose to manage multi-container Docker applications.
|
|
57
|
-
- Create, enable, and start a Docker service on the machine.
|
|
58
|
-
- Ensure that the Docker container remains up and running, providing a stable environment for your applications.
|
|
59
|
-
|
|
60
|
-
By automating these steps, the VM Setup Tool helps you save time and reduce the potential for errors, allowing you to focus on developing and deploying your applications.
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.2
|
|
2
|
-
Name: vm_tool
|
|
3
|
-
Version: 1.0.2
|
|
4
|
-
Summary: A Comprehensive Tool for Setting Up Virtual Machines Using Ansible.
|
|
5
|
-
License: MIT
|
|
6
|
-
Description-Content-Type: text/markdown
|
|
7
|
-
License-File: LICENSE
|
|
8
|
-
Requires-Dist: ansible
|
|
9
|
-
Requires-Dist: ansible-runner
|
|
10
|
-
Dynamic: description
|
|
11
|
-
Dynamic: description-content-type
|
|
12
|
-
Dynamic: license
|
|
13
|
-
Dynamic: requires-dist
|
|
14
|
-
Dynamic: summary
|
|
15
|
-
|
|
16
|
-
# VM Setup Tool
|
|
17
|
-
|
|
18
|
-
### A Comprehensive Tool for Setting Up Virtual Machines Using Ansible
|
|
19
|
-
|
|
20
|
-
## Overview
|
|
21
|
-
|
|
22
|
-
The VM Setup Tool is designed to simplify the process of setting up virtual machines (VMs) using Ansible. This tool is particularly useful for automating the deployment and configuration of VMs, ensuring consistency and efficiency across your infrastructure.
|
|
23
|
-
|
|
24
|
-
## Pre-requisites
|
|
25
|
-
|
|
26
|
-
Currently, the tool supports projects that use Docker Compose. Ensure you have a `docker-compose.yml` file at the root level of your project.
|
|
27
|
-
|
|
28
|
-
## Installation
|
|
29
|
-
|
|
30
|
-
To install the VM Setup Tool, you can use pip, the Python package installer. Run the following command in your terminal:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
pip install vm-tool
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Example Usage
|
|
37
|
-
|
|
38
|
-
```python
|
|
39
|
-
from vm_tool import SetupRunner
|
|
40
|
-
|
|
41
|
-
runner = SetupRunner(
|
|
42
|
-
github_username='your_github_username', # e.g. username
|
|
43
|
-
github_token='your_github_token', # e.g. token
|
|
44
|
-
github_project_url='your_github_project_url' # e.g. https://github.com/username/repo
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
runner.run_setup()
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## What This Will Do
|
|
51
|
-
|
|
52
|
-
### When you run the setup, the VM Setup Tool will perform the following actions:
|
|
53
|
-
|
|
54
|
-
- Clone the specified GitHub repository to your local machine.
|
|
55
|
-
- Install Docker on the target machine if it is not already installed.
|
|
56
|
-
- Install Docker Compose to manage multi-container Docker applications.
|
|
57
|
-
- Create, enable, and start a Docker service on the machine.
|
|
58
|
-
- Ensure that the Docker container remains up and running, providing a stable environment for your applications.
|
|
59
|
-
|
|
60
|
-
By automating these steps, the VM Setup Tool helps you save time and reduce the potential for errors, allowing you to focus on developing and deploying your applications.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|