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

Conversation

@joestewart
Copy link
Contributor

Opened PR for discussion to address #431

Possible usage to run only post provisioning tasks and scripts as suggested.

ANSIBLE_ARGS='--tags=post' vagrant provision

As mentioned in #431 tags would need to be added for this to be useful.

We could restrict the enviroment variable to tags only like

"ansible.tags = ENV['ANSIBLE_TAGS']"

But the more general argument would allow other flexibility.

@geerlingguy
Copy link
Owner

I really like this, nice idea! Might think of a different env variable name though, just to avoid any potential namespace collisions. Maybe DRUPALVM_ANSIBLE_ARGS?

@joestewart
Copy link
Contributor Author

Updated to use DRUPALVM_ANSIBLE_ARGS. It's not going to be a short command line anyway so this seems good.

@geerlingguy
Copy link
Owner

If the env variable is not set, does this cause any issues/warnings?

@joestewart
Copy link
Contributor Author

I haven't seen any difference when the variable isn't set. Including warnings.

@oxyc
Copy link
Collaborator

oxyc commented Nov 15, 2016

Other useful flags:

  • --vault-password-file ~/.vault_pass.txt
  • --start-at-task=Run configured post-provision ansible task files.
  • --list-tasks would be useful for debugging
@geerlingguy
Copy link
Owner

@oxyc - Would you like to take a crack at adding one or more of those and build on top of this PR?

@oxyc
Copy link
Collaborator

oxyc commented Nov 16, 2016

With the current PR it already works.

DRUPALVM_ANSIBLE_ARGS='--start-at-task=Run configured post-provision ansible task files.' vagrant provision 
@geerlingguy
Copy link
Owner

@oxyc - Ah... obvious in hindsight.

Could we add a note in the docs about this new option, and some suggested uses?

@oxyc
Copy link
Collaborator

oxyc commented Nov 16, 2016

Sure.

One minor issue with this is that it only supports a single argument. Vagrant requires the arguments to be passed as an array if there are more than one. This is also why I'm not using quotes in my --start-at-task example. I guess we can just add a note on that.

@geerlingguy
Copy link
Owner

Sounds good.

@geerlingguy
Copy link
Owner

Closing for #992 — see progress there.

geerlingguy added a commit that referenced this pull request Dec 10, 2016
Followup #820: Pass ansible arguments via environment variable if provided.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

3 participants