mirror of
https://codeberg.org/scottslowe/learning-tools.git
synced 2026-03-11 09:04:37 +00:00
Merge pull request #40 from lowescott/containerd-runc
Commit initial set of files for containerd-runc environment
This commit is contained in:
commit
f94b2d5979
4 changed files with 138 additions and 0 deletions
72
containerd-runc/Vagrantfile
vendored
Normal file
72
containerd-runc/Vagrantfile
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# Specify minimum Vagrant version and Vagrant API version
|
||||
Vagrant.require_version '>= 1.8.0'
|
||||
VAGRANTFILE_API_VERSION = '2'
|
||||
|
||||
# Require 'yaml' module
|
||||
require 'yaml'
|
||||
|
||||
# Read YAML file with VM details (box, CPU, RAM, IP addresses)
|
||||
# Edit machines.yml to change VM configuration details
|
||||
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|
|
||||
|
||||
# Configure the VMs per details in machines.yml
|
||||
config.vm.define machine['name'] do |srv|
|
||||
|
||||
# Don't check for box updates
|
||||
srv.vm.box_check_update = false
|
||||
|
||||
# Specify the hostname of the VM
|
||||
srv.vm.hostname = machine['name']
|
||||
|
||||
# Specify the Vagrant box to use (use VMware box by default)
|
||||
srv.vm.box = machine['box']['vmw']
|
||||
|
||||
# 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']
|
||||
|
||||
# Iterate through networks as per settings in machines.yml
|
||||
machine['nics'].each do |net|
|
||||
if net['ip_addr'] == 'dhcp'
|
||||
srv.vm.network net['type'], type: net['ip_addr']
|
||||
else
|
||||
srv.vm.network net['type'], ip: net['ip_addr']
|
||||
end # if net['ip_addr']
|
||||
end # machine['nics'].each
|
||||
|
||||
# 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, override|
|
||||
vb.memory = machine['ram']
|
||||
vb.cpus = machine['vcpu']
|
||||
override.vm.box = machine['box']['vb']
|
||||
end # srv.vm.provider 'virtualbox'
|
||||
|
||||
# Provision the VMs
|
||||
srv.vm.provision 'shell', path: 'provision.sh', privileged: true
|
||||
end # config.vm.define
|
||||
end # machines.each
|
||||
end # Vagrant.configure
|
||||
5
containerd-runc/ansible.cfg
Normal file
5
containerd-runc/ansible.cfg
Normal 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
|
||||
11
containerd-runc/machines.yml
Normal file
11
containerd-runc/machines.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
- box:
|
||||
vmw: "bento/ubuntu-16.04"
|
||||
vb: "bento/ubuntu-16.04"
|
||||
name: "runc-01"
|
||||
nics:
|
||||
- type: "private_network"
|
||||
ip_addr: "192.168.100.101"
|
||||
provision: "containerd-runc.yml"
|
||||
ram: "512"
|
||||
vcpu: "1"
|
||||
50
containerd-runc/provision.sh
Normal file
50
containerd-runc/provision.sh
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Install curl if needed
|
||||
if [[ ! -e /usr/bin/curl ]]; then
|
||||
sudo apt-get -yqq install curl
|
||||
fi
|
||||
|
||||
# Download containerd, if it isn't already present on the system
|
||||
if [[ ! -e /usr/local/bin/containerd ]]; then
|
||||
|
||||
# Download containerd from GitHub
|
||||
curl -kLO https://github.com/docker/containerd/releases/download/0.0.5/containerd
|
||||
|
||||
# Move the downloaded binary to /usr/local/bin
|
||||
sudo mv containerd /usr/local/bin/containerd
|
||||
sudo chmod a+x /usr/local/bin/containerd
|
||||
fi
|
||||
|
||||
# Download containerd-shim, if it isn't already present on the system
|
||||
if [[ ! -e /usr/local/bin/containerd-shim ]]; then
|
||||
|
||||
# Download containerd-shim from GitHub
|
||||
curl -kLO https://github.com/docker/containerd/releases/download/0.0.5/containerd-shim
|
||||
|
||||
# Move the downloaded binary to /usr/local/bin
|
||||
sudo mv containerd-shim /usr/local/bin/containerd-shim
|
||||
sudo chmod a+x /usr/local/bin/containerd-shim
|
||||
fi
|
||||
|
||||
# Download ctr, if it isn't already present on the system
|
||||
if [[ ! -e /usr/local/bin/ctr ]]; then
|
||||
|
||||
# Download ctr from GitHub
|
||||
curl -kLO https://github.com/docker/containerd/releases/download/0.0.5/ctr
|
||||
|
||||
# Move the downloaded binary to /usr/local/bin
|
||||
sudo mv ctr /usr/local/bin/ctr
|
||||
sudo chmod a+x /usr/local/bin/ctr
|
||||
fi
|
||||
|
||||
# Download runc, if it isn't already present on the system
|
||||
if [[ ! -e /usr/local/bin/runc ]]; then
|
||||
|
||||
# Download runc from GitHub
|
||||
curl -kLO https://github.com/docker/containerd/releases/download/0.0.5/runc
|
||||
|
||||
# Move the downloaded binary to /usr/local/bin
|
||||
sudo mv runc /usr/local/bin/runc
|
||||
sudo chmod a+x /usr/local/bin/runc
|
||||
fi
|
||||
Loading…
Reference in a new issue