Giter Club home page Giter Club logo

devbox-ansible's Introduction

DevBox Ansible

Introduction

DevBox Ansible provides a multi server development environment using Vagrant and VirtualBox and is provisioned using Ansible.

Requirements

  • Vagrant
  • VirtualBox
  • Ansible

Configuration

The config.yaml file allows you to configure the servers by adding individual server settings to the servers list property. The example config.yaml file and accompanying playbooks, demonstrate setting up 4 servers in a load balanced infrastructure.

VM name

Use the name property to update the VirtualBox VM name. By default this is devbox.

name: devbox_www

Hostname

Use the hostname property to update the server hostname. By default this is devbox.

hostname: devbox-www

Memory

Use the memory property to update the amount of memory allocated to the VM . By default this is 1024.

memory: 2048

CPU

Use the cpus property to update the number of CPU's allocated to the VM . By default this is 1.

cpus: 2

Networks

By default, DevBox will create a private network with automatically assigned IP addresses for all the servers. Use ifconfig on the server to determine it's IP address. A static IP address can be assigned to a server by adding the ip property. The reserved private address space must be used when assigning IP addresses.

ip: "192.168.2.40"

A public IP address can also be given to a server by adding the public_ip property.

public_ip: "192.168.178.41"

By default, DevBox forwards port 22 (for SSH) on the guest machine to port 2222 on the host. To forward additional ports, add the forward_ports list property with guest and host properties set to the ports you want to forward.

forward_ports:
- guest: 80
  host: 8000
- guest: 443
  host: 44300

OS

Currently, DevBox only supports Ubuntu and defaults to version 16.04. To use a different version, change the os_version property. Supported versions are 14.04, 16.04'and 18.04.

os: "ubuntu"
os_version: "16.04"

You can also specify a particular Vagrant box to use. The will override the OS and server type properties.

box: "nginx-php"

If you require a particular version of a Vagrant box, use the box_version property.

box_version: "1"

Folders

By default, DevBox doesn't share/sync any folders between the guest and host machines. To share folders with the guest machine add the folders list property and map the host folder to the guest folder.

folders:
- map: ./public
  to: /var/www/public

To use NFS for a shared folder, add the type property.

folders:
- map: ./public
  to: /var/www/public
  type: nfs

To change the owner or group of the shared folder on the guest machine, add the owner and group properties.

folders:
- map: ./public
  to: /var/www/public
  owner: root
  group: www-data

To change the permissions of the shared folder on the guest machine, add the dmode and fmode properties. The default directory permissions (dmode) are 755 and the default file permissions (fmode) are 644.

folders:
- map: ./public
  to: /var/www/public
  dmode: 775
  fmode: 664

If the host path doesn't exsist, it can be created by setting the create property to true. By default, this is false.

folders:
- map: ./public
  to: /var/www/public
  create: true

Ansible inventory groups

DevBox creates an inventory for use with Ansible. By default all servers will be added to a 'devbox' inventory group. You can override this and add servers to different groups by using the group property.

group: devbox_www

Ansible provisioning

The provision.yaml file should be used to create an Ansible playbook used to provision the servers.

Ansible Galaxy Roles

To import Galaxy roles, create a requirements YAML file and set the galaxy_role_file property to it's location.

galaxy_role_file: requirements.yml

By default, DevBox will create a roles folder to store the imported roles. Use the galaxy_roles_path property to set the path of the roles folder to an alternative location.

galaxy_roles_path: ~/.ansible/roles

Debugging

Set the debug property to true to obtain detailed logging with connection debugging.

debug: true

Bash aliases

A number of default bash aliases are created for the VM. These can be found in the aliases file. Add any further aliases you require to this file before creating the VM.

devbox-ansible's People

Contributors

damianlewis avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

fhchina dragon-bn

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.