Skip to content

Instantly share code, notes, and snippets.

@TopherGopher
Created August 3, 2016 21:13
Show Gist options
  • Save TopherGopher/370b6e2f5944f18eb7e60adc475c221b to your computer and use it in GitHub Desktop.
Save TopherGopher/370b6e2f5944f18eb7e60adc475c221b to your computer and use it in GitHub Desktop.
Loading databags in using ansible
- name: Get the databag data for this site/env
local_action: command knife data bag show nmdhosting {{ item.path | basename }} -F yaml
register: bag
when: current_directory.stat.exists is defined and current_directory.stat.exists
- name: Get that data into a YAML file
local_action: copy content="{{ bag.stdout }}" dest="/tmp/{{ item.path | basename }}_generated.yml"
when: current_directory.stat.exists is defined and current_directory.stat.exists
- name: Get those vars
include_vars: "/tmp/{{ item.path | basename}}_generated.yml"
when: current_directory.stat.exists is defined and current_directory.stat.exists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment