vm-tool 1.0.1__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 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.
vm_tool-1.0.4/setup.py ADDED
@@ -0,0 +1,26 @@
1
+ from setuptools import setup, find_packages
2
+ import os
3
+
4
+ # Read the contents of README.md
5
+ with open(os.path.join(os.path.dirname(__file__), 'Readme.md'), encoding='utf-8') as f:
6
+ long_description = f.read()
7
+
8
+ setup(
9
+ name='vm_tool',
10
+ version='1.0.4', # This will be updated by bump2version
11
+ packages=find_packages(),
12
+ description='A Comprehensive Tool for Setting Up Virtual Machines Using Ansible.',
13
+ long_description=long_description,
14
+ long_description_content_type='text/markdown',
15
+ install_requires=[
16
+ 'ansible',
17
+ 'ansible-runner',
18
+ 'paramiko'
19
+ ],
20
+ entry_points={
21
+ 'console_scripts': [
22
+ 'vm_tool=vm_tool.cli:main',
23
+ ],
24
+ },
25
+ license='MIT',
26
+ )
@@ -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.
@@ -3,6 +3,7 @@ setup.py
3
3
  vm_tool/__init__.py
4
4
  vm_tool/cli.py
5
5
  vm_tool/runner.py
6
+ vm_tool/ssh.py
6
7
  vm_tool.egg-info/PKG-INFO
7
8
  vm_tool.egg-info/SOURCES.txt
8
9
  vm_tool.egg-info/dependency_links.txt
@@ -1,2 +1,3 @@
1
1
  ansible
2
2
  ansible-runner
3
+ paramiko
vm_tool-1.0.1/PKG-INFO DELETED
@@ -1,30 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: vm_tool
3
- Version: 1.0.1
4
- Summary: A tool to setup VMs 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
-
17
- This is a tool to setup VMs using Ansible.
18
-
19
- Example usage:
20
-
21
- from vm_tool.runner import SetupRunner
22
-
23
- runner = SetupRunner(
24
- github_username='your_github_username', # e.g. username
25
- github_token='your_github_token', # e.g. token
26
- github_project_url='your_github_project_url' # e.g. https://github.com/username/repo
27
- )
28
-
29
- runner.run_setup()
30
-
vm_tool-1.0.1/setup.py DELETED
@@ -1,34 +0,0 @@
1
- from setuptools import setup, find_packages
2
-
3
- setup(
4
- name='vm_tool',
5
- version='1.0.1', # This will be updated by bump2version
6
- packages=find_packages(),
7
- description='A tool to setup VMs using Ansible.',
8
- long_description='''
9
- This is a tool to setup VMs using Ansible.
10
-
11
- Example usage:
12
-
13
- from vm_tool.runner import SetupRunner
14
-
15
- runner = SetupRunner(
16
- github_username='your_github_username', # e.g. username
17
- github_token='your_github_token', # e.g. token
18
- github_project_url='your_github_project_url' # e.g. https://github.com/username/repo
19
- )
20
-
21
- runner.run_setup()
22
- ''',
23
- long_description_content_type='text/markdown',
24
- install_requires=[
25
- 'ansible',
26
- 'ansible-runner',
27
- ],
28
- entry_points={
29
- 'console_scripts': [
30
- 'vm_tool=vm_tool.cli:main',
31
- ],
32
- },
33
- license='MIT',
34
- )
@@ -1,30 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: vm_tool
3
- Version: 1.0.1
4
- Summary: A tool to setup VMs 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
-
17
- This is a tool to setup VMs using Ansible.
18
-
19
- Example usage:
20
-
21
- from vm_tool.runner import SetupRunner
22
-
23
- runner = SetupRunner(
24
- github_username='your_github_username', # e.g. username
25
- github_token='your_github_token', # e.g. token
26
- github_project_url='your_github_project_url' # e.g. https://github.com/username/repo
27
- )
28
-
29
- runner.run_setup()
30
-
File without changes
File without changes
File without changes
File without changes
File without changes