vm-tool 1.0.16__tar.gz → 1.0.18__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.
Files changed (24) hide show
  1. {vm_tool-1.0.16/vm_tool.egg-info → vm_tool-1.0.18}/PKG-INFO +32 -3
  2. {vm_tool-1.0.16 → vm_tool-1.0.18}/README.md +4 -2
  3. vm_tool-1.0.18/setup.py +65 -0
  4. {vm_tool-1.0.16 → vm_tool-1.0.18}/vm_tool/cli.py +1 -1
  5. vm_tool-1.0.18/vm_tool/runner.py +81 -0
  6. {vm_tool-1.0.16 → vm_tool-1.0.18}/vm_tool/vm_setup/docker/create_docker_service.yml +12 -2
  7. {vm_tool-1.0.16 → vm_tool-1.0.18}/vm_tool/vm_setup/setup.yml +11 -0
  8. {vm_tool-1.0.16 → vm_tool-1.0.18/vm_tool.egg-info}/PKG-INFO +32 -3
  9. vm_tool-1.0.18/vm_tool.egg-info/requires.txt +9 -0
  10. vm_tool-1.0.16/setup.py +0 -37
  11. vm_tool-1.0.16/vm_tool/runner.py +0 -88
  12. vm_tool-1.0.16/vm_tool.egg-info/requires.txt +0 -3
  13. {vm_tool-1.0.16 → vm_tool-1.0.18}/LICENSE +0 -0
  14. {vm_tool-1.0.16 → vm_tool-1.0.18}/MANIFEST.in +0 -0
  15. {vm_tool-1.0.16 → vm_tool-1.0.18}/setup.cfg +0 -0
  16. {vm_tool-1.0.16 → vm_tool-1.0.18}/vm_tool/__init__.py +0 -0
  17. {vm_tool-1.0.16 → vm_tool-1.0.18}/vm_tool/ssh.py +0 -0
  18. {vm_tool-1.0.16 → vm_tool-1.0.18}/vm_tool/vm_setup/cloud_inventory.yml +0 -0
  19. {vm_tool-1.0.16 → vm_tool-1.0.18}/vm_tool/vm_setup/docker/install_docker_and_compose.yml +0 -0
  20. {vm_tool-1.0.16 → vm_tool-1.0.18}/vm_tool/vm_setup/inventory.yml +0 -0
  21. {vm_tool-1.0.16 → vm_tool-1.0.18}/vm_tool.egg-info/SOURCES.txt +0 -0
  22. {vm_tool-1.0.16 → vm_tool-1.0.18}/vm_tool.egg-info/dependency_links.txt +0 -0
  23. {vm_tool-1.0.16 → vm_tool-1.0.18}/vm_tool.egg-info/entry_points.txt +0 -0
  24. {vm_tool-1.0.16 → vm_tool-1.0.18}/vm_tool.egg-info/top_level.txt +0 -0
@@ -1,23 +1,50 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: vm_tool
3
- Version: 1.0.16
3
+ Version: 1.0.18
4
4
  Summary: A Comprehensive Tool for Setting Up Virtual Machines.
5
5
  Home-page: https://github.com/thesunnysinha/vm_tool
6
6
  License: MIT
7
7
  Project-URL: Documentation, https://github.com/thesunnysinha/vm_tool/README.md
8
8
  Project-URL: Source, https://github.com/thesunnysinha/vm_tool
9
9
  Project-URL: Tracker, https://github.com/thesunnysinha/vm_tool/issues
10
+ Keywords: virtual machine setup ansible automation
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: System Administrators
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.6
18
+ Classifier: Programming Language :: Python :: 3.7
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Topic :: Software Development :: Build Tools
26
+ Classifier: Topic :: System :: Systems Administration
27
+ Requires-Python: >=3.6
10
28
  Description-Content-Type: text/markdown
11
29
  License-File: LICENSE
12
30
  Requires-Dist: ansible
13
31
  Requires-Dist: ansible-runner
14
32
  Requires-Dist: paramiko
33
+ Requires-Dist: pydantic
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest; extra == "dev"
36
+ Requires-Dist: flake8; extra == "dev"
37
+ Requires-Dist: bump2version; extra == "dev"
38
+ Dynamic: classifier
15
39
  Dynamic: description
16
40
  Dynamic: description-content-type
17
41
  Dynamic: home-page
42
+ Dynamic: keywords
18
43
  Dynamic: license
19
44
  Dynamic: project-url
45
+ Dynamic: provides-extra
20
46
  Dynamic: requires-dist
47
+ Dynamic: requires-python
21
48
  Dynamic: summary
22
49
 
23
50
  # **VM Setup Tool**
@@ -53,7 +80,8 @@ from vm_tool.runner import SetupRunner
53
80
  runner = SetupRunner(
54
81
  github_username='your_github_username', # e.g., username
55
82
  github_token='your_github_token', # e.g., token
56
- github_project_url='your_github_project_url' # e.g., https://github.com/username/repo
83
+ github_project_url='your_github_project_url', # e.g., https://github.com/username/repo
84
+ docker_compose_file_path='path_to_your_docker_compose_file' # Optional, defaults to 'docker-compose.yml' e.g. backend/docker-compose.prod.yml
57
85
  )
58
86
 
59
87
  runner.run_setup()
@@ -80,7 +108,8 @@ from vm_tool.runner import SetupRunner
80
108
  runner = SetupRunner(
81
109
  github_username='your_github_username', # e.g., username
82
110
  github_token='your_github_token', # e.g., token
83
- github_project_url='your_github_project_url' # e.g., https://github.com/username/repo
111
+ github_project_url='your_github_project_url', # e.g., https://github.com/username/repo
112
+ docker_compose_file_path='path_to_your_docker_compose_file' # Optional, defaults to 'docker-compose.yml' e.g. backend/docker-compose.prod.yml
84
113
  )
85
114
 
86
115
  runner.run_cloud_setup(
@@ -31,7 +31,8 @@ from vm_tool.runner import SetupRunner
31
31
  runner = SetupRunner(
32
32
  github_username='your_github_username', # e.g., username
33
33
  github_token='your_github_token', # e.g., token
34
- github_project_url='your_github_project_url' # e.g., https://github.com/username/repo
34
+ github_project_url='your_github_project_url', # e.g., https://github.com/username/repo
35
+ docker_compose_file_path='path_to_your_docker_compose_file' # Optional, defaults to 'docker-compose.yml' e.g. backend/docker-compose.prod.yml
35
36
  )
36
37
 
37
38
  runner.run_setup()
@@ -58,7 +59,8 @@ from vm_tool.runner import SetupRunner
58
59
  runner = SetupRunner(
59
60
  github_username='your_github_username', # e.g., username
60
61
  github_token='your_github_token', # e.g., token
61
- github_project_url='your_github_project_url' # e.g., https://github.com/username/repo
62
+ github_project_url='your_github_project_url', # e.g., https://github.com/username/repo
63
+ docker_compose_file_path='path_to_your_docker_compose_file' # Optional, defaults to 'docker-compose.yml' e.g. backend/docker-compose.prod.yml
62
64
  )
63
65
 
64
66
  runner.run_cloud_setup(
@@ -0,0 +1,65 @@
1
+ from setuptools import setup, find_packages
2
+ import os
3
+
4
+ # Read the contents of README.md
5
+ readme_path = os.path.join(os.path.dirname(__file__), 'README.md')
6
+ if os.path.exists(readme_path):
7
+ with open(readme_path, encoding='utf-8') as f:
8
+ long_description = f.read()
9
+ else:
10
+ long_description = ''
11
+
12
+ setup(
13
+ name='vm_tool',
14
+ version='1.0.18', # This will be updated by bump2version
15
+ packages=find_packages(),
16
+ description='A Comprehensive Tool for Setting Up Virtual Machines.',
17
+ long_description=long_description,
18
+ long_description_content_type='text/markdown',
19
+ install_requires=[
20
+ 'ansible',
21
+ 'ansible-runner',
22
+ 'paramiko',
23
+ 'pydantic'
24
+ ],
25
+ extras_require={
26
+ 'dev': [
27
+ 'pytest',
28
+ 'flake8',
29
+ 'bump2version'
30
+ ]
31
+ },
32
+ entry_points={
33
+ 'console_scripts': [
34
+ 'vm_tool=vm_tool.cli:main',
35
+ ],
36
+ },
37
+ classifiers=[
38
+ 'Development Status :: 5 - Production/Stable',
39
+ 'Intended Audience :: Developers',
40
+ 'Intended Audience :: System Administrators',
41
+ 'License :: OSI Approved :: MIT License',
42
+ 'Programming Language :: Python',
43
+ 'Programming Language :: Python :: 3',
44
+ 'Programming Language :: Python :: 3.6',
45
+ 'Programming Language :: Python :: 3.7',
46
+ 'Programming Language :: Python :: 3.8',
47
+ 'Programming Language :: Python :: 3.9',
48
+ 'Programming Language :: Python :: 3.10',
49
+ 'Programming Language :: Python :: 3.11',
50
+ 'Programming Language :: Python :: 3.12',
51
+ 'Programming Language :: Python :: 3.13',
52
+ 'Topic :: Software Development :: Build Tools',
53
+ 'Topic :: System :: Systems Administration',
54
+ ],
55
+ python_requires='>=3.6',
56
+ keywords='virtual machine setup ansible automation',
57
+ license='MIT',
58
+ include_package_data=True,
59
+ url='https://github.com/thesunnysinha/vm_tool',
60
+ project_urls={
61
+ 'Documentation': 'https://github.com/thesunnysinha/vm_tool/README.md',
62
+ 'Source': 'https://github.com/thesunnysinha/vm_tool',
63
+ 'Tracker': 'https://github.com/thesunnysinha/vm_tool/issues',
64
+ },
65
+ )
@@ -2,7 +2,7 @@ import argparse
2
2
 
3
3
  def main():
4
4
  parser = argparse.ArgumentParser(description='Setup VMs using Ansible.')
5
- parser.add_argument('--version', action='version', version='1.0.16')
5
+ parser.add_argument('--version', action='version', version='1.0.18')
6
6
 
7
7
  args = parser.parse_args()
8
8
 
@@ -0,0 +1,81 @@
1
+ import sys
2
+ import ansible_runner
3
+ import os
4
+ from pydantic import BaseModel, HttpUrl, validator
5
+
6
+ class SetupRunnerConfig(BaseModel):
7
+ github_username: str
8
+ github_token: str
9
+ github_project_url: HttpUrl
10
+ docker_compose_file_path: str = 'docker-compose.yml'
11
+
12
+ @validator('docker_compose_file_path', pre=True, always=True)
13
+ def set_default_docker_compose_file_path(cls, v):
14
+ return v or 'docker-compose.yml'
15
+
16
+ class SetupRunner:
17
+ def __init__(self, config: SetupRunnerConfig):
18
+ self.github_username = config.github_username
19
+ self.github_token = config.github_token
20
+ self.github_project_url = config.github_project_url
21
+ self.docker_compose_file_path = config.docker_compose_file_path
22
+
23
+ def _run_ansible_playbook(self, extravars, inventory_file):
24
+ # Get the current directory of this script
25
+ current_dir = os.path.dirname(os.path.abspath(__file__))
26
+
27
+ # Get the virtual environment directory
28
+ venv_dir = os.path.join(sys.prefix, 'ansible_runner_data')
29
+
30
+ # Ensure the directory exists
31
+ os.makedirs(venv_dir, exist_ok=True)
32
+
33
+ # Construct dynamic paths
34
+ playbook_path = os.path.join(current_dir, 'vm_setup', 'setup.yml')
35
+ inventory_path = os.path.join(current_dir, 'vm_setup', inventory_file)
36
+
37
+ try:
38
+ # Run the Ansible playbook using ansible-runner
39
+ r = ansible_runner.run(
40
+ private_data_dir=venv_dir,
41
+ playbook=playbook_path,
42
+ inventory=inventory_path,
43
+ extravars=extravars
44
+ )
45
+
46
+ if r.rc != 0:
47
+ raise RuntimeError(f"Ansible playbook execution failed with return code {r.rc}: {r.stdout}")
48
+
49
+ except Exception as e:
50
+ raise RuntimeError(f"An error occurred while running the Ansible playbook: {str(e)}")
51
+
52
+ def run_setup(self):
53
+ # Construct extravars dictionary
54
+ extravars = {
55
+ 'GITHUB_USERNAME': self.github_username,
56
+ 'GITHUB_TOKEN': self.github_token,
57
+ 'GITHUB_PROJECT_URL': self.github_project_url,
58
+ 'EXECUTION_TYPE': "normal"
59
+ }
60
+
61
+ if self.docker_compose_file_path:
62
+ extravars["DOCKER_COMPOSE_FILE_PATH"] = self.docker_compose_file_path
63
+
64
+ self._run_ansible_playbook(extravars, 'inventory.yml')
65
+
66
+ def run_cloud_setup(self, ssh_username: str, ssh_password: str, ssh_hostname: str):
67
+ # Construct extravars dictionary
68
+ extravars = {
69
+ 'SSH_USERNAME': ssh_username,
70
+ 'SSH_PASSWORD': ssh_password,
71
+ 'SSH_HOSTNAME': ssh_hostname,
72
+ 'GITHUB_USERNAME': self.github_username,
73
+ 'GITHUB_TOKEN': self.github_token,
74
+ 'GITHUB_PROJECT_URL': self.github_project_url,
75
+ 'EXECUTION_TYPE': "cloud"
76
+ }
77
+
78
+ if self.docker_compose_file_path:
79
+ extravars["DOCKER_COMPOSE_FILE_PATH"] = self.docker_compose_file_path
80
+
81
+ self._run_ansible_playbook(extravars, 'cloud_inventory.yml')
@@ -28,6 +28,16 @@
28
28
  state: touch
29
29
  mode: '0644'
30
30
 
31
+ - name: Check if Docker Compose File Path is Valid
32
+ ansible.builtin.stat:
33
+ path: "{{ project_dest_dir }}/{{ DOCKER_COMPOSE_FILE_PATH | default('docker-compose.yml') }}"
34
+ register: compose_file_stat
35
+
36
+ - name: Fail if Docker Compose File Path is Invalid
37
+ ansible.builtin.fail:
38
+ msg: "The specified Docker Compose file path '{{ project_dest_dir }}/{{ DOCKER_COMPOSE_FILE_PATH | default('docker-compose.yml') }}' does not exist."
39
+ when: not compose_file_stat.stat.exists
40
+
31
41
  - name: Insert Docker Service Configuration
32
42
  ansible.builtin.blockinfile:
33
43
  path: "{{ service_file_path }}"
@@ -39,7 +49,7 @@
39
49
  [Service]
40
50
  Type=simple
41
51
  WorkingDirectory={{ project_dest_dir }}
42
- ExecStart=docker compose -f docker-compose.yml up -d
52
+ ExecStart=docker compose -f {{ DOCKER_COMPOSE_FILE_PATH | default('docker-compose.yml') }} up -d
43
53
  Restart=always
44
54
  RestartSec=10s
45
55
 
@@ -50,4 +60,4 @@
50
60
  ansible.builtin.systemd:
51
61
  daemon_reload: yes
52
62
 
53
- become: yes
63
+ become: yes
@@ -6,6 +6,17 @@
6
6
  static_playbook_dir: "{{ playbook_dir }}"
7
7
 
8
8
  tasks:
9
+ - name: Gather package facts
10
+ package_facts:
11
+ manager: auto
12
+
13
+ - name: Install sshpass if execution type is cloud and not already installed
14
+ apt:
15
+ name: sshpass
16
+ state: present
17
+ when: EXECUTION_TYPE == "cloud" and "'sshpass' not in ansible_facts.packages"
18
+ become: yes
19
+
9
20
  - name: Set project_dest_dir variable
10
21
  set_fact:
11
22
  project_dest_dir: "{{ static_playbook_dir }}/project"
@@ -1,23 +1,50 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: vm_tool
3
- Version: 1.0.16
3
+ Version: 1.0.18
4
4
  Summary: A Comprehensive Tool for Setting Up Virtual Machines.
5
5
  Home-page: https://github.com/thesunnysinha/vm_tool
6
6
  License: MIT
7
7
  Project-URL: Documentation, https://github.com/thesunnysinha/vm_tool/README.md
8
8
  Project-URL: Source, https://github.com/thesunnysinha/vm_tool
9
9
  Project-URL: Tracker, https://github.com/thesunnysinha/vm_tool/issues
10
+ Keywords: virtual machine setup ansible automation
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: System Administrators
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.6
18
+ Classifier: Programming Language :: Python :: 3.7
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Classifier: Topic :: Software Development :: Build Tools
26
+ Classifier: Topic :: System :: Systems Administration
27
+ Requires-Python: >=3.6
10
28
  Description-Content-Type: text/markdown
11
29
  License-File: LICENSE
12
30
  Requires-Dist: ansible
13
31
  Requires-Dist: ansible-runner
14
32
  Requires-Dist: paramiko
33
+ Requires-Dist: pydantic
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest; extra == "dev"
36
+ Requires-Dist: flake8; extra == "dev"
37
+ Requires-Dist: bump2version; extra == "dev"
38
+ Dynamic: classifier
15
39
  Dynamic: description
16
40
  Dynamic: description-content-type
17
41
  Dynamic: home-page
42
+ Dynamic: keywords
18
43
  Dynamic: license
19
44
  Dynamic: project-url
45
+ Dynamic: provides-extra
20
46
  Dynamic: requires-dist
47
+ Dynamic: requires-python
21
48
  Dynamic: summary
22
49
 
23
50
  # **VM Setup Tool**
@@ -53,7 +80,8 @@ from vm_tool.runner import SetupRunner
53
80
  runner = SetupRunner(
54
81
  github_username='your_github_username', # e.g., username
55
82
  github_token='your_github_token', # e.g., token
56
- github_project_url='your_github_project_url' # e.g., https://github.com/username/repo
83
+ github_project_url='your_github_project_url', # e.g., https://github.com/username/repo
84
+ docker_compose_file_path='path_to_your_docker_compose_file' # Optional, defaults to 'docker-compose.yml' e.g. backend/docker-compose.prod.yml
57
85
  )
58
86
 
59
87
  runner.run_setup()
@@ -80,7 +108,8 @@ from vm_tool.runner import SetupRunner
80
108
  runner = SetupRunner(
81
109
  github_username='your_github_username', # e.g., username
82
110
  github_token='your_github_token', # e.g., token
83
- github_project_url='your_github_project_url' # e.g., https://github.com/username/repo
111
+ github_project_url='your_github_project_url', # e.g., https://github.com/username/repo
112
+ docker_compose_file_path='path_to_your_docker_compose_file' # Optional, defaults to 'docker-compose.yml' e.g. backend/docker-compose.prod.yml
84
113
  )
85
114
 
86
115
  runner.run_cloud_setup(
@@ -0,0 +1,9 @@
1
+ ansible
2
+ ansible-runner
3
+ paramiko
4
+ pydantic
5
+
6
+ [dev]
7
+ pytest
8
+ flake8
9
+ bump2version
vm_tool-1.0.16/setup.py DELETED
@@ -1,37 +0,0 @@
1
- from setuptools import setup, find_packages
2
- import os
3
-
4
- # Read the contents of README.md
5
- readme_path = os.path.join(os.path.dirname(__file__), 'README.md')
6
- if os.path.exists(readme_path):
7
- with open(readme_path, encoding='utf-8') as f:
8
- long_description = f.read()
9
- else:
10
- long_description = ''
11
-
12
- setup(
13
- name='vm_tool',
14
- version='1.0.16', # This will be updated by bump2version
15
- packages=find_packages(),
16
- description='A Comprehensive Tool for Setting Up Virtual Machines.',
17
- long_description=long_description,
18
- long_description_content_type='text/markdown',
19
- install_requires=[
20
- 'ansible',
21
- 'ansible-runner',
22
- 'paramiko'
23
- ],
24
- entry_points={
25
- 'console_scripts': [
26
- 'vm_tool=vm_tool.cli:main',
27
- ],
28
- },
29
- license='MIT',
30
- include_package_data=True,
31
- url='https://github.com/thesunnysinha/vm_tool',
32
- project_urls={
33
- 'Documentation': 'https://github.com/thesunnysinha/vm_tool/README.md',
34
- 'Source': 'https://github.com/thesunnysinha/vm_tool',
35
- 'Tracker': 'https://github.com/thesunnysinha/vm_tool/issues',
36
- },
37
- )
@@ -1,88 +0,0 @@
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)}")
47
-
48
-
49
- def run_cloud_setup(self,ssh_username,ssh_password,ssh_hostname):
50
- # Construct extravars dictionary
51
- extravars = {
52
- 'SSH_USERNAME': ssh_username,
53
- 'SSH_PASSWORD': ssh_password,
54
- 'SSH_HOSTNAME': ssh_hostname,
55
- 'GITHUB_USERNAME': self.github_username,
56
- 'GITHUB_TOKEN': self.github_token,
57
- 'GITHUB_PROJECT_URL': self.github_project_url
58
-
59
- }
60
-
61
- # Get the current directory of this script
62
- current_dir = os.path.dirname(os.path.abspath(__file__))
63
-
64
- # Get the virtual environment directory
65
- venv_dir = os.path.join(sys.prefix, 'ansible_runner_data')
66
-
67
- # Ensure the directory exists
68
- os.makedirs(venv_dir, exist_ok=True)
69
-
70
-
71
- # Construct dynamic paths
72
- playbook_path = os.path.join(current_dir, 'vm_setup', 'setup.yml')
73
- inventory_path = os.path.join(current_dir, 'vm_setup', 'cloud_inventory.yml')
74
-
75
- try:
76
- # Run the Ansible playbook using ansible-runner
77
- r = ansible_runner.run(
78
- private_data_dir=venv_dir,
79
- playbook=playbook_path,
80
- inventory=inventory_path,
81
- extravars=extravars
82
- )
83
-
84
- if r.rc != 0:
85
- raise RuntimeError(f"Ansible playbook execution failed with return code {r.rc}: {r.stdout}")
86
-
87
- except Exception as e:
88
- raise RuntimeError(f"An error occurred while running the Ansible playbook: {str(e)}")
@@ -1,3 +0,0 @@
1
- ansible
2
- ansible-runner
3
- paramiko
File without changes
File without changes
File without changes
File without changes
File without changes