{"id":16060839,"url":"https://github.com/geerlingguy/ansible-role-packer-debian","last_synced_at":"2025-04-09T23:21:45.844Z","repository":{"id":17519192,"uuid":"20307173","full_name":"geerlingguy/ansible-role-packer-debian","owner":"geerlingguy","description":"Ansible Role - Packer Debian/Ubuntu Configuration for Vagrant VirtualBox","archived":false,"fork":false,"pushed_at":"2025-01-31T03:25:27.000Z","size":38,"stargazers_count":39,"open_issues_count":0,"forks_count":40,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T22:04:16.128Z","etag":null,"topics":["ansible","box","build","debian","fusion","hashicorp","packer","role","ubuntu","virtualbox","vmware"],"latest_commit_sha":null,"homepage":"https://galaxy.ansible.com/geerlingguy/packer-debian/","language":null,"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/geerlingguy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"geerlingguy","patreon":"geerlingguy"}},"created_at":"2014-05-29T20:18:38.000Z","updated_at":"2025-02-01T13:12:02.000Z","dependencies_parsed_at":"2024-01-25T04:51:34.237Z","dependency_job_id":null,"html_url":"https://github.com/geerlingguy/ansible-role-packer-debian","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fansible-role-packer-debian","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fansible-role-packer-debian/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fansible-role-packer-debian/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geerlingguy%2Fansible-role-packer-debian/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geerlingguy","download_url":"https://codeload.github.com/geerlingguy/ansible-role-packer-debian/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248126404,"owners_count":21051916,"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":["ansible","box","build","debian","fusion","hashicorp","packer","role","ubuntu","virtualbox","vmware"],"created_at":"2024-10-09T04:06:44.684Z","updated_at":"2025-04-09T23:21:45.818Z","avatar_url":"https://github.com/geerlingguy.png","language":null,"funding_links":["https://github.com/sponsors/geerlingguy","https://patreon.com/geerlingguy"],"categories":[],"sub_categories":[],"readme":"# Ansible Role: Packer Debian/Ubuntu Configuration for Vagrant VirtualBox\n\n[![CI](https://github.com/geerlingguy/ansible-role-packer-debian/actions/workflows/ci.yml/badge.svg)](https://github.com/geerlingguy/ansible-role-packer-debian/actions/workflows/ci.yml)\n\nThis role configures Debian/Ubuntu (either minimal or full install) in preparation for it to be packaged as part of a .box file for Vagrant/VirtualBox or Vagrant/Vmware_desktop deployment using [Packer](http://www.packer.io/).\n\n## Requirements\n\nPrior to running this role via Packer, you need to make sure Ansible is installed via a shell provisioner, and that preliminary VM configuration (like adding a vagrant user to the appropriate group and the sudoers file) is complete, generally by using a Kickstart installation file (e.g. `ks.cfg`) or [preseeding](https://help.ubuntu.com/lts/installation-guide/s390x/apbs02.html) with Packer. An example array of provisioners for your Packer .json template looks something like:\n\n```json\n\"provisioners\": [\n  {\n    \"type\": \"shell\",\n    \"execute_command\": \"echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'\",\n    \"script\": \"scripts/ansible.sh\"\n  },\n  {\n    \"type\": \"ansible-local\",\n    \"playbook_file\": \"ansible/main.yml\",\n    \"role_paths\": [\n      \"/Users/jgeerling/Dropbox/VMs/roles/geerlingguy.packer-debian\",\n    ]\n  }\n],\n```\n\nThe files should contain, at a minimum:\n\n**scripts/ansible.sh**:\n\nAn example for Ubuntu 16.04\n\n```bash\n#!/bin/bash -eux\n# Install Ansible repository and Ansible.\napt -y install software-properties-common\napt-add-repository ppa:ansible/ansible\napt-get update\napt-get install ansible\n```\n\nAn example for Debian 8.8\n\n```bash\n#!/bin/bash -eux\n# Install Ansible repository and Ansible.\napt -y install software-properties-common\necho \"deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main\" | tee -a /etc/apt/sources.list\napt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367\napt -y update\napt -y install ansible\n```\n\n**ansible/main.yml**:\n\n```yaml\n---\n- hosts: all\n  sudo: yes\n  gather_facts: yes\n  roles:\n    - geerlingguy.packer-debian\n```\n\nYou might also want to add another shell provisioner to run cleanup, erasing free space using `dd`, but this is not required (it will just save a little disk space in the Packer-produced .box file).\n\nIf you'd like to add additional roles, make sure you add them to the `role_paths` array in the template .json file, and then you can include them in `main.yml` as you normally would. The Ansible configuration will be run over a local connection from within the Linux environment, so all relevant files need to be copied over to the VM; configuratin for this is in the template .json file. Read more: [Ansible Local Provisioner](http://www.packer.io/docs/provisioners/ansible-local.html).\n\n## Role Variables\n\nAvailable variables are listed below, along with default values (see defaults/main.yml):\n\n    vmware_install_open_vm_tools: false\n\n(VMware only) Using the `vmware_install_open_vm_tools` variable, you can select what kind of integration components will be installed into the VMware box. The default (`false`) installs VMware Tools, and not `open-vm-tools`.\n\nRead more:\n\n  - [open-vm-tools](https://sourceforge.net/projects/open-vm-tools/)\n  - [open-vm-tools on GitHub](https://github.com/vmware/open-vm-tools)\n  - [VMware support for Open VM Tools (2073803)](https://kb.vmware.com/selfservice/microsites/search.do?language=en_US\u0026cmd=displayKC\u0026externalId=2073803)\n  - [VMware Tools](https://kb.vmware.com/selfservice/search.do?cmd=displayKC\u0026docType=kc\u0026docTypeID=DT_KB_1_1\u0026externalId=340)\n\n## Dependencies\n\nNone.\n\n## Example Playbook\n\n```yaml\n---\n- hosts: all\n  roles:\n    - geerlingguy.packer-debian\n```\n\n## License\n\nMIT / BSD\n\n## Author Information\n\nThis role was created in 2014 by [Jeff Geerling](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeerlingguy%2Fansible-role-packer-debian","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeerlingguy%2Fansible-role-packer-debian","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeerlingguy%2Fansible-role-packer-debian/lists"}