Commit initial set of files for containerd-runc environment

Commit Vagrantfile, external YAML data file, Ansible configuration file, and Ansible playbook for containerd-runc environment. Environment is functional at a basic level.
This commit is contained in:
Scott Lowe 2016-03-27 13:33:38 -06:00
parent 2e46cae078
commit d25f50f81f
4 changed files with 116 additions and 0 deletions

60
containerd-runc/Vagrantfile vendored Normal file
View file

@ -0,0 +1,60 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Specify Vagrant version, Vagrant API version, and desired clone location
Vagrant.require_version '>= 1.8.0'
VAGRANTFILE_API_VERSION = '2'
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'vmware_fusion'
ENV['VAGRANT_VMWARE_CLONE_DIRECTORY'] = '~/.vagrant'
#ENV['VAGRANT_DEFAULT_PROVIDER'] = 'virtualbox'
# Require 'yaml' module
require 'yaml'
# Read YAML file with VM details (box, CPU, RAM, IP addresses)
machines = YAML.load_file(File.join(File.dirname(__FILE__), 'machines.yml'))
# Create and configure the VMs
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Always use Vagrant's default insecure key
config.ssh.insert_key = false
# Iterate through entries in YAML file to create VMs
machines.each do |machine|
config.vm.define machine['name'] do |srv|
# Don't check for box updates
srv.vm.box_check_update = false
srv.vm.hostname = machine['name']
srv.vm.box = machine['box']
# Configure default synced folder (disable by default)
if machine['sync_disabled'] != nil
srv.vm.synced_folder '.', '/vagrant', disabled: machine['sync_disabled']
else
srv.vm.synced_folder '.', '/vagrant', disabled: true
end #if machine['sync_disabled']
# Configure CPU & RAM per settings in machines.yml (Fusion)
srv.vm.provider :vmware_fusion do |vmw|
vmw.vmx['memsize'] = machine['ram']
vmw.vmx['numvcpus'] = machine['vcpu']
if machine['nested'] == true
vmw.vmx['vhv.enable'] = 'TRUE'
end #if machine['nested']
end # srv.vm.provider vmware_fusion
# Configure CPU & RAM per settings in machines.yml (VirtualBox)
srv.vm.provider :virtualbox do |vb|
vb.memory = machine['ram']
vb.cpus = machine['vcpu']
end # srv.vm.provider virtualbox
# Provision Docker on appropriate VMs
if machine['provision'] != nil
srv.vm.provision 'ansible', playbook: machine['provision']
end # if machine['provision']
end # config.vm.define
end # machines.each
end # Vagrant.configure

View file

@ -0,0 +1,5 @@
[defaults]
inventory = ./.vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory
private_key_file = ~/.vagrant.d/insecure_private_key
remote_user = vagrant
host_key_checking = False

View file

@ -0,0 +1,45 @@
---
- hosts: "all"
sudo: "yes"
remote_user: "vagrant"
gather_facts: false
tasks:
- name: "Bootstrap node"
raw: "apt-get install -y python python2.7"
- name: "Download containerd"
get_url:
url: "https://github.com/docker/containerd/releases/download/0.0.5/containerd"
dest: "/usr/local/bin/containerd"
mode: "0755"
- name: "Download containerd-shim"
get_url:
url: "https://github.com/docker/containerd/releases/download/0.0.5/containerd-shim"
dest: "/usr/local/bin/containerd-shim"
mode: "0755"
- name: "Download runc"
get_url:
url: "https://github.com/docker/containerd/releases/download/0.0.5/runc"
dest: "/usr/local/bin/runc"
mode: "0755"
- name: "Download ctr"
get_url:
url: "https://github.com/docker/containerd/releases/download/0.0.5/ctr"
dest: "/usr/local/bin/ctr"
mode: "0755"
- name: "Set properties for downloaded files"
file:
path: "{{ item }}"
owner: "root"
group: "root"
mode: "0755"
with_items:
- /usr/local/bin/containerd
- /usr/local/bin/runc
- /usr/local/bin/ctr
- /usr/local/bin/containerd-shim

View file

@ -0,0 +1,6 @@
---
- name: runc-01
box: slowe/ubuntu-15.10-server-amd64
ram: 1024
vcpu: 1
provision: containerd-runc.yml