vm-tool 1.0__tar.gz → 1.0.2__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.2/PKG-INFO +60 -0
- vm_tool-1.0.2/setup.py +25 -0
- vm_tool-1.0.2/vm_tool/runner.py +46 -0
- vm_tool-1.0.2/vm_tool.egg-info/PKG-INFO +60 -0
- {vm_tool-1.0 → vm_tool-1.0.2}/vm_tool.egg-info/SOURCES.txt +0 -1
- vm_tool-1.0/PKG-INFO +0 -34
- vm_tool-1.0/README.md +0 -28
- vm_tool-1.0/setup.py +0 -38
- vm_tool-1.0/vm_tool/runner.py +0 -36
- vm_tool-1.0/vm_tool.egg-info/PKG-INFO +0 -34
- {vm_tool-1.0 → vm_tool-1.0.2}/LICENSE +0 -0
- {vm_tool-1.0 → vm_tool-1.0.2}/setup.cfg +0 -0
- {vm_tool-1.0 → vm_tool-1.0.2}/vm_tool/__init__.py +0 -0
- {vm_tool-1.0 → vm_tool-1.0.2}/vm_tool/cli.py +0 -0
- {vm_tool-1.0 → vm_tool-1.0.2}/vm_tool.egg-info/dependency_links.txt +0 -0
- {vm_tool-1.0 → vm_tool-1.0.2}/vm_tool.egg-info/entry_points.txt +0 -0
- {vm_tool-1.0 → vm_tool-1.0.2}/vm_tool.egg-info/requires.txt +0 -0
- {vm_tool-1.0 → vm_tool-1.0.2}/vm_tool.egg-info/top_level.txt +0 -0
vm_tool-1.0.2/PKG-INFO
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
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.
|
vm_tool-1.0.2/setup.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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.2', # 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
|
+
],
|
|
19
|
+
entry_points={
|
|
20
|
+
'console_scripts': [
|
|
21
|
+
'vm_tool=vm_tool.cli:main',
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
license='MIT',
|
|
25
|
+
)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import ansible_runner
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
class SetupRunner:
|
|
6
|
+
def __init__(self, github_username, github_token, github_project_url):
|
|
7
|
+
self.github_username = github_username
|
|
8
|
+
self.github_token = github_token
|
|
9
|
+
self.github_project_url = github_project_url
|
|
10
|
+
|
|
11
|
+
def run_setup(self):
|
|
12
|
+
# Construct extravars dictionary
|
|
13
|
+
extravars = {
|
|
14
|
+
'GITHUB_USERNAME': self.github_username,
|
|
15
|
+
'GITHUB_TOKEN': self.github_token,
|
|
16
|
+
'GITHUB_PROJECT_URL': self.github_project_url
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
# Get the current directory of this script
|
|
20
|
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
21
|
+
|
|
22
|
+
# Get the virtual environment directory
|
|
23
|
+
venv_dir = os.path.join(sys.prefix, 'ansible_runner_data')
|
|
24
|
+
|
|
25
|
+
# Ensure the directory exists
|
|
26
|
+
os.makedirs(venv_dir, exist_ok=True)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# Construct dynamic paths
|
|
30
|
+
playbook_path = os.path.join(current_dir, 'vm_setup', 'setup.yml')
|
|
31
|
+
inventory_path = os.path.join(current_dir, 'vm_setup', 'inventory.yml')
|
|
32
|
+
|
|
33
|
+
try:
|
|
34
|
+
# Run the Ansible playbook using ansible-runner
|
|
35
|
+
r = ansible_runner.run(
|
|
36
|
+
private_data_dir=venv_dir,
|
|
37
|
+
playbook=playbook_path,
|
|
38
|
+
inventory=inventory_path,
|
|
39
|
+
extravars=extravars
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
if r.rc != 0:
|
|
43
|
+
raise RuntimeError(f"Ansible playbook execution failed with return code {r.rc}: {r.stdout}")
|
|
44
|
+
|
|
45
|
+
except Exception as e:
|
|
46
|
+
raise RuntimeError(f"An error occurred while running the Ansible playbook: {str(e)}")
|
|
@@ -0,0 +1,60 @@
|
|
|
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.
|
vm_tool-1.0/PKG-INFO
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.2
|
|
2
|
-
Name: vm_tool
|
|
3
|
-
Version: 1.0
|
|
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 import SetupRunner
|
|
22
|
-
|
|
23
|
-
runner = SetupRunner(
|
|
24
|
-
ssh_host='your_host', # e.g. 192.168.1.1
|
|
25
|
-
ssh_user='your_user', # e.g. root
|
|
26
|
-
ssh_password='your_password', # e.g. password
|
|
27
|
-
become_pass='your_become_pass', # e.g. password
|
|
28
|
-
github_username='your_github_username', # e.g. username
|
|
29
|
-
github_token='your_github_token', # e.g. token
|
|
30
|
-
github_project_url='your_github_project_url' # e.g. https://github.com/username/repo
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
runner.run_setup()
|
|
34
|
-
|
vm_tool-1.0/README.md
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
### Welcome to initial setup of the application
|
|
2
|
-
|
|
3
|
-
1. Connect to deployment machine using VSCode.
|
|
4
|
-
|
|
5
|
-
2. Run the following command to install the package and its dependencies:
|
|
6
|
-
```bash
|
|
7
|
-
pip install .
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
### This is a tool to setup VMs using Ansible.
|
|
11
|
-
|
|
12
|
-
## Example usage:
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
from vm_tool import SetupRunner
|
|
16
|
-
|
|
17
|
-
runner = SetupRunner(
|
|
18
|
-
ssh_host='your_host', # e.g. 192.168.1.1
|
|
19
|
-
ssh_user='your_user', # e.g. root
|
|
20
|
-
ssh_password='your_password', # e.g. password
|
|
21
|
-
become_pass='your_become_pass', # e.g. password
|
|
22
|
-
github_username='your_github_username', # e.g. username
|
|
23
|
-
github_token='your_github_token', # e.g. token
|
|
24
|
-
github_project_url='your_github_project_url' # e.g. https://github.com/username/repo
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
runner.run_setup()
|
|
28
|
-
```
|
vm_tool-1.0/setup.py
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
from setuptools import setup, find_packages
|
|
2
|
-
|
|
3
|
-
setup(
|
|
4
|
-
name='vm_tool',
|
|
5
|
-
version='1.0',
|
|
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 import SetupRunner
|
|
14
|
-
|
|
15
|
-
runner = SetupRunner(
|
|
16
|
-
ssh_host='your_host', # e.g. 192.168.1.1
|
|
17
|
-
ssh_user='your_user', # e.g. root
|
|
18
|
-
ssh_password='your_password', # e.g. password
|
|
19
|
-
become_pass='your_become_pass', # e.g. password
|
|
20
|
-
github_username='your_github_username', # e.g. username
|
|
21
|
-
github_token='your_github_token', # e.g. token
|
|
22
|
-
github_project_url='your_github_project_url' # e.g. https://github.com/username/repo
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
runner.run_setup()
|
|
26
|
-
''',
|
|
27
|
-
long_description_content_type='text/markdown',
|
|
28
|
-
install_requires=[
|
|
29
|
-
'ansible',
|
|
30
|
-
'ansible-runner',
|
|
31
|
-
],
|
|
32
|
-
entry_points={
|
|
33
|
-
'console_scripts': [
|
|
34
|
-
'vm_tool=vm_tool.cli:main',
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
license='MIT',
|
|
38
|
-
)
|
vm_tool-1.0/vm_tool/runner.py
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import ansible_runner
|
|
2
|
-
|
|
3
|
-
class SetupRunner:
|
|
4
|
-
def __init__(self, ssh_host, ssh_user, ssh_password, become_pass, github_username, github_token, github_project_url):
|
|
5
|
-
self.ssh_host = ssh_host
|
|
6
|
-
self.ssh_user = ssh_user
|
|
7
|
-
self.ssh_password = ssh_password
|
|
8
|
-
self.become_pass = become_pass
|
|
9
|
-
self.github_username = github_username
|
|
10
|
-
self.github_token = github_token
|
|
11
|
-
self.github_project_url = github_project_url
|
|
12
|
-
|
|
13
|
-
def run_setup(self):
|
|
14
|
-
# Construct extravars dictionary
|
|
15
|
-
extravars = {
|
|
16
|
-
'ANSIBLE_SSH_HOST': self.ssh_host,
|
|
17
|
-
'ANSIBLE_SSH_USER': self.ssh_user,
|
|
18
|
-
'ANSIBLE_SSH_PASS': self.ssh_password,
|
|
19
|
-
'ANSIBLE_BECOME_PASS': self.become_pass,
|
|
20
|
-
'GITHUB_USERNAME': self.github_username,
|
|
21
|
-
'GITHUB_TOKEN': self.github_token,
|
|
22
|
-
'GITHUB_PROJECT_URL': self.github_project_url
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
# Run the Ansible playbook using ansible-runner
|
|
26
|
-
r = ansible_runner.run(
|
|
27
|
-
private_data_dir='.',
|
|
28
|
-
playbook='vm_tool/vm_setup/setup.yml',
|
|
29
|
-
inventory='vm_tool/vm_setup/inventory.yml',
|
|
30
|
-
extravars=extravars
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
if r.rc != 0:
|
|
34
|
-
raise RuntimeError(f"Ansible playbook execution failed: {r.stdout}")
|
|
35
|
-
|
|
36
|
-
print(r.stdout)
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.2
|
|
2
|
-
Name: vm_tool
|
|
3
|
-
Version: 1.0
|
|
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 import SetupRunner
|
|
22
|
-
|
|
23
|
-
runner = SetupRunner(
|
|
24
|
-
ssh_host='your_host', # e.g. 192.168.1.1
|
|
25
|
-
ssh_user='your_user', # e.g. root
|
|
26
|
-
ssh_password='your_password', # e.g. password
|
|
27
|
-
become_pass='your_become_pass', # e.g. password
|
|
28
|
-
github_username='your_github_username', # e.g. username
|
|
29
|
-
github_token='your_github_token', # e.g. token
|
|
30
|
-
github_project_url='your_github_project_url' # e.g. https://github.com/username/repo
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
runner.run_setup()
|
|
34
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|