A versatile VM for DevOps purposes, provisioned with Ansible.
Find a file
2020-11-28 22:38:36 +00:00
provisioning Fixed roles path option in ansible.cfg 2020-11-28 22:38:36 +00:00
LICENSE Added basic provisioning 2020-03-18 22:58:58 +01:00
README.md Added a tip about how to run the provisioning from within the VM 2020-11-28 22:11:33 +00:00
Vagrantfile Add required roles using Ansible Galaxy 2020-11-25 23:52:26 +01:00

Ansible DevOps VM

A versatile VM for DevOps purposes, provisioned by Ansible.

Will bootstrap a Ubuntu VM using Vagrant and Virtualbox and install a stack of useful DevOps tools.

To provide a lightweight experience, the VM uses XFCE as a desktop environment.

Provided tools

  • Docker 19.03.5
  • Docker Compose 1.25.0
  • Ansible 2.9.4

Prerequisites

  • Vagrant 2.2.x
  • Virtualbox 6.x

Prerequisites

  • A server running Ubuntu or some other Debian-based distribution and working SSH access. (To try SATT in a local virtual machine, check out the Quickstart with Vagrant below)
  • Ansible on another Linux machine that will send SSH commands to the target server to provision it

Quickstart

Vagrant + Ansible on Linux

  1. Obtain Vagrant by downloading the corresponding package for your distribution, assuming Ubuntu in the next steps.

  2. Install the package by opening a Terminal and running:

    user@vmhost: ~$ sudo dpkg install <vagrant-package-name>.deb
    
  3. To check whether Vagrant was installed successfully, try running vagrant --version which must not return an error.

  4. Recommended: Install the Vagrant::Hostsupdate plugin that will automatically add the hostname of the virtual machine to the list of static hosts on your local machine (VM host). This allows you to later open e.g. nextcloud.satt.local in a browser from your local machine. Updates to the hosts file will require entering a sudo password:

    user@vmhost: ~$ vagrant plugin install vagrant-hostsupdater
    

    Note for VM host Windows 10 with WSL: This host update will currently have no effect outside of WSL, as the updated hosts file is only used within the WSL context, not Windows itself.

  5. Install Ansible:

    user@vmhost: ~$ sudo apt update && sudo apt upgrade
    user@vmhost: ~$ sudo apt install python3 python3-pip
    user@vmhost: ~$ pip3 install --user ansible
    
  6. Test ansible by running ansible --version

  7. Clone the repo:

    user@vmhost: ~$ git clone https://git.jotbe.io/jotbe/ansible-devops-vm.git
    
  8. Change to the local copy and try bootstrapping the VM (this will take a while and you might be asked for a sudo password):

    user@vmhost: ~$ cd ansible-devops-vm
    user@vmhost: ~/ansible-devops-vm$ vagrant up
    
  9. If everything went fine, you should be able to SSH into the machine by running vagrant ssh from within the same directory and the UI should work if you enabled it.

Vagrant on Windows 10 (no Ansible required)

Vagrant will bootstrap a VM, install Ansible und run the provisioning from within the VM, i.e. the Vagrant host does not need to have any Ansible installed.

  1. Download and install Virtualbox (Documentation)

  2. Obtain Vagrant by downloading and installing the corresponding package

  3. Clone this repository with Git or download and extract an archive

  4. Open a Command Prompt or Powershell window and navigate to the checked out repository / extracted archive.

  5. Run Vagrant with: vagrant up and wait patiently.

Vagrant + Ansible on Windows 10 using Windows Subsystem for Linux

  1. Download and install Virtualbox (Documentation)

  2. Follow the guide to install the Windows Subsystem for Linux. This SATT guide assumes Ubuntu 18.04 LTS

  3. Open Ubuntu through the Windows Start Menu

  4. Inside the Ubuntu Terminal, continue the setup by following the next section.

Default user

By default, a vagrant user will be provisioned (if not already available) and used throughout the provisioning. The default password is vagrant.

Tips

Run the provisioning from within the VM on demand

Open a terminal and run:

ansible-playbook -i /vagrant/provisioning/inventory.sample /vagrant/provisioning/playbook.yml -c local

This will not try to connect to itself via SSH using the defined IP address but instead uses the local connection.