diff --git a/Vagrantfile b/Vagrantfile index 8ca0e9530..6849725f6 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -29,13 +29,13 @@ vconfig = load_config([ provisioner = vconfig['force_ansible_local'] ? :ansible_local : vagrant_provisioner if provisioner == :ansible - playbook = "#{host_drupalvm_dir}/provisioning/playbook.yml" + provisioning_dir = "#{host_drupalvm_dir}/provisioning" config_dir = host_config_dir # Verify Ansible version requirement. require_ansible_version ">= #{vconfig['drupalvm_ansible_version_min']}" else - playbook = "#{guest_drupalvm_dir}/provisioning/playbook.yml" + provisioning_dir = "#{guest_drupalvm_dir}/provisioning" config_dir = guest_config_dir end @@ -106,13 +106,17 @@ Vagrant.configure('2') do |config| config.vm.provision 'drupalvm', type: provisioner do |ansible| ansible.compatibility_mode = '2.0' - ansible.playbook = playbook + ansible.playbook = "#{provisioning_dir}/playbook.yml" ansible.extra_vars = { config_dir: config_dir, drupalvm_env: drupalvm_env } ansible.raw_arguments = Shellwords.shellsplit(ENV['DRUPALVM_ANSIBLE_ARGS']) if ENV['DRUPALVM_ANSIBLE_ARGS'] ansible.tags = ENV['DRUPALVM_ANSIBLE_TAGS'] + ansible.verbose = ENV['DRUPALVM_DEBUG'] + unless ENV['ANSIBLE_CONFIG'] + ansible.config_file = "#{provisioning_dir}/ansible#{'.debug' if ENV['DRUPALVM_DEBUG']}.cfg" + end # Use pip to get the latest Ansible version when using ansible_local. provisioner == :ansible_local && ansible.install_mode = 'pip' end diff --git a/docs/other/debug.md b/docs/other/debug.md new file mode 100644 index 000000000..13bed9372 --- /dev/null +++ b/docs/other/debug.md @@ -0,0 +1,17 @@ +To debug the provisioning step Drupal VM can run the `ansible-playbook` command in verbose mode if you set the `DRUPALVM_DEBUG` environment variable. + +```sh +# verbose mode: ansible-playbook -v +DRUPALVM_DEBUG=1 vagrant provision +DRUPALVM_DEBUG=v vagrant provision + +# for even more messages: ansible-playbook -vvv +DRUPALVM_DEBUG=vvv vagrant provision + +# for debug mode: ansible-playbook -vvvv +DRUPALVM_DEBUG=vvvv vagrant provision +``` + +In addition to running in verbose mode this also enables deprecation warnings. + +For debugging information related to Vagrant see [documentation](https://www.vagrantup.com/docs/other/debugging.html). diff --git a/mkdocs.yml b/mkdocs.yml index 1f2a3da0f..254c179d0 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -63,6 +63,7 @@ pages: - 'Passing on CLI arguments to ansible': 'extending/ansible-args.md' - 'Pre- and Post-Provision Scripts': 'extending/scripts.md' - Other Information: + - 'Debug mode': 'other/debug.md' - 'Networking Notes': 'other/networking.md' - 'Vagrant LXC provider': 'other/vagrant-lxc.md' - 'Improving Performance': 'other/performance.md' diff --git a/provisioning/ansible.cfg b/provisioning/ansible.cfg index 4b1740edf..f2d561ee8 100644 --- a/provisioning/ansible.cfg +++ b/provisioning/ansible.cfg @@ -1,6 +1,6 @@ [defaults] roles_path = ./roles +deprecation_warnings = False [ssh_connection] pipelining = True -control_path = /tmp/ansible-ssh-%%h-%%p-%%r diff --git a/provisioning/ansible.debug.cfg b/provisioning/ansible.debug.cfg new file mode 100644 index 000000000..0017b8152 --- /dev/null +++ b/provisioning/ansible.debug.cfg @@ -0,0 +1,5 @@ +[defaults] +roles_path = ./roles + +[ssh_connection] +pipelining = True