beetboxvm / beetbox

Pre-provisioned L*MP stack
http://beetbox.rtfd.org
92 stars 19 forks source link

Extra vars file via command line argument #324

Closed Decipher closed 7 years ago

Decipher commented 8 years ago

Again for CI, the ability to add an extra vars file via the --extra-vars "@some_file.yml" command line argument, passed through via an argument to beetbox.sh would allow a simple way to add CI specific overrides to playbooks.

Not 100% sure if the argument will support a yml file, as the documentation specified a JSON file but then goes on to say YML format is supported, nor am I sure on how the hierarchy will work here, if that new file will be included before or after the existing files, but I will prototype it when I can.

Decipher commented 8 years ago

PoC'd and it works a charm, file is included and after the vars and vars_files are, so will always override prior configuration.

Decipher commented 8 years ago

A workaround for the moment is:

  pre_tasks:
    - name: Include CI config.
      include_vars: "{{ beet_base }}/.beetbox/ci.config.yml"
      when: "{{ lookup('env','BEET_CI') }}"

Or similar. That will only include the ci.config.yml file when BEET_CI is true.

thom8 commented 8 years ago

This could be done along with -- https://github.com/beetboxvm/beetbox/issues/325

so it would automatically include a config file with the name of {{ beet_env }}.config.yml if that file existed.