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

Commit

Permalink
Merge pull request #992 from oxyc/ansible-args-cli
Browse files Browse the repository at this point in the history
Followup #820: Pass ansible arguments via environment variable if provided.
  • Loading branch information
geerlingguy authored Dec 10, 2016
2 parents a6a954f + 0ba5f05 commit db2386c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config_dir: host_config_dir,
drupalvm_env: drupalvm_env
}
ansible.raw_arguments = ENV['DRUPALVM_ANSIBLE_ARGS']
end
else
config.vm.provision 'ansible_local' do |ansible|
Expand All @@ -137,6 +138,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config_dir: guest_config_dir,
drupalvm_env: drupalvm_env
}
ansible.raw_arguments = ENV['DRUPALVM_ANSIBLE_ARGS']
end
end

Expand Down
24 changes: 24 additions & 0 deletions docs/other/overriding-configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,27 @@ end
```

_For additional configuration options read [Vagrant Proxyconf's README](https://github.com/tmatilai/vagrant-proxyconf#readme)._

## Passing arguments to ansible during a provision

You can specify an additional argument to the `ansible-playbook` command by using the `DRUPALVM_ANSIBLE_ARGS` environment variable. This can be useful when debugging a task failure.

_Currently this feature has two quirks. It's only possible to pass on a single argument. You should not quote a flag's value as you would normally do in the shell._

Display verbose ansible output:

```sh
DRUPALVM_ANSIBLE_ARGS='--verbose' vagrant provision
```

Begin the provisioning at a particular task:

```sh
DRUPALVM_ANSIBLE_ARGS='--start-at-task=*post-provision shell*' vagrant provision
```

Override a config variable:

```sh
DRUPALVM_ANSIBLE_ARGS='--extra-vars=drupalvm_database=pgsql' vagrant provision
```

0 comments on commit db2386c

Please sign in to comment.