Skip to content

Commit

Permalink
Add flags to control Disk_Size & unattended-up
Browse files Browse the repository at this point in the history
During internal use of PICO for teaching purposes, two
issues often popped up:
1. Something kept breaking down (auth for example), due to
background updates
2. Students often used vs-code servers, which in a class of 90,
ate up the 10GB default disk space

These changes implement:
- "DISK_SIZE": An environment variable with value of the form
`XGB` with X being a numberic value, to control max disk size.
- "disable-unattended-upgrades": A Flag in the anisble config to
uninstall `unattended-upgrades`, preventing unwanted updates on
private deployments.
  • Loading branch information
pranayga committed Jan 6, 2021
1 parent 3841f13 commit 50940ee
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

require 'etc'

ENV['VAGRANT_EXPERIMENTAL'] = "disks"

# Extract suffix if working directory starts with prefix; otherwise return "".
def compute_auto_name_suffix(prefix = "picoCTF")
dirname = File.basename(Dir.getwd)
Expand All @@ -16,6 +18,7 @@ Vagrant.configure("2") do |config|

config.vm.define "shell", primary: true do |shell|
shell.vm.box = "ubuntu/bionic64"
shell.vm.disk :disk, size: (ENV['DISK_SIZE'] || "10GB"), primary: true
shell.vm.network "private_network", ip: (ENV['SIP'] || '192.168.2.3'), nic_type: "virtio"
shell.vm.network "forwarded_port", guest: 2376, host: 2223, auto_correct: true

Expand Down
7 changes: 7 additions & 0 deletions ansible/common/tasks/utils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,10 @@
]
environment:
DEBIAN_FRONTEND: noninteractive

- name: Disable unattended upgrades
apt:
state: absent
name: unattended-upgrades
purge: True
when: disable_unattended_upgrades | default(false) | bool
2 changes: 2 additions & 0 deletions infra_local/inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ all:
vars:
# SSH admin keys (Optional)
admin_keys : []
# Disable Unattended Upgrades
disable_unattended_upgrades : False

# Web automation and Features (Optional)
auto_add_web_admin : True
Expand Down
2 changes: 2 additions & 0 deletions infra_remote/inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ all:

# SSH admin keys (Optional)
admin_keys : []
# Disable Unattended Upgrades
disable_unattended_upgrades : False

## Web automation and Features (Optional):
# These are currently setup to fully configure and start an event. This
Expand Down

0 comments on commit 50940ee

Please sign in to comment.