osimager 1.9.0__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 (161) hide show
  1. osimager-1.9.0/LICENSE +21 -0
  2. osimager-1.9.0/PKG-INFO +244 -0
  3. osimager-1.9.0/README.md +207 -0
  4. osimager-1.9.0/osimager/__init__.py +2 -0
  5. osimager-1.9.0/osimager/cli.py +622 -0
  6. osimager-1.9.0/osimager/core.py +1863 -0
  7. osimager-1.9.0/osimager/data/ansible.cfg +12 -0
  8. osimager-1.9.0/osimager/data/ansible.json +20 -0
  9. osimager-1.9.0/osimager/data/config.yml +208 -0
  10. osimager-1.9.0/osimager/data/examples/example-location.json +40 -0
  11. osimager-1.9.0/osimager/data/examples/example-location.toml +54 -0
  12. osimager-1.9.0/osimager/data/examples/example-secrets +38 -0
  13. osimager-1.9.0/osimager/data/examples/example-vault +46 -0
  14. osimager-1.9.0/osimager/data/examples/quickstart-location.toml +21 -0
  15. osimager-1.9.0/osimager/data/files/agama/leap.json +48 -0
  16. osimager-1.9.0/osimager/data/files/agama/sles.json +49 -0
  17. osimager-1.9.0/osimager/data/files/alpine/answerfile +17 -0
  18. osimager-1.9.0/osimager/data/files/arch/user_configuration.json +43 -0
  19. osimager-1.9.0/osimager/data/files/arch/user_credentials.json +10 -0
  20. osimager-1.9.0/osimager/data/files/debian/debian-8-preseed.cfg +232 -0
  21. osimager-1.9.0/osimager/data/files/debian/debian.fix +26 -0
  22. osimager-1.9.0/osimager/data/files/debian/debian.seed +145 -0
  23. osimager-1.9.0/osimager/data/files/debian/debian_12.seed +124 -0
  24. osimager-1.9.0/osimager/data/files/debian/debian_pre10.seed +145 -0
  25. osimager-1.9.0/osimager/data/files/esxi/kickstart.cfg +9 -0
  26. osimager-1.9.0/osimager/data/files/esxi/kickstart_fb.cfg +19 -0
  27. osimager-1.9.0/osimager/data/files/esxi/kickstart_post.cfg +18 -0
  28. osimager-1.9.0/osimager/data/files/fedora/kickstart.cfg +29 -0
  29. osimager-1.9.0/osimager/data/files/fedora/kickstart_43.cfg +45 -0
  30. osimager-1.9.0/osimager/data/files/freebsd/installerconfig +55 -0
  31. osimager-1.9.0/osimager/data/files/ignition/fcos.ign +27 -0
  32. osimager-1.9.0/osimager/data/files/ignition/flatcar.ign +27 -0
  33. osimager-1.9.0/osimager/data/files/linux/banner +4 -0
  34. osimager-1.9.0/osimager/data/files/linux/findcd +17 -0
  35. osimager-1.9.0/osimager/data/files/oel/kickstart_6.cfg +25 -0
  36. osimager-1.9.0/osimager/data/files/oel/kickstart_post.cfg +43 -0
  37. osimager-1.9.0/osimager/data/files/openbsd/install.conf +19 -0
  38. osimager-1.9.0/osimager/data/files/photon/kickstart.json +35 -0
  39. osimager-1.9.0/osimager/data/files/proxmox-ve/answer.toml +14 -0
  40. osimager-1.9.0/osimager/data/files/rhel/install_vmwtools.sh +23 -0
  41. osimager-1.9.0/osimager/data/files/rhel/kickstart_10.cfg +48 -0
  42. osimager-1.9.0/osimager/data/files/rhel/kickstart_3.cfg +27 -0
  43. osimager-1.9.0/osimager/data/files/rhel/kickstart_4.cfg +28 -0
  44. osimager-1.9.0/osimager/data/files/rhel/kickstart_5.cfg +47 -0
  45. osimager-1.9.0/osimager/data/files/rhel/kickstart_6.cfg +28 -0
  46. osimager-1.9.0/osimager/data/files/rhel/kickstart_7.cfg +47 -0
  47. osimager-1.9.0/osimager/data/files/rhel/kickstart_8.cfg +49 -0
  48. osimager-1.9.0/osimager/data/files/rhel/kickstart_9.cfg +48 -0
  49. osimager-1.9.0/osimager/data/files/rhel/kickstart_end.cfg +1 -0
  50. osimager-1.9.0/osimager/data/files/rhel/kickstart_post.cfg +23 -0
  51. osimager-1.9.0/osimager/data/files/rhel/ks-part.sh +115 -0
  52. osimager-1.9.0/osimager/data/files/sles/autoinst_12.xml +202 -0
  53. osimager-1.9.0/osimager/data/files/sles/autoinst_15.xml +213 -0
  54. osimager-1.9.0/osimager/data/files/sles/autoinst_16.xml +212 -0
  55. osimager-1.9.0/osimager/data/files/ubuntu/meta-data +1 -0
  56. osimager-1.9.0/osimager/data/files/ubuntu/ubuntu.seed +154 -0
  57. osimager-1.9.0/osimager/data/files/ubuntu/user-data +39 -0
  58. osimager-1.9.0/osimager/data/files/windows/Autounattend.xml +151 -0
  59. osimager-1.9.0/osimager/data/files/xcpng/answerfile.xml +11 -0
  60. osimager-1.9.0/osimager/data/platforms/aws.json +42 -0
  61. osimager-1.9.0/osimager/data/platforms/azure.json +57 -0
  62. osimager-1.9.0/osimager/data/platforms/gcp.json +49 -0
  63. osimager-1.9.0/osimager/data/platforms/hyperv.json +28 -0
  64. osimager-1.9.0/osimager/data/platforms/none.json +14 -0
  65. osimager-1.9.0/osimager/data/platforms/proxmox.json +76 -0
  66. osimager-1.9.0/osimager/data/platforms/qemu.json +35 -0
  67. osimager-1.9.0/osimager/data/platforms/virtualbox.json +53 -0
  68. osimager-1.9.0/osimager/data/platforms/vmware.json +37 -0
  69. osimager-1.9.0/osimager/data/platforms/vsphere.json +64 -0
  70. osimager-1.9.0/osimager/data/platforms/xenserver.json +30 -0
  71. osimager-1.9.0/osimager/data/scripts/coreos_customize.py +60 -0
  72. osimager-1.9.0/osimager/data/scripts/openbsd_autoinstall.py +38 -0
  73. osimager-1.9.0/osimager/data/scripts/proxmox_post_build.py +84 -0
  74. osimager-1.9.0/osimager/data/scripts/qemu_post_build.py +84 -0
  75. osimager-1.9.0/osimager/data/specs/alma/spec.json +98 -0
  76. osimager-1.9.0/osimager/data/specs/alpine/spec.json +74 -0
  77. osimager-1.9.0/osimager/data/specs/amazon/spec.json +44 -0
  78. osimager-1.9.0/osimager/data/specs/arch/spec.json +64 -0
  79. osimager-1.9.0/osimager/data/specs/centos/spec.json +306 -0
  80. osimager-1.9.0/osimager/data/specs/debian/spec.json +511 -0
  81. osimager-1.9.0/osimager/data/specs/dragonfly/spec.json +36 -0
  82. osimager-1.9.0/osimager/data/specs/esx/spec.json +54 -0
  83. osimager-1.9.0/osimager/data/specs/esxi/config.yml +12 -0
  84. osimager-1.9.0/osimager/data/specs/esxi/spec.json +343 -0
  85. osimager-1.9.0/osimager/data/specs/esxi35/spec.json +67 -0
  86. osimager-1.9.0/osimager/data/specs/fedora/config_43.yml +22 -0
  87. osimager-1.9.0/osimager/data/specs/fedora/spec.json +278 -0
  88. osimager-1.9.0/osimager/data/specs/fedora-coreos/spec.json +50 -0
  89. osimager-1.9.0/osimager/data/specs/flatcar/spec.json +57 -0
  90. osimager-1.9.0/osimager/data/specs/freebsd/spec.json +80 -0
  91. osimager-1.9.0/osimager/data/specs/linux/spec.json +18 -0
  92. osimager-1.9.0/osimager/data/specs/mint/spec.json +61 -0
  93. osimager-1.9.0/osimager/data/specs/mxlinux/spec.json +49 -0
  94. osimager-1.9.0/osimager/data/specs/netbsd/spec.json +39 -0
  95. osimager-1.9.0/osimager/data/specs/oel/spec.json +686 -0
  96. osimager-1.9.0/osimager/data/specs/omnios/spec.json +36 -0
  97. osimager-1.9.0/osimager/data/specs/openbsd/spec.json +55 -0
  98. osimager-1.9.0/osimager/data/specs/openindiana/spec.json +36 -0
  99. osimager-1.9.0/osimager/data/specs/opensuse/spec.json +100 -0
  100. osimager-1.9.0/osimager/data/specs/openwrt/spec.json +37 -0
  101. osimager-1.9.0/osimager/data/specs/opnsense/spec.json +36 -0
  102. osimager-1.9.0/osimager/data/specs/pfsense/spec.json +37 -0
  103. osimager-1.9.0/osimager/data/specs/photon/spec.json +71 -0
  104. osimager-1.9.0/osimager/data/specs/proxmox-ve/spec.json +120 -0
  105. osimager-1.9.0/osimager/data/specs/rhel/config_5.yml +37 -0
  106. osimager-1.9.0/osimager/data/specs/rhel/config_6.yml +45 -0
  107. osimager-1.9.0/osimager/data/specs/rhel/config_7.yml +27 -0
  108. osimager-1.9.0/osimager/data/specs/rhel/config_8.yml +27 -0
  109. osimager-1.9.0/osimager/data/specs/rhel/config_9.yml +27 -0
  110. osimager-1.9.0/osimager/data/specs/rhel/config_legacy.yml +13 -0
  111. osimager-1.9.0/osimager/data/specs/rhel/config_prejson.yml +13 -0
  112. osimager-1.9.0/osimager/data/specs/rhel/configure_system +5 -0
  113. osimager-1.9.0/osimager/data/specs/rhel/spec.json +1004 -0
  114. osimager-1.9.0/osimager/data/specs/rocky/spec.json +58 -0
  115. osimager-1.9.0/osimager/data/specs/sco/spec.json +81 -0
  116. osimager-1.9.0/osimager/data/specs/sles/spec.json +190 -0
  117. osimager-1.9.0/osimager/data/specs/solaris/spec.json +36 -0
  118. osimager-1.9.0/osimager/data/specs/ssh/spec.json +10 -0
  119. osimager-1.9.0/osimager/data/specs/sysvr4/config.yml +12 -0
  120. osimager-1.9.0/osimager/data/specs/sysvr4/configure_system +5 -0
  121. osimager-1.9.0/osimager/data/specs/sysvr4/spec.json +128 -0
  122. osimager-1.9.0/osimager/data/specs/truenas/spec.json +36 -0
  123. osimager-1.9.0/osimager/data/specs/ubuntu/spec.json +238 -0
  124. osimager-1.9.0/osimager/data/specs/unixware/spec.json +81 -0
  125. osimager-1.9.0/osimager/data/specs/vyos/spec.json +36 -0
  126. osimager-1.9.0/osimager/data/specs/windows/spec.json +18 -0
  127. osimager-1.9.0/osimager/data/specs/windows-desktop/spec.json +75 -0
  128. osimager-1.9.0/osimager/data/specs/windows-server/spec.json +210 -0
  129. osimager-1.9.0/osimager/data/specs/winrm/spec.json +10 -0
  130. osimager-1.9.0/osimager/data/specs/xcpng/spec.json +76 -0
  131. osimager-1.9.0/osimager/data/tasks/AlmaLinux_post.yml +34 -0
  132. osimager-1.9.0/osimager/data/tasks/Debian_post.yml +7 -0
  133. osimager-1.9.0/osimager/data/tasks/Debian_pre.yml +21 -0
  134. osimager-1.9.0/osimager/data/tasks/Linux_post.yml +180 -0
  135. osimager-1.9.0/osimager/data/tasks/Linux_pre.yml +13 -0
  136. osimager-1.9.0/osimager/data/tasks/RedHat_post.yml +18 -0
  137. osimager-1.9.0/osimager/data/tasks/RedHat_pre.yml +250 -0
  138. osimager-1.9.0/osimager/data/tasks/Suse_post.yml +131 -0
  139. osimager-1.9.0/osimager/data/tasks/Suse_pre.yml +98 -0
  140. osimager-1.9.0/osimager/data/tasks/Windows_post.yml +145 -0
  141. osimager-1.9.0/osimager/data/tasks/Windows_pre.yml +17 -0
  142. osimager-1.9.0/osimager/data/tasks/copy_files_if.yml +14 -0
  143. osimager-1.9.0/osimager/data/tasks/gcp_linux_post.yml +60 -0
  144. osimager-1.9.0/osimager/data/tasks/gcp_post.yml +3 -0
  145. osimager-1.9.0/osimager/data/tasks/include_role_if.yml +12 -0
  146. osimager-1.9.0/osimager/data/tasks/include_tasks_if.yml +11 -0
  147. osimager-1.9.0/osimager/data/tasks/local_repo.yml +204 -0
  148. osimager-1.9.0/osimager/data/tasks/proxmox_pre.yml +16 -0
  149. osimager-1.9.0/osimager/data/tasks/rhel_6_config.yml +27 -0
  150. osimager-1.9.0/osimager/data/tasks/spec.yml +2 -0
  151. osimager-1.9.0/osimager/data/tasks/vsphere_post.yml +22 -0
  152. osimager-1.9.0/osimager/data/tasks/windows_updates.yml +163 -0
  153. osimager-1.9.0/osimager/utils.py +847 -0
  154. osimager-1.9.0/osimager.egg-info/PKG-INFO +244 -0
  155. osimager-1.9.0/osimager.egg-info/SOURCES.txt +159 -0
  156. osimager-1.9.0/osimager.egg-info/dependency_links.txt +1 -0
  157. osimager-1.9.0/osimager.egg-info/entry_points.txt +4 -0
  158. osimager-1.9.0/osimager.egg-info/requires.txt +7 -0
  159. osimager-1.9.0/osimager.egg-info/top_level.txt +1 -0
  160. osimager-1.9.0/pyproject.toml +63 -0
  161. osimager-1.9.0/setup.cfg +4 -0
osimager-1.9.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Steve Shoecraft
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,244 @@
1
+ Metadata-Version: 2.4
2
+ Name: osimager
3
+ Version: 1.9.0
4
+ Summary: Multi-platform OS image builder using HashiCorp Packer
5
+ Author: Steve Shoecraft
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/sshoecraft/osimager
8
+ Project-URL: Repository, https://github.com/sshoecraft/osimager
9
+ Project-URL: Documentation, https://sshoecraft.github.io/osimager
10
+ Project-URL: Issues, https://github.com/sshoecraft/osimager/issues
11
+ Keywords: packer,vm,image,builder,kickstart,preseed,ansible
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Operating System :: MacOS
18
+ Classifier: Programming Language :: Python :: 3
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: Programming Language :: Python :: 3.14
26
+ Classifier: Topic :: System :: Installation/Setup
27
+ Classifier: Topic :: System :: Systems Administration
28
+ Requires-Python: >=3.8
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: ansible>=6.0
32
+ Requires-Dist: dnspython>=2.0
33
+ Requires-Dist: hvac>=1.0
34
+ Requires-Dist: requests>=2.25
35
+ Requires-Dist: tomli>=1.0; python_version < "3.11"
36
+ Dynamic: license-file
37
+
38
+ # OSImager
39
+
40
+ Multi-platform OS image builder using HashiCorp Packer. Build virtual machine images for any operating system -- from RHEL 2.1 (2002) to the latest RHEL 9, CentOS, Debian, Ubuntu, SLES, and Windows Server -- on any supported hypervisor, from a single command.
41
+
42
+ ## Quick Install
43
+
44
+ ```bash
45
+ pip install osimager
46
+ ```
47
+
48
+ ### Prerequisites
49
+
50
+ - **Python 3.8+**
51
+ - **HashiCorp Packer** -- https://developer.hashicorp.com/packer/install
52
+ - **Ansible** -- `pip install ansible`
53
+ - **A hypervisor** -- VirtualBox is free and the easiest to start with
54
+ - **Packer plugins** -- At minimum, the Ansible provisioner and your target platform plugin:
55
+ ```bash
56
+ packer plugins install github.com/hashicorp/ansible
57
+ packer plugins install github.com/hashicorp/virtualbox
58
+ ```
59
+ - **mkisofs** (recommended) -- `brew install cdrtools` (macOS) or `apt install genisoimage` (Linux)
60
+
61
+ ## Getting Started
62
+
63
+ After installing, run `mkosimage` with no arguments -- it will tell you exactly what to set up:
64
+
65
+ ```
66
+ $ mkosimage
67
+ Usage: mkosimage [OPTIONS] PLATFORM/LOCATION/SPEC [NAME] [IP]
68
+
69
+ No locations configured.
70
+ Create a location file in ~/.config/osimager/locations/
71
+ ...
72
+ ```
73
+
74
+ ### 1. Create a location
75
+
76
+ A location defines your build environment -- network settings, DNS, and where ISOs/VMs live.
77
+
78
+ Copy the quickstart template and edit it:
79
+
80
+ ```bash
81
+ cp "$(python3 -c "import osimager, os; print(os.path.join(os.path.dirname(osimager.__file__), 'data', 'examples', 'quickstart-location.toml'))")" \
82
+ ~/.config/osimager/locations/local.toml
83
+ ```
84
+
85
+ Edit `~/.config/osimager/locations/local.toml` -- set your network, gateway, DNS, and paths:
86
+
87
+ ```toml
88
+ platforms = ["virtualbox"]
89
+
90
+ [defs]
91
+ domain = "home.local"
92
+ gateway = "192.168.1.1"
93
+ cidr = "192.168.1.0/24"
94
+ vms_path = "/vms"
95
+ iso_path = "/iso"
96
+
97
+ [defs.dns]
98
+ servers = ["192.168.1.1"]
99
+
100
+ [defs.ntp]
101
+ servers = ["pool.ntp.org"]
102
+ ```
103
+
104
+ Locations support both TOML and JSON formats. If both `lab.toml` and `lab.json` exist, JSON takes priority.
105
+
106
+ ### 2. Set up credentials
107
+
108
+ OS image builds need credentials for SSH/WinRM access and root passwords. OSImager supports two credential sources:
109
+
110
+ **Option A: Local secrets file** (simplest)
111
+
112
+ ```bash
113
+ mkosimage --set credential_source=config
114
+ ```
115
+
116
+ Create `~/.config/osimager/secrets`:
117
+
118
+ ```
119
+ images/linux username=root password=YourPassword
120
+ images/windows username=Administrator password=YourPassword
121
+ ```
122
+
123
+ **Option B: HashiCorp Vault**
124
+
125
+ ```bash
126
+ mkosimage --set vault_addr=http://your-vault:8200
127
+ mkosimage --set vault_token=your-token
128
+ ```
129
+
130
+ See the example files shipped with the package for the full secret path reference (including platform credentials for vSphere and Proxmox).
131
+
132
+ ### 3. Build
133
+
134
+ ```bash
135
+ # List all available OS specs
136
+ mkosimage --list
137
+
138
+ # Dry run -- generates the Packer config without executing
139
+ mkosimage -n virtualbox/local/alma-9.5-x86_64
140
+
141
+ # Build
142
+ mkosimage virtualbox/local/alma-9.5-x86_64
143
+ ```
144
+
145
+ ## How It Works
146
+
147
+ ```
148
+ mkosimage <platform>/<location>/<spec>
149
+ ```
150
+
151
+ - **Platform** = your hypervisor (ships with package)
152
+ - **Location** = your environment: network, DNS, storage paths (you create this)
153
+ - **Spec** = the OS to build (ships with package)
154
+
155
+ OSImager merges these three configs together, performs template substitution, generates the appropriate answer file (kickstart, preseed, autoyast, or autounattend), produces a Packer build JSON, and executes it.
156
+
157
+ ## Features
158
+
159
+ - **500+ OS specs** spanning 20+ distributions across decades of releases (see [Supported OS](https://sshoecraft.github.io/osimager/reference/supported-os/) for the generated catalog)
160
+ - **11 platforms**: VirtualBox, VMware, vSphere, Proxmox, QEMU/KVM, Hyper-V, XenServer, Azure, GCP, AWS
161
+ - **Automated installation**: Kickstart (RHEL/CentOS/Alma/Rocky/OEL), preseed (Debian), cloud-init (Ubuntu 20.04+), AutoYaST (SLES), Autounattend (Windows)
162
+ - **Ansible provisioning**: Post-install configuration via Ansible playbooks
163
+ - **Hierarchical configuration**: Platform/location/spec system with deep inheritance and per-version/per-platform overrides
164
+ - **Flexible credentials**: Local secrets file or optional HashiCorp Vault integration
165
+ - **TOML or JSON locations**: User-editable location configs in either format
166
+
167
+ ## Supported Operating Systems
168
+
169
+ | Distribution | Versions | Install Method |
170
+ |-------------|----------|----------------|
171
+ | RHEL | 2.1, 3.0, 4.8, 5.x, 6.x, 7.x, 8.x, 9.x, 10.x | Kickstart |
172
+ | CentOS | 5.0-5.10, 6.0-6.10, 7.0-7.9, 8.0-8.5 | Kickstart |
173
+ | AlmaLinux | 8.3-8.10, 9.0-9.7, 10.0-10.1 | Kickstart |
174
+ | Rocky Linux | 8.3-8.9, 9.0-9.7, 10.0-10.1 | Kickstart |
175
+ | Oracle Linux | 5.0-5.10, 6.0-6.10, 7.0-7.9, 8.0-8.10, 9.0-9.7, 10.0-10.1 | Kickstart |
176
+ | Debian | 8-13 | Preseed / Cloud-Init |
177
+ | Ubuntu | 18.04, 20.04, 22.04, 24.04 | Cloud-Init |
178
+ | SLES | 12.1-12.5, 15.0-15.7, 16.0 | AutoYaST |
179
+ | VMware ESXi | 5.5U3, 6.0U2, 6.5, 7.0U3n, 8.0U2 | Kickstart |
180
+ | Windows Server | 2016, 2019, 2022, 2025 | Autounattend |
181
+
182
+ ## Supported Platforms
183
+
184
+ | Platform | Type | Plugin |
185
+ |----------|------|--------|
186
+ | VirtualBox | Local | `github.com/hashicorp/virtualbox` |
187
+ | VMware Workstation/Fusion | Local | `github.com/hashicorp/vmware` |
188
+ | vSphere | Enterprise | `github.com/hashicorp/vsphere` |
189
+ | Proxmox | Enterprise | `github.com/hashicorp/proxmox` |
190
+ | QEMU/KVM | Local | `github.com/hashicorp/qemu` |
191
+ | Hyper-V | Local | Built-in |
192
+ | XenServer | Local | `github.com/ddelnano/xenserver` |
193
+ | Azure | Cloud | `github.com/hashicorp/azure` |
194
+ | GCP | Cloud | `github.com/hashicorp/googlecompute` |
195
+ | AWS | Cloud | `github.com/hashicorp/amazon` |
196
+
197
+ ## Configuration
198
+
199
+ All user configuration lives in `~/.config/osimager/`:
200
+
201
+ | File | Purpose |
202
+ |------|---------|
203
+ | `locations/*.toml` or `*.json` | Build environments (you create these) |
204
+ | `secrets` | Credentials when using `credential_source=config` |
205
+ | `config.json` | Persistent settings (managed via `--set`) |
206
+
207
+ Settings are configured with `--set`:
208
+
209
+ ```bash
210
+ mkosimage --set credential_source=config # use local secrets file
211
+ mkosimage --set vault_addr=http://vault:8200 # vault server address
212
+ mkosimage --set local_only=True # only use local ISOs
213
+ mkosimage --set packer_cache_dir=/var/cache # ISO download cache
214
+ ```
215
+
216
+ ## CLI Reference
217
+
218
+ ```
219
+ mkosimage [OPTIONS] PLATFORM/LOCATION/SPEC [NAME] [IP]
220
+
221
+ Options:
222
+ -l, --list List all available specs
223
+ -a, --avail List only specs with local ISOs present
224
+ -n, --dry Dry run (show commands without executing)
225
+ -d, --debug Enable debug output
226
+ -v, --verbose Enable verbose output
227
+ -f, --force Force rebuild
228
+ -k, --keep Keep temporary files after build
229
+ -F, --fqdn FQDN Set fully qualified domain name
230
+ -D, --define K=V Define custom variables
231
+ -u, --dump Dump build configuration as JSON
232
+ -x, --defs Dump resolved definitions as JSON
233
+ --local-only Use local ISO files only
234
+ --set KEY=VALUE Set a persistent configuration value
235
+ -V, --version Show version
236
+ ```
237
+
238
+ ## Documentation
239
+
240
+ For detailed documentation on location setup, platform configuration, spec format, template syntax, and the credential system, see the [OSImager Documentation](https://sshoecraft.github.io/osimager).
241
+
242
+ ## License
243
+
244
+ MIT License -- see [LICENSE](LICENSE) for details.
@@ -0,0 +1,207 @@
1
+ # OSImager
2
+
3
+ Multi-platform OS image builder using HashiCorp Packer. Build virtual machine images for any operating system -- from RHEL 2.1 (2002) to the latest RHEL 9, CentOS, Debian, Ubuntu, SLES, and Windows Server -- on any supported hypervisor, from a single command.
4
+
5
+ ## Quick Install
6
+
7
+ ```bash
8
+ pip install osimager
9
+ ```
10
+
11
+ ### Prerequisites
12
+
13
+ - **Python 3.8+**
14
+ - **HashiCorp Packer** -- https://developer.hashicorp.com/packer/install
15
+ - **Ansible** -- `pip install ansible`
16
+ - **A hypervisor** -- VirtualBox is free and the easiest to start with
17
+ - **Packer plugins** -- At minimum, the Ansible provisioner and your target platform plugin:
18
+ ```bash
19
+ packer plugins install github.com/hashicorp/ansible
20
+ packer plugins install github.com/hashicorp/virtualbox
21
+ ```
22
+ - **mkisofs** (recommended) -- `brew install cdrtools` (macOS) or `apt install genisoimage` (Linux)
23
+
24
+ ## Getting Started
25
+
26
+ After installing, run `mkosimage` with no arguments -- it will tell you exactly what to set up:
27
+
28
+ ```
29
+ $ mkosimage
30
+ Usage: mkosimage [OPTIONS] PLATFORM/LOCATION/SPEC [NAME] [IP]
31
+
32
+ No locations configured.
33
+ Create a location file in ~/.config/osimager/locations/
34
+ ...
35
+ ```
36
+
37
+ ### 1. Create a location
38
+
39
+ A location defines your build environment -- network settings, DNS, and where ISOs/VMs live.
40
+
41
+ Copy the quickstart template and edit it:
42
+
43
+ ```bash
44
+ cp "$(python3 -c "import osimager, os; print(os.path.join(os.path.dirname(osimager.__file__), 'data', 'examples', 'quickstart-location.toml'))")" \
45
+ ~/.config/osimager/locations/local.toml
46
+ ```
47
+
48
+ Edit `~/.config/osimager/locations/local.toml` -- set your network, gateway, DNS, and paths:
49
+
50
+ ```toml
51
+ platforms = ["virtualbox"]
52
+
53
+ [defs]
54
+ domain = "home.local"
55
+ gateway = "192.168.1.1"
56
+ cidr = "192.168.1.0/24"
57
+ vms_path = "/vms"
58
+ iso_path = "/iso"
59
+
60
+ [defs.dns]
61
+ servers = ["192.168.1.1"]
62
+
63
+ [defs.ntp]
64
+ servers = ["pool.ntp.org"]
65
+ ```
66
+
67
+ Locations support both TOML and JSON formats. If both `lab.toml` and `lab.json` exist, JSON takes priority.
68
+
69
+ ### 2. Set up credentials
70
+
71
+ OS image builds need credentials for SSH/WinRM access and root passwords. OSImager supports two credential sources:
72
+
73
+ **Option A: Local secrets file** (simplest)
74
+
75
+ ```bash
76
+ mkosimage --set credential_source=config
77
+ ```
78
+
79
+ Create `~/.config/osimager/secrets`:
80
+
81
+ ```
82
+ images/linux username=root password=YourPassword
83
+ images/windows username=Administrator password=YourPassword
84
+ ```
85
+
86
+ **Option B: HashiCorp Vault**
87
+
88
+ ```bash
89
+ mkosimage --set vault_addr=http://your-vault:8200
90
+ mkosimage --set vault_token=your-token
91
+ ```
92
+
93
+ See the example files shipped with the package for the full secret path reference (including platform credentials for vSphere and Proxmox).
94
+
95
+ ### 3. Build
96
+
97
+ ```bash
98
+ # List all available OS specs
99
+ mkosimage --list
100
+
101
+ # Dry run -- generates the Packer config without executing
102
+ mkosimage -n virtualbox/local/alma-9.5-x86_64
103
+
104
+ # Build
105
+ mkosimage virtualbox/local/alma-9.5-x86_64
106
+ ```
107
+
108
+ ## How It Works
109
+
110
+ ```
111
+ mkosimage <platform>/<location>/<spec>
112
+ ```
113
+
114
+ - **Platform** = your hypervisor (ships with package)
115
+ - **Location** = your environment: network, DNS, storage paths (you create this)
116
+ - **Spec** = the OS to build (ships with package)
117
+
118
+ OSImager merges these three configs together, performs template substitution, generates the appropriate answer file (kickstart, preseed, autoyast, or autounattend), produces a Packer build JSON, and executes it.
119
+
120
+ ## Features
121
+
122
+ - **500+ OS specs** spanning 20+ distributions across decades of releases (see [Supported OS](https://sshoecraft.github.io/osimager/reference/supported-os/) for the generated catalog)
123
+ - **11 platforms**: VirtualBox, VMware, vSphere, Proxmox, QEMU/KVM, Hyper-V, XenServer, Azure, GCP, AWS
124
+ - **Automated installation**: Kickstart (RHEL/CentOS/Alma/Rocky/OEL), preseed (Debian), cloud-init (Ubuntu 20.04+), AutoYaST (SLES), Autounattend (Windows)
125
+ - **Ansible provisioning**: Post-install configuration via Ansible playbooks
126
+ - **Hierarchical configuration**: Platform/location/spec system with deep inheritance and per-version/per-platform overrides
127
+ - **Flexible credentials**: Local secrets file or optional HashiCorp Vault integration
128
+ - **TOML or JSON locations**: User-editable location configs in either format
129
+
130
+ ## Supported Operating Systems
131
+
132
+ | Distribution | Versions | Install Method |
133
+ |-------------|----------|----------------|
134
+ | RHEL | 2.1, 3.0, 4.8, 5.x, 6.x, 7.x, 8.x, 9.x, 10.x | Kickstart |
135
+ | CentOS | 5.0-5.10, 6.0-6.10, 7.0-7.9, 8.0-8.5 | Kickstart |
136
+ | AlmaLinux | 8.3-8.10, 9.0-9.7, 10.0-10.1 | Kickstart |
137
+ | Rocky Linux | 8.3-8.9, 9.0-9.7, 10.0-10.1 | Kickstart |
138
+ | Oracle Linux | 5.0-5.10, 6.0-6.10, 7.0-7.9, 8.0-8.10, 9.0-9.7, 10.0-10.1 | Kickstart |
139
+ | Debian | 8-13 | Preseed / Cloud-Init |
140
+ | Ubuntu | 18.04, 20.04, 22.04, 24.04 | Cloud-Init |
141
+ | SLES | 12.1-12.5, 15.0-15.7, 16.0 | AutoYaST |
142
+ | VMware ESXi | 5.5U3, 6.0U2, 6.5, 7.0U3n, 8.0U2 | Kickstart |
143
+ | Windows Server | 2016, 2019, 2022, 2025 | Autounattend |
144
+
145
+ ## Supported Platforms
146
+
147
+ | Platform | Type | Plugin |
148
+ |----------|------|--------|
149
+ | VirtualBox | Local | `github.com/hashicorp/virtualbox` |
150
+ | VMware Workstation/Fusion | Local | `github.com/hashicorp/vmware` |
151
+ | vSphere | Enterprise | `github.com/hashicorp/vsphere` |
152
+ | Proxmox | Enterprise | `github.com/hashicorp/proxmox` |
153
+ | QEMU/KVM | Local | `github.com/hashicorp/qemu` |
154
+ | Hyper-V | Local | Built-in |
155
+ | XenServer | Local | `github.com/ddelnano/xenserver` |
156
+ | Azure | Cloud | `github.com/hashicorp/azure` |
157
+ | GCP | Cloud | `github.com/hashicorp/googlecompute` |
158
+ | AWS | Cloud | `github.com/hashicorp/amazon` |
159
+
160
+ ## Configuration
161
+
162
+ All user configuration lives in `~/.config/osimager/`:
163
+
164
+ | File | Purpose |
165
+ |------|---------|
166
+ | `locations/*.toml` or `*.json` | Build environments (you create these) |
167
+ | `secrets` | Credentials when using `credential_source=config` |
168
+ | `config.json` | Persistent settings (managed via `--set`) |
169
+
170
+ Settings are configured with `--set`:
171
+
172
+ ```bash
173
+ mkosimage --set credential_source=config # use local secrets file
174
+ mkosimage --set vault_addr=http://vault:8200 # vault server address
175
+ mkosimage --set local_only=True # only use local ISOs
176
+ mkosimage --set packer_cache_dir=/var/cache # ISO download cache
177
+ ```
178
+
179
+ ## CLI Reference
180
+
181
+ ```
182
+ mkosimage [OPTIONS] PLATFORM/LOCATION/SPEC [NAME] [IP]
183
+
184
+ Options:
185
+ -l, --list List all available specs
186
+ -a, --avail List only specs with local ISOs present
187
+ -n, --dry Dry run (show commands without executing)
188
+ -d, --debug Enable debug output
189
+ -v, --verbose Enable verbose output
190
+ -f, --force Force rebuild
191
+ -k, --keep Keep temporary files after build
192
+ -F, --fqdn FQDN Set fully qualified domain name
193
+ -D, --define K=V Define custom variables
194
+ -u, --dump Dump build configuration as JSON
195
+ -x, --defs Dump resolved definitions as JSON
196
+ --local-only Use local ISO files only
197
+ --set KEY=VALUE Set a persistent configuration value
198
+ -V, --version Show version
199
+ ```
200
+
201
+ ## Documentation
202
+
203
+ For detailed documentation on location setup, platform configuration, spec format, template syntax, and the credential system, see the [OSImager Documentation](https://sshoecraft.github.io/osimager).
204
+
205
+ ## License
206
+
207
+ MIT License -- see [LICENSE](LICENSE) for details.
@@ -0,0 +1,2 @@
1
+
2
+ from .core import OSImager