{"id":21232151,"url":"https://github.com/darki73/ptm","last_synced_at":"2025-03-15T02:40:38.528Z","repository":{"id":217435392,"uuid":"743855671","full_name":"darki73/ptm","owner":"darki73","description":"Proxmox Templates Maker is an application to help you create VM templates from images you can customize.","archived":false,"fork":false,"pushed_at":"2024-01-16T06:12:46.000Z","size":88,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T18:25:52.152Z","etag":null,"topics":["go","proxmox-ve","qemu","qemu-img","qm","virt-customize"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darki73.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-16T06:11:06.000Z","updated_at":"2024-10-27T09:25:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"9f49a3a1-7035-407a-b752-452e7274d4de","html_url":"https://github.com/darki73/ptm","commit_stats":null,"previous_names":["darki73/ptm"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darki73%2Fptm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darki73%2Fptm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darki73%2Fptm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darki73%2Fptm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darki73","download_url":"https://codeload.github.com/darki73/ptm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243676705,"owners_count":20329431,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","proxmox-ve","qemu","qemu-img","qm","virt-customize"],"created_at":"2024-11-20T23:49:47.134Z","updated_at":"2025-03-15T02:40:38.508Z","avatar_url":"https://github.com/darki73.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Proxmox Templates Maker\nThis application allows you to automate templates creation for Proxmox VE.  \nIt provides a simple way to create templates for Proxmox VE by using a simple YAML file or command line arguments.  \n\n# Table of Contents\n- [Proxmox Templates Maker](#proxmox-templates-maker)\n- [Installation](#installation)\n- [Configuration](#configuration)\n    * [Downloader Configuration](#downloader-configuration)\n    * [Base Image Configuration](#base-image-configuration)\n    * [Extra Packages Configuration](#extra-packages-configuration)\n    * [Repositories Configuration](#repositories-configuration)\n    * [Qemu Configuration](#qemu-configuration)\n    * [Cloud-Init Configuration](#cloud-init-configuration)\n    * [Unattended Upgrades Configuration](#unattended-upgrades-configuration)\n    * [Minimal Configuration](#minimal-configuration)\n- [Usage](#usage)\n    * [Commands](#commands)\n    * [Customize](#customize)\n    * [Make](#make)\n        + [Prompt Flow](#prompt-flow)\n        + [Configuration Flow](#configuration-flow)\n        + [Flags Flow](#flags-flow)\n\n# Installation\nYou can install the application by downloading the latest version from [Releases](https://github.com/darki73/ptm/releases) page.\n\n# Configuration\nBy default, application expects configuration file to be located at `/etc/ptm/config.yaml`.  \nYou can override:\n1. Configuration file location by using `--configuration-path` argument. (defaults to `/etc/ptm`)\n2. Configuration file name by using `--configuration-name` argument. (defaults to `config`)\n3. Configuration file extension by using `--configuration-extension` argument. (defaults to `yaml`)\n\nBelow, you would be able to find examples of configuration file sections.  \n**All examples are using YAML format.**  \n***Most of them are presented with the default values that application would use if no configuration is provided.***\n\n## Downloader Configuration\nDownloader configuration is located under `downloader` key.  \nDownloader is responsible for downloading and saving images from remote location.  \n\n```yaml\ndownloader:\n  save_to: /etc/ptm/images\n```\n\n**Keys:**  \n- `save_to` - path to directory where downloaded images should be saved. (defaults to `/etc/ptm/images`)\n\n## Base Image Configuration\nBase image configuration is located under `base_image` key.  \nIt is responsible for providing information on what type of image you want to download.  \n\n```yaml\nbase_image:\n  distribution: ubuntu\n  release: jammy\n  minimal: true\n  architecture: amd64\n  format: img\n```\n\n**Keys:**\n- `distribution` - distribution of the image. (defaults to `ubuntu`)\n- `release` - release of the image. (defaults to `jammy`)\n- `minimal` - whether image should you want to download the \"minimal\" version of the image. (defaults to `true`)\n- `architecture` - architecture of the image. (defaults to `amd64`)\n- `format` - format of the image. (defaults to `img`)\n\n## Extra Packages Configuration\nExtra packages configuration is located under `extra_packages` key.  \nIt is responsible for providing information on what extra packages should be installed on the image.  \nIt is a list of strings, which are package names.  \n\n\n```yaml\nextra_packages: []\n```\n\n## Repositories Configuration\nRepositories configuration is located under `repositories` key.  \nIt is responsible for providing information on what repositories should be added to the image.  \n\n```yaml\nrepositories:\n  - name: docker\n    gpg: https://download.docker.com/linux/ubuntu/gpg\n    url: https://download.docker.com/linux/ubuntu\n    release: jammy\n    component: stable\n    key_name: docker-archive-keyring\n```\n\n**Keys:**\n- `name` - name of the repository. (used to generate lists file name in `/etc/apt/sources.list.d/`)\n- `gpg` - URL to GPG key file.\n- `url` - URL to repository.\n- `release` - release of the repository.\n- `component` - component of the repository.\n- `key_name` - name of the key file in `/usr/share/keyrings/`. (extension is added automatically)\n\n## Qemu Configuration\nQemu configuration is located under `qemu` key.  \nIt is responsible for providing information on what qemu options should be used when creating the template.  \nMost of the time, you would use this configuration to skip some of the configuration steps to speed up the process.  \nIf any of the options are not provided, application would prompt you to provide them during the process.  \nIf all of the options are provided, application would skip the configuration step and use provided values.\n\n```yaml\nqemu:\n  identifier: 9000\n  name: ubuntu-cloudinit\n  image: /etc/ptm/images/ubuntu-21.10-minimal-amd64.img\n  resources:\n    cores: 2\n    memory: 2G\n    cpu_type: host\n  storage:\n    name: local-lvm\n    resize: 4G\n  network:\n    driver: virtio\n    bridge: vmbr0\n```\n\n**Keys:**\n- `identifier` - identifier of the template.\n- `name` - name of the template.\n- `image` - path to the image file.\n- `resources` - resources configuration.\n  - `cores` - number of cores.\n  - `memory` - amount of memory.\n  - `cpu_type` - type of CPU.\n- `storage` - storage configuration.\n  - `name` - name of the storage. (refers to the storage name in Proxmox VE, for example, `local-lvm`)\n  - `resize` - amount of disk space to allocate for the template. (used to resize the image file)\n- `network` - network configuration.\n  - `driver` - driver to use for the network interface.\n  - `bridge` - bridge to use for the network interface.\n\n## Cloud-Init Configuration\nCloud-Init configuration is located under `cloud_init` key.  \nIt is responsible for providing information on what cloud-init configuration should be used when creating the template.  \nMost of the time, you would use this configuration to skip some of the configuration steps to speed up the process.  \nIf any of the options are not provided, application would prompt you to provide them during the process.  \nIf all of the options are provided, application would skip the configuration step and use provided values.  \nAll of them are optional, but if `enabled` is set to `true`, application will \"autoconfigure\" IPv4 and IPv6 addresses. (DHCP)\n\n```yaml\ncloud_init:\n  enabled: true\n  username: administrator\n  password: 12345678\n  ssh_authorized_keys:\n    - /root/.ssh/administrator.pub\n    - ssh-rsa AAAAB3NzaC1yc2EAAA\n  network:\n    ipv4:\n      auto_configure: true\n      ip: 127.0.0.10/24\n      gateway: 127.0.0.1\n    ipv6:\n      auto_configure: true\n      ip: ::1/128\n      gateway: ::1\n```\n\n**Keys:**\n- `enabled` - whether cloud-init should be enabled.\n- `username` - username of the user that should be created.\n- `password` - password of the user that should be created.\n- `ssh_authorized_keys` - list of paths to SSH public keys that should be added to the user.\n  - You can provide keys as a string.\n  - You can provide keys as a path to a file.\n- `network` - network configuration.\n  - `ipv4` - IPv4 configuration.\n    - `auto_configure` - whether IPv4 should be autoconfigured. (manual settings for `ip` and `gateway` will be ignored if set to `true`)\n    - `ip` - IPv4 address.\n    - `gateway` - IPv4 gateway.\n  - `ipv6` - IPv6 configuration.\n    - `auto_configure` - whether IPv6 should be autoconfigured. (manual settings for `ip` and `gateway` will be ignored if set to `true`)\n    - `ip` - IPv6 address.\n    - `gateway` - IPv6 gateway.\n\n## Unattended Upgrades Configuration\nUnattended Upgrades configuration is located under `unattended_upgrades` key.  \nIt is responsible for providing information on what unattended upgrades configuration should be used when customizing the image.  \nIf not present, application will not try to setup unattended upgrades.  \n\n```yaml\nunattended_upgrades:\n  enabled: true\n  whitelist:\n    - \"${distro_id}:${distro_codename}\"\n    - \"${distro_id}:${distro_codename}-security\"\n    - \"${distro_id}ESMApps:${distro_codename}-apps-security\"\n    - \"${distro_id}ESM:${distro_codename}-infra-security\"\n    - \"${distro_id}:${distro_codename}-updates\"\n    - \"Docker:${distro_codename}\"\n    - \"InfluxDB:stable\"\n  blacklist: []\n  dev_release: \"auto\"\n  fix_interrupted: true\n  minimal_steps: true\n  install_on_shutdown: false\n  remove_unused_kernel: true\n  remove_unused_dependencies: true\n  remove_unused_auto_depend: true\n  automatic_reboot: true\n  automatic_reboot_with_users: true\n  automatic_reboot_time: \"04:00\"\n```\n\n**Keys:**\n- `enabled` - whether unattended upgrades should be enabled.\n- `whitelist` - list of origins that should be whitelisted.\n- `blacklist` - list of packages that should be blacklisted.\n- `dev_release` - whether unattended upgrades should use development release.\n- `fix_interrupted` - whether unattended upgrades should fix interrupted upgrades.\n- `minimal_steps` - whether unattended upgrades should use minimal steps.\n- `install_on_shutdown` - whether unattended upgrades should install updates on shutdown.\n- `remove_unused_kernel` - whether unattended upgrades should remove unused kernel.\n- `remove_unused_dependencies` - whether unattended upgrades should remove unused dependencies.\n- `remove_unused_auto_depend` - whether unattended upgrades should remove unused auto dependencies.\n- `automatic_reboot` - whether system should automatically reboot.\n- `automatic_reboot_with_users` - whether system should automatically reboot with users.\n- `automatic_reboot_time` - time when system should automatically reboot.\n\n## Minimal Configuration\nAlthough application does not require you to have any configuration, it is still required to have configuration file created.\n\n# Usage\nThis section describes how to use the application.\n\n## Commands\nThe following commands are available:\n- `version` - displays application version.\n- `help` - displays help message.\n- `customize` - allows user to customize the image.\n- `make` - allows user to create the template.\n\n## Customize\nThis command allows you to customize the image.  \nIt will ask you for all the required information and then it will download (if missing) and customize the image.  \nYou can use `--help` argument to display help message for this command.  \n\n## Make\nThis command allows you to create the template.  \nIt will ask you for all the required information and then it will create the template.\nYou can use `--help` argument to display help message for this command.  \n\n### Prompt Flow\nIn prompt flow mode (assuming you have not provided flags or configuration options to make configuration valid), application will ask you for all the required information.  \nIt will guide you through the process and ask you for all the required information.  \nUpon completion, it will create the template.  \n\n### Configuration Flow\nIn configuration flow mode (assuming you have provided complete configuration - this includes `qemu` and `cloud_init` configuration), application will skip the prompt flow and use provided configuration.  \nIt will create the template using provided configuration.\n\n### Flags Flow\nIn flags flow mode (assuming you have provided flags), application will skip the prompt flow and use provided flags.  \nThe caveat of this flow is that you must provide almost all of the flags.  \nIt will create the template using provided flags.  \nIt is ideal for automation purposes.\n\n**Here is the list of flags that you must provide:**\n- `--identifier` - Identifier of template ***(required)***\n- `--name` - Name of the template ***(required)***\n- `--cores` - Number of cpu cores ***(required)***\n- `--cpu-type` - Desired cpu type (host / kvm64 / etc) ***(required)***\n- `--memory` - Amount of memory (example: 1024 / 1024M / 1G) ***(required)***\n- `--storage` - Disk storage (local-lvm / local / etc) ***(required)***\n- `--image` - Path to the image (/etc/ptm/images/image.qcow2) ***(required)***\n- `--mage-new-size` - Size to which the image should be resized (example: 4G) *(optional)*\n- `--network-driver` - Network driver (virtio / e1000 / etc) ***(required)***\n- `--network-bridge` - Network bridge (vmbr0 / vmbr1 / etc) ***(required)***\n- `--ci-username` - Username for cloud-init *(optional)*\n- `--ci-password` - Password for cloud-init *(optional)*\n- `--ci-ssh-keys` - Comma-separated list of SSH keys for cloud-init *(optional)*\n- `--ci-ipv4-auto` - Automatically configure IPv4 for cloud-init\n- `--ci-ipv6-auto` - Automatically configure IPv6 for cloud-init\n- `--ci-ipv4-address` - Manually set IPv4 address for cloud-init (example: 10.10.10.10/24) (not required when `--ci-ipv4-auto` flag is used)\n- `--ci-ipv6-address` - Manually set IPv6 address for cloud-init (example: 2001:db8::1/64) (not required when `--ci-ipv4-auto` flag is used)\n- `--ci-ipv4-gateway` - Manually set IPv4 gateway for cloud-init (example: 10.10.10.1) (not required when `--ci-ipv6-auto` flag is used)\n- `--ci-ipv6-gateway` - Manually set IPv6 gateway for cloud-init (example: 2001:db8::1) (not required when `--ci-ipv6-auto` flag is used)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarki73%2Fptm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarki73%2Fptm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarki73%2Fptm/lists"}