Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Add debug mode and hide deprecation warnings by default #1563

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions docs/other/debug.md
Original file line number Diff line number Diff line change
@@ -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).
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion provisioning/ansible.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[defaults]
roles_path = ./roles
deprecation_warnings = False

[ssh_connection]
pipelining = True
control_path = /tmp/ansible-ssh-%%h-%%p-%%r
5 changes: 5 additions & 0 deletions provisioning/ansible.debug.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[defaults]
roles_path = ./roles

[ssh_connection]
pipelining = True