From 660024ea66904c375b244d5a153a17c7af543e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Sch=C3=B6ldstr=C3=B6m?= Date: Sat, 23 Sep 2017 12:22:43 -0500 Subject: [PATCH 1/4] Use default control_path in ansible.cfg This defaults to a hashed string of the hostname, port and username. The hash mitigates a common problem users found with long hostames and the conventional %(directory)s/ansible-ssh-%%h-%%p-%%r format. In those cases, a "too long for Unix domain socket" ssh error would occur. --- provisioning/ansible.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/provisioning/ansible.cfg b/provisioning/ansible.cfg index 4b1740edf..0017b8152 100644 --- a/provisioning/ansible.cfg +++ b/provisioning/ansible.cfg @@ -3,4 +3,3 @@ roles_path = ./roles [ssh_connection] pipelining = True -control_path = /tmp/ansible-ssh-%%h-%%p-%%r From 66be4d171b1e542fa5557edbe8a3191e7635c788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Sch=C3=B6ldstr=C3=B6m?= Date: Sat, 23 Sep 2017 12:44:21 -0500 Subject: [PATCH 2/4] Add verbose ansible output with DRUPALVM_DEBUG env variable Examples: - DRUPALVM_DEBUG=1 vagrant provision (ansible-playbook -v) - DRUPALVM_DEBUG=v vagrant provision (ansible-playbook -v) - DRUPALVM_DEBUG=vvv vagrant provision (ansible-playbook -vvv) --- Vagrantfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Vagrantfile b/Vagrantfile index 8ca0e9530..475ef01f1 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -113,6 +113,7 @@ Vagrant.configure('2') do |config| } 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'] # Use pip to get the latest Ansible version when using ansible_local. provisioner == :ansible_local && ansible.install_mode = 'pip' end From 7ea49b9e2ebaf2bd0e5244c6ca3d2a3b72bf2972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Sch=C3=B6ldstr=C3=B6m?= Date: Sat, 23 Sep 2017 12:45:18 -0500 Subject: [PATCH 3/4] Hide ansible deprecation warnings in regular provision mode --- Vagrantfile | 9 ++++++--- provisioning/ansible.cfg | 1 + provisioning/ansible.debug.cfg | 5 +++++ 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 provisioning/ansible.debug.cfg diff --git a/Vagrantfile b/Vagrantfile index 475ef01f1..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,7 +106,7 @@ 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 @@ -114,6 +114,9 @@ Vagrant.configure('2') do |config| 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/provisioning/ansible.cfg b/provisioning/ansible.cfg index 0017b8152..f2d561ee8 100644 --- a/provisioning/ansible.cfg +++ b/provisioning/ansible.cfg @@ -1,5 +1,6 @@ [defaults] roles_path = ./roles +deprecation_warnings = False [ssh_connection] pipelining = True 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 From 2089f7a6219dff25d8c4168896049b21abe05228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Sch=C3=B6ldstr=C3=B6m?= Date: Sat, 29 Dec 2018 10:02:51 -0300 Subject: [PATCH 4/4] add docs on debug mode --- docs/other/debug.md | 17 +++++++++++++++++ mkdocs.yml | 1 + 2 files changed, 18 insertions(+) create mode 100644 docs/other/debug.md 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'