{"id":22202524,"url":"https://github.com/jlduran/packer-freebsd","last_synced_at":"2025-07-27T04:31:53.190Z","repository":{"id":24054183,"uuid":"27440007","full_name":"jlduran/packer-FreeBSD","owner":"jlduran","description":"Build a FreeBSD VM for Vagrant using packer","archived":false,"fork":false,"pushed_at":"2024-11-23T13:04:23.000Z","size":136,"stargazers_count":29,"open_issues_count":7,"forks_count":14,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-23T14:19:59.521Z","etag":null,"topics":["cloud-init","freebsd","packer","qemu","vagrant","virtualbox"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/jlduran.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2014-12-02T15:54:56.000Z","updated_at":"2024-10-15T13:24:41.000Z","dependencies_parsed_at":"2022-08-07T11:00:53.234Z","dependency_job_id":"93b3a042-6be7-4a9b-a5f3-0a0ca0f9a710","html_url":"https://github.com/jlduran/packer-FreeBSD","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlduran%2Fpacker-FreeBSD","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlduran%2Fpacker-FreeBSD/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlduran%2Fpacker-FreeBSD/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlduran%2Fpacker-FreeBSD/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jlduran","download_url":"https://codeload.github.com/jlduran/packer-FreeBSD/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227762029,"owners_count":17815961,"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":["cloud-init","freebsd","packer","qemu","vagrant","virtualbox"],"created_at":"2024-12-02T16:30:01.489Z","updated_at":"2025-07-27T04:31:53.177Z","avatar_url":"https://github.com/jlduran.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!CAUTION]\n\u003e FreeBSD 14.0-RELEASE onwards is failing to build on VirtualBox.\n\npacker-FreeBSD\n==============\n\nThis repository contains the necessary tools to build a Vagrant-ready\nFreeBSD virtual machine using Packer.\n\n\u003e [!TIP]\n\u003e There are [official FreeBSD] VMs available from the Vagrant Cloud.\n\nPrerequisites\n--------------\n\n- [Packer]\n\n- [Vagrant]\n\n- [Parallels], [QEMU], [VirtualBox] or [VMWare Fusion]\n\nInstructions\n------------\n\nTo create a box:\n\n1.  Clone this repository:\n\n    ```console\n    $ git clone https://github.com/jlduran/packer-FreeBSD.git\n    $ cd packer-FreeBSD\n    ```\n\n2.  Initialize packer:\n\n    ```console\n    $ packer init .\n    ```\n\n3.  Build the box (`virtualbox-iso.freebsd` or `qemu.freebsd`):\n\n    ```console\n    $ packer build -only=virtualbox-iso.freebsd .\n    ```\n\n4.  Add it to the list of Vagrant boxes.  See\n    [Handling `.iso` and `.box` files](#handling-iso-and-box-files) for\n    more information.\n\n    ```console\n    $ vagrant box add builds/FreeBSD-14.3-RELEASE-amd64.box --name FreeBSD-14.3-RELEASE-amd64\n    ```\n\nSample `Vagrantbox` file\n------------------------\n\n```ruby\nservers = [\n  { name: 'www.local', cpus: 2, memory: 1024 },\n  { name: 'db.local', cpus: 1, memory: 2048 }\n]\n\nscript = \u003c\u003c-SCRIPT\n  sed -i '' \"s/Vagrant/$(hostname -s)/g\" /usr/local/etc/mDNSResponderServices.conf\n  service mdnsresponderposix restart\nSCRIPT\n\nansible_raw_arguments = []\n\nVagrant.configure(2) do |config|\n  servers.each do |server|\n    config.vm.define server[:name] do |box|\n      box.vm.box      = 'FreeBSD-14.3-RELEASE-amd64'\n      box.vm.hostname = server[:name]\n      box.vm.provider 'virtualbox' do |v|\n        v.default_nic_type       = 'virtio'\n        v.linked_clone           = true\n        v.name, v.cpus, v.memory = server.values_at(:name, :cpus, :memory)\n      end\n\n      if server == servers.last\n        box.vm.provision 'ansible' do |ansible|\n          ansible.compatibility_mode = '2.0'\n          ansible.limit              = 'all'\n          ansible.playbook           = 'site.yml'\n          ansible.inventory_path     = 'local'\n          ansible.raw_arguments      = ansible_raw_arguments\n        end\n      else\n        ansible_raw_arguments \u003c\u003c private_key_path(server[:name])\n      end\n    end\n  end\n\n  config.vm.provision 'shell', inline: script\nend\n\ndef private_key_path(server_name)\n  provider = ENV['VAGRANT_DEFAULT_PROVIDER'] || 'virtualbox'\n  vagrant_dotfile_path = ENV['VAGRANT_DOTFILE_PATH'] || '.vagrant'\n\n  \"--private-key=#{vagrant_dotfile_path}/machines/#{server_name}/\" \\\n    \"#{provider}/private_key\"\nend\n```\n\n------------------------------------------------------------------------\n\n### Build Options\n\nBelow is a sample `variables.pkrvars.hcl` file:\n\n```hcl\narch            = \"amd64\"\nbranch          = \"RELEASE\"\nbuild_date      = \"\"\ncpus            = 1\ndirectory       = \"releases\"\ndisk_size       = 10240\nfilesystem      = \"zfs\"\nzfs_compression = \"zstd\"\ngit_commit      = \"\"\nguest_os_type   = \"FreeBSD_64\"\nmemory          = 1024\nmirror          = \"https://download.freebsd.org\"\nrc_conf_file    = \"\"\nrevision        = \"14.3\"\n```\n\nThe following variables can be set:\n\n-   `cpus` is the number of CPUs assigned.  _Default:_ `1`\n\n-   `disk_size` is the HDD size in megabytes.  _Default:_ `10240`\n\n-   `memory` is the amount of RAM in megabytes assigned.  _Default:_\n    `1024`\n\n-   `revision` is the FreeBSD revision number.  _Default:_ `14.3`\n\n-   `branch` used in conjunction with `build_date`, `git_commit` and\n    `directory`.  _Default:_ `RELEASE`\n\n    See FreeBSD's [Release Branches] for more information.  Possible\n    values are:\n\n    | Branch                | Directory   |\n    | ------                | ---------   |\n    | `CURRENT`             | `snapshots` |\n    | `STABLE`              | `snapshots` |\n    | `ALPHA1`, `ALPHA2`, … | `snapshots` |\n    | `PRERELEASE`          | `snapshots` |\n    | `BETA1`, `BETA2`, …   | `releases`  |\n    | `RC1`, `RC2`, …       | `releases`  |\n    | `RELEASE`             | `releases`  |\n\n-   `arch` is the target architecture (`i386` or `amd64`).  _Default:_\n    `amd64`\n\n-   `guest_os_type` (VirtualBox) used in conjunction with `arch`\n    (`FreeBSD` or `FreeBSD_64`).  See [packer's\n    documentation](https://www.packer.io/docs/builders/virtualbox-iso.html#guest_os_type).\n    _Default:_ `FreeBSD_64`\n\n-   `filesystem` is the file system type (`ufs` or `zfs`).  _Default:_\n    `zfs`\n\n-   `zfs_compression` is the ZFS compression algorithm (`zstd` or `lz4`).\n    _Default:_ `zstd`\n\n-   `mirror` is the preferred FreeBSD mirror.  _Default:_\n    `https://download.freebsd.org`\n\n-   `rc_conf_file` is the file where `rc.conf` parameters are stored.\n    _Default: empty_ .  Possible values are:\n\n    | Value    | File                                          |\n    | -----    | ----                                          |\n    |          | `/etc/rc.conf`                                |\n    | `local`  | `/etc/rc.conf.local` (Its use is discouraged) |\n    | `vendor` | `/etc/defaults/vendor.conf`                   |\n    | `name`   | `(/usr/local)/etc/rc.conf.d/\u003cname\u003e`           |\n\nCreate a `variables.pkrvars.hcl` file overriding the default\nvalues, and invoke:\n\n```console\n$ packer build -var-file=\"variables.pkrvars.hcl\" .\n```\n\nYou can also select which components you wish to install.  By default,\nit runs the following provisioning scripts:\n\n| Name         | Description                                                               |\n| ----         | -----------                                                               |\n| [`update`]   | Updates to the latest patch level (if applicable) and the latest packages |\n| [`vagrant`]  | Vagrant-related configuration                                             |\n| [`zeroconf`] | Enables zero-configuration networking                                     |\n| [`ansible`]  | Installs python and CA Root certificates                                  |\n| [`vmtools`]  | Virtual Machine-specific utilities                                        |\n| [`cleanup`]  | Cleanup script (must be called last)                                      |\n\nThe following scripts are also available:\n\n| Name           | Description                      |\n| ----           | -----------                      |\n| [`cloud-init`] | Installs cloud-init              |\n| [`hardening`]  | Provides basic hardening options |\n| [`ports`]      | Installs the FreeBSD ports tree  |\n\n### Handling `.iso` and `.box` files\n\nPacker will automatically download the `.iso` image if it does not find\nthe right one under the `iso` directory.  Optionally, you can download\nthe `.iso` image and save it to the `iso` directory.\n\n`.box` files will be created under the `builds` directory.\n\n[official FreeBSD]: https://app.vagrantup.com/freebsd\n[Release Branches]: https://docs.freebsd.org/en/books/dev-model/#release-branches\n[Packer]: https://developer.hashicorp.com/packer/downloads#install\n[Parallels]: https://www.parallels.com\n[QEMU]: https://www.qemu.org/download/\n[Vagrant]: https://developer.hashicorp.com/vagrant/downloads\n[VirtualBox]: https://www.virtualbox.org/wiki/Downloads\n[VMWare Fusion]: https://www.vmware.com/products/fusion.html\n[`ansible`]: https://github.com/jlduran/packer-FreeBSD/blob/main/scripts/ansible.sh\n[`cleanup`]: https://github.com/jlduran/packer-FreeBSD/blob/main/scripts/cleanup.sh\n[`cloud-init`]: https://github.com/jlduran/packer-FreeBSD/blob/main/scripts/cloud-init.sh\n[`hardening`]: https://github.com/jlduran/packer-FreeBSD/blob/main/scripts/hardening.sh\n[`ports`]: https://github.com/jlduran/packer-FreeBSD/blob/main/scripts/ports.sh\n[`update`]: https://github.com/jlduran/packer-FreeBSD/blob/main/scripts/update.sh\n[`vagrant`]: https://github.com/jlduran/packer-FreeBSD/blob/main/scripts/vagrant.sh\n[`vmtools`]: https://github.com/jlduran/packer-FreeBSD/blob/main/scripts/vmtools.sh\n[`zeroconf`]: https://github.com/jlduran/packer-FreeBSD/blob/main/scripts/zeroconf.sh\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlduran%2Fpacker-freebsd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjlduran%2Fpacker-freebsd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlduran%2Fpacker-freebsd/lists"}