vagrant: add debug option

If debug is set to true in vagrant_variables.yml then during the vagrant
provision phase Ansible will run with -vvvv option

Signed-off-by: Sébastien Han <seb@redhat.com>
pull/1397/head
Sébastien Han 2017-03-28 12:00:32 +02:00
parent d82ad7778d
commit 2d0565b072
2 changed files with 24 additions and 22 deletions

43
Vagrantfile vendored
View File

@ -5,30 +5,29 @@ require 'yaml'
require 'time' require 'time'
VAGRANTFILE_API_VERSION = '2' VAGRANTFILE_API_VERSION = '2'
DEBUG = false
config_file=File.expand_path(File.join(File.dirname(__FILE__), 'vagrant_variables.yml')) config_file=File.expand_path(File.join(File.dirname(__FILE__), 'vagrant_variables.yml'))
settings=YAML.load_file(config_file) settings=YAML.load_file(config_file)
LABEL_PREFIX = settings['label_prefix'] ? settings['label_prefix'] + "-" : "" LABEL_PREFIX = settings['label_prefix'] ? settings['label_prefix'] + "-" : ""
NMONS = settings['mon_vms'] NMONS = settings['mon_vms']
NOSDS = settings['osd_vms'] NOSDS = settings['osd_vms']
NMDSS = settings['mds_vms'] NMDSS = settings['mds_vms']
NRGWS = settings['rgw_vms'] NRGWS = settings['rgw_vms']
NNFSS = settings['nfs_vms'] NNFSS = settings['nfs_vms']
RESTAPI = settings['restapi'] RESTAPI = settings['restapi']
NRBD_MIRRORS = settings['rbd_mirror_vms'] NRBD_MIRRORS = settings['rbd_mirror_vms']
CLIENTS = settings['client_vms'] CLIENTS = settings['client_vms']
NISCSI_GWS = settings['iscsi_gw_vms'] NISCSI_GWS = settings['iscsi_gw_vms']
PUBLIC_SUBNET = settings['public_subnet'] PUBLIC_SUBNET = settings['public_subnet']
CLUSTER_SUBNET = settings['cluster_subnet'] CLUSTER_SUBNET = settings['cluster_subnet']
BOX = settings['vagrant_box'] BOX = settings['vagrant_box']
BOX_URL = settings['vagrant_box_url'] BOX_URL = settings['vagrant_box_url']
SYNC_DIR = settings['vagrant_sync_dir'] SYNC_DIR = settings['vagrant_sync_dir']
MEMORY = settings['memory'] MEMORY = settings['memory']
ETH = settings['eth'] ETH = settings['eth']
DOCKER = settings['docker'] DOCKER = settings['docker']
USER = settings['ssh_username'] USER = settings['ssh_username']
DEBUG = settings['debug']
ASSIGN_STATIC_IP = !(BOX == 'openstack' or BOX == 'linode') ASSIGN_STATIC_IP = !(BOX == 'openstack' or BOX == 'linode')
DISABLE_SYNCED_FOLDER = settings.fetch('vagrant_disable_synced_folder', false) DISABLE_SYNCED_FOLDER = settings.fetch('vagrant_disable_synced_folder', false)
@ -111,7 +110,7 @@ ansible_provision = proc do |ansible|
end end
if DEBUG then if DEBUG then
ansible.verbose = '-vvv' ansible.verbose = '-vvvv'
end end
ansible.limit = 'all' ansible.limit = 'all'
end end

View File

@ -62,3 +62,6 @@ vagrant_sync_dir: /home/vagrant/sync
os_tuning_params: os_tuning_params:
- { name: kernel.pid_max, value: 4194303 } - { name: kernel.pid_max, value: 4194303 }
- { name: fs.file-max, value: 26234859 } - { name: fs.file-max, value: 26234859 }
# Debug mode, runs Ansible with -vvvv
debug: false