In order to make contributing easy, all projects should have an automated way to create a development environment. This might be as simple as a Python virtual environment, or it could be a virtual machine or container. This document provides guidelines for setting up development environments.
Ansible is used throughout Fedora Infrastructure to automate tasks. If the project requires anything more than a Python virtual environment to be set up, you should use Ansible to automate the setup.
Vagrant is a tool to provision virtual machines. It allows you to define a base image (called a "box"), virtual machine resources, network configuration, directories to share between the host and guest machine, and much more. It can be configured to use libvirt to provision the virtual machines.
You can install Vagrant on a Fedora host with:
$ sudo dnf install libvirt vagrant vagrant-libvirt vagrant-sshfs
You can combine your Ansible playbook with Vagrant very easily. Simply point Vagrant to your Ansible playbook and it will run it. Users who would prefer to provision their virtual machines in some other way are free to do so and only need to run the Ansible playbook on their host.
How a project lays out its development-related content is up to the
individual project, but a good approach is to create a
Below is a Vagrantfile that provisions a Fedora 25 virtual machine,
updates it, and runs an Ansible playbook on it. You can place it in the
root of your repository as
Vagrantfile.example and instruct users to
copy it to
Vagrantfile and customize as they wish.
# -*- mode: ruby -*- # vi: set ft=ruby : # # Copy this file to ``Vagrantfile`` and customize it as you see fit. VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # If you'd prefer to pull your boxes from Hashicorp's repository, you can # replace the config.vm.box and config.vm.box_url declarations with the line below. # # config.vm.box = "fedora/25-cloud-base" config.vm.box = "f25-cloud-libvirt" config.vm.box_url = "https://download.fedoraproject.org/pub/fedora/linux/releases"\ "/25/CloudImages/x86_64/images/Fedora-Cloud-Base-Vagrant-25-1"\ ".3.x86_64.vagrant-libvirt.box" # Forward traffic on the host to the development server on the guest. # You can change the host port that is fo