vm-tool 0.5__tar.gz → 0.7__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: vm_tool
3
- Version: 0.5
3
+ Version: 0.7
4
4
  Summary: A tool to setup VMs using Ansible.
5
5
  License: MIT
6
6
  Description-Content-Type: text/markdown
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='vm_tool',
5
- version='0.5',
5
+ version='0.7',
6
6
  packages=find_packages(),
7
7
  description='A tool to setup VMs using Ansible.',
8
8
  long_description='''
File without changes
@@ -0,0 +1,36 @@
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,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: vm_tool
3
- Version: 0.5
3
+ Version: 0.7
4
4
  Summary: A tool to setup VMs using Ansible.
5
5
  License: MIT
6
6
  Description-Content-Type: text/markdown
@@ -3,6 +3,7 @@ README.md
3
3
  setup.py
4
4
  vm_tool/__init__.py
5
5
  vm_tool/cli.py
6
+ vm_tool/runner.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 +0,0 @@
1
- from .src.setup_runner import SetupRunner
File without changes
File without changes
File without changes
File without changes