{"id":16779764,"url":"https://github.com/petermosmans/easy-provisioning","last_synced_at":"2026-03-08T23:34:17.304Z","repository":{"id":75895113,"uuid":"70025469","full_name":"PeterMosmans/easy-provisioning","owner":"PeterMosmans","description":"Provisioning systems made easy: A collection of Ansible, Packer, Vagrant and Virtualbox configuration and preseed files.","archived":false,"fork":false,"pushed_at":"2017-07-05T07:43:43.000Z","size":56,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T20:56:42.902Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PeterMosmans.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":"2016-10-05T02:51:54.000Z","updated_at":"2024-08-08T13:13:56.000Z","dependencies_parsed_at":"2023-07-12T00:16:26.891Z","dependency_job_id":null,"html_url":"https://github.com/PeterMosmans/easy-provisioning","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/PeterMosmans/easy-provisioning","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterMosmans%2Feasy-provisioning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterMosmans%2Feasy-provisioning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterMosmans%2Feasy-provisioning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterMosmans%2Feasy-provisioning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PeterMosmans","download_url":"https://codeload.github.com/PeterMosmans/easy-provisioning/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PeterMosmans%2Feasy-provisioning/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30277033,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T20:45:49.896Z","status":"ssl_error","status_checked_at":"2026-03-08T20:45:49.525Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-10-13T07:32:11.684Z","updated_at":"2026-03-08T23:34:17.270Z","avatar_url":"https://github.com/PeterMosmans.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# easy-provisioning\n\n*Scripts for putting the words* **fun** *and* **easy** *back in provisioning...*\n\n\nI'm a big fan of the DevOps attitude of \"cattle\" versus \"pets\": machines should be built in a repeatable, automated and consistent way. If there's something wrong, don't be afraid to replace a sick \"cow\" instead of trying to revive your \"pet\".\nThis mindset also helps when preparing for demo's and workshops: Usually I need a number of machines, and what better way than create them by using automation ? For that I'm using the tools Ansible, Packer, Vagrant and VirtualBox - they are all Open Source and can be used on a number of platforms (e.g. Windows, Linux and Mac OS X).\n\n**Packer** creates a machine image by installing an operating system to a multitude of local and cloud platforms, for example VMWare, VirtualBox as well as Docker, Amazon EC2 and DigitalOcean. Packer is licensed under the Mozilla Public License Version 2.0.\n\n**VirtualBox** is a virtualization environment for local use, licensed under the GNU General Public License version 2.\n\n**Vagrant** is a tool for managing virtual machines and is licensed under the MIT license.\n\n**Ansible** is a tool for managing systems and deploying applications, licensed under the GNU General Public License version 3 (my personal favorite).\n\nThis repository contains (example) scripts to setup an Ansible server, and Kali Vagrantbox installation, both automatically provisioned using Ansible. All commands are executed on the HOST system, unless specified otherwise.\n\n### Prerequisites\n1. Make sure that the following tools are installed, up-to-date and can be executed from the command line.\n\n  **packer** : [https://packer.io/](https://packer.io/) (to build operating systems unattended)\n  \n  **Vagrant** : [https://www.vagrantup.com](https://www.vagrantup.com) (to configure and spin up virtual machines)\n  \n  **VirtualBox** : [https://www.virtualbox.org/wiki/Downloads](https://www.virtualbox.org/wiki/Downloads) (the virtualization environment)\n2. Start your favorite shell (e.g. zsh or Bash), and verify the tools:\n\n  `packer version \u0026\u0026 vagrant version \u0026\u0026 VBoxManage --version \u0026\u0026 echo \"Hey Ho Let's Go\"`\n\n3. Clone this repository\n\n  ` git clone https://github.com/PeterMosmans/easy-provisioning \u0026\u0026 pushd easy-provisioning`\n\n### 1: Bootstrap an Ansible server\nEnd goal: *a Vagrantbox containing Ansible, provisioned using Ansible.*\n\n##### 1a: Build and provision Ansible on Debian\n`pushd vagrant/ansible-server \u0026\u0026 VAGRANT_VAGRANTFILE=Vagrantfile.bootstrap vagrant up`\n\nThis will spin up a Debian box named `bootstrap`, install Ansible on it, and provision it for use with VirtualBox. Furthermore it will compact the box, and shut it down afterwards.\n\nOptionally you can add your username, public SSH key and other personal variables in the file `ansible/group_vars/personal.yml`\n\n##### 1b: Package the Ansible server\nUse the following command to package it as a new Vagrantbox, and add it to the local catalog, ready to be used as Ansible server:\n\n`VAGRANT_VAGRANTFILE=Vagrantfile.bootstrap vagrant package bootstrap --output ansible-server.box \u0026\u0026 vagrant box add ansible-server.box --name ansible-server`\n\nAlternatively, you can add it to the local catalog versioned. For this, you need to have `openssl` installed, as it computes a checksum of the boxfile:\n\n`VAGRANT_VAGRANTFILE=Vagrantfile.bootstrap vagrant package bootstrap --output ansible-server.box \u0026\u0026 sed -i s/CHECKSUM/$(openssl sha1 ansible-server.box|cut -d ' ' -f2)/g ansible-server.json \u0026\u0026 sed -i s/VERSION/$(date +%Y%m%d.0.0)/g ansible-server.json \u0026\u0026 vagrant box add ansible-server.json`\n\n\nThat's it! Now, you can spin up the Ansible server box anytime using the command\n`vagrant up` in the `vagrant/ansible-server` directory. The directory `/ansible` in the repository is mapped to `/etc/ansible`, so the Ansible configuration (including roles and playbooks) persists across Vagrant 'reboots'.\n\nYou can remove the `bootstrap` box using `VAGRANT_VAGRANTFILE=Vagrantfile.bootstrap vagrant destroy`. The `ansible-server.box` can removed as well, when it has been added to the local catalog.\n\n### 2: Install Kali Linux 2016.2 as a Vagrantbox\nEnd goal: *A Vagrantbox containing Kali Linux 2016.2, provisioned using Ansible*\n\n##### 2a: Install Kali\nFirst, let Packer create a VirtualBox installation of Kali 2016.2 that can be imported. You can place the ISO image in the directory `ISO/`, or, if the correct ISO cannot be found in the ISO folder, Packer optionally downloads the latest ISO image of Kali.\n\n`pushd packer \u0026\u0026 packer build kali-2016.2.json`\n\nThe build process will create an OVA file in the directory `output-kali` that can be directly imported into VirtualBox. Note that the root password is `r00tme`, the SSH server will be enabled on boot and allows root to log in: In other words, it's insecure. That's why it's important to harden it using Ansible.\n\n##### 2b: Run Kali as VirtualBox appliance\nImport the box and create a mapping so that port 22 (the SSH server) can be accessed from the Ansible server:\n\n`MYNAME=kali-2016.2 \u0026\u0026 VBoxManage import \"output-kali-2016.2/kali-2016.2.ova\" --vsys 0 --vmname \"$MYNAME\" \u0026\u0026 VBoxManage modifyvm \"$MYNAME\" \"--natpf1\" \"guestssh,tcp,,221,,22\" \u0026\u0026 VBoxManage startvm \"$MYNAME\"`\n\n##### 2c: Connect to Kali from the Ansible server\nSpin up an Ansible box (see the first example) and check if you can connect to Kali from Ansible. Note that the server can access Kali on the mapped port (221) of **the gateway address**.\nFor this, add the host to `/etc/ansible/hosts` file.\n\nFirst, connect to `ansible-server` by using `vagrant ssh` in \n\n`echo \"kali ansible_host=$(sudo route -n|awk '/UG/{print $2}') ansible_port=221 ansible_ssh_extra_args='-o StrictHostKeyChecking=no'\"\u003e\u003e /etc/ansible/hosts`\nThe `/etc/ansible` folder is mapped to the `ansible` folder of the repository and is therefore persistent across Vagrant reboots/restarts.\nFirst make sure that the hostkey of kali is added to the vagrant server\nThe following command tests whether Kali can be reached from `ansible-server`:\n\n\n`ansible kali -m ping -u root --ask-pass`\n\nIf this succeeds, the system is all set for provisioning.\n\n##### 2d: Provision Kali\n\nOn `ansible-server`, install the necessary roles on Ansible:\n\n`ansible-galaxy install -r /etc/ansible/requirements.yml`\n\nWhile on `ansible-server`, run the playbook\n\n`pushd /playbooks \u0026\u0026 ansible-playbook kali.yml -u root --ask-pass`\n\nThis will provision kali.\n\n\n##### 2e: Package Kali as Vagrant box\n\nOn the host, compact the virtual machine, package it as versioned box and import it:\n`MYNAME=kali-2016.2 \u0026\u0026 ssh root@127.0.0.1 -p 221 \"/usr/bin/compact_box.sh\" ; vagrant package --base ${NAME} --output ${MYNAME}.box \u0026\u0026 sed -i s/CHECKSUM/$(openssl sha1 ${MYNAME}.box|cut -d ' ' -f2)/g ${MYNAME}.json \u0026\u0026 sed -i s/VERSION/$(date +%Y%m%d.0.0)/g ${MYNAME}.json \u0026\u0026 vagrant box add ${MYNAME}.json`\n\nThat's it! Now, you can spin up the Ansible server box anytime using the command\n`vagrant up` in the `vagrant/kali` directory (similar to the Ansible server).\n\nYou can remove the `.box` files: as soon as they are added to Vagrant they are stored 'internally', on a different location.\n\n# Packer templates and preseed files\n## Kali 2016.2\nThe template `kali-2016.2` will install the latest version of Kali 2016.2, and prepare it for use with other provisioning tools. It uses the `kali-packer.cfg` preseed file, which is the vanilla preseed file for Kali 2016.2, with a minimal addition in order to use it with Packer.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetermosmans%2Feasy-provisioning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetermosmans%2Feasy-provisioning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetermosmans%2Feasy-provisioning/lists"}