1
0
Fork 0
mirror of synced 2024-11-13 20:58:58 -05:00

Adding vagrant testbed

This commit is contained in:
hogenj 2015-03-03 15:25:34 -05:00
parent 4098e46527
commit d175f02e84
5 changed files with 118 additions and 0 deletions

60
test/Vagrantfile vendored Normal file
View file

@ -0,0 +1,60 @@
Vagrant.configure('2') do |config|
# configure box to use host http_proxy if
# vagrant-proxyconf is enabled
def configure_proxy(vm_def)
if Vagrant.has_plugin?("vagrant-proxyconf") && ENV['http_proxy']
vm_def.proxy.http = ENV['http_proxy']
vm_def.proxy.https = ENV['https_proxy']
vm_def.apt_proxy.http = ENV['http_proxy']
vm_def.apt_proxy.https = ENV['https_proxy']
vm_def.proxy.no_proxy = ENV['no_proxy']
end
end
DEFAULT_VAGRANT_BOX = 'rubicon/ubuntu1404-salt'
def set_box(vm_def)
vm_def.vm.box = ENV['VAGRANT_BOX'] || DEFAULT_VAGRANT_BOX
if ENV['VAGRANT_BOX_VERSION']
vm_def.vm.box_version = ENV['VAGRANT_BOX_VERSION']
vm_def.vm.box_check_update = false
end
end
def configure_vm_size(vm_def)
if ENV['VAGRANT_VM_MEM']
vm_def.vm.provider 'virtualbox' do |vb|
vb.memory = ENV['VAGRANT_VM_MEM']
end
end
if ENV['VAGRANT_VM_CPU']
vm_def.vm.provider 'virtualbox' do |vb|
vb.cpus = ENV['VAGRANT_VM_CPU']
end
end
end
config.vm.define :sudoers01 do |sudoers01|
configure_proxy(sudoers01)
set_box(sudoers01)
configure_vm_size(sudoers01)
sudoers01.vm.hostname = 'sudoers01'
sudoers01.vm.synced_folder 'roots/salt', '/srv/salt'
sudoers01.vm.synced_folder 'roots/pillar', '/srv/pillar'
sudoers01.vm.synced_folder '../sudoers', '/srv/salt/sudoers'
sudoers01.vm.provision :salt do |salt|
salt.minion_config = 'minion'
salt.run_highstate = true
salt.verbose = true
if ENV['salt_install_args']
salt.install_args = ENV['salt_install_args']
end
end
end
end

2
test/minion Normal file
View file

@ -0,0 +1,2 @@
master: localhost
file_client: local

View file

@ -0,0 +1,50 @@
sudoers:
users:
johndoe:
- 'ALL=(ALL) ALL'
- 'ALL=(root) NOPASSWD: /etc/init.d/httpd'
groups:
sudo:
- 'ALL=(ALL) ALL'
- 'ALL=(nodejs) NOPASSWD: ALL'
defaults:
generic:
- env_reset
- mail_badpass
- secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
user_list:
johndoe: '!requiretty'
ADMINS: '!lecture'
host_list:
www1: 'log_year, logfile=/var/log/sudo.log'
command_list:
PROCESSES: 'noexec'
runas_list:
root: '!set_logname'
aliases:
hosts:
WEBSERVERS:
- www1
- www2
- www3
users:
ADMINS:
- millert
- dowdy
- mikef
commands:
PROCESSES:
- /usr/bin/nice
- /bin/kill
- /usr/bin/renice
- /usr/bin/pkill
- /usr/bin/top
includedir: /etc/sudoers.d
included_files:
/etc/sudoers.d/extra-file:
users:
foo:
- 'ALL=(ALL) ALL'
groups:
bargroup:
- 'ALL=(ALL) NOPASSWD: ALL'

View file

@ -0,0 +1,3 @@
base:
'*':
- sudoers

3
test/roots/salt/top.sls Normal file
View file

@ -0,0 +1,3 @@
base:
'*':
- sudoers