terraform-provisioner-ansible icon indicating copy to clipboard operation
terraform-provisioner-ansible copied to clipboard

support host variables

Open sjwl opened this issue 6 years ago • 3 comments

Playbooks that take advantage of host variables like so

http_port: "{{ default_http_port | default(hostvars[groups['Atlanta'][0]]['http_port']) }}"

would need an inventory that has host variables like so

[atlanta]
host1 http_port=80 maxRequestsPerChild=808
host2 http_port=303 maxRequestsPerChild=909

sjwl avatar Dec 05 '18 17:12 sjwl

Hi @sjwl, definitely something to investigate. Thank you for reporting.

radekg avatar Feb 17 '19 19:02 radekg

My workaround is using a seperate null_resource with the ansible provisioner for each instance I want to provision with Ansible.

That way I can pass specific vars per host through the extra_vars of the ansible provisioner.

rflume-zt avatar Mar 15 '19 12:03 rflume-zt

I will take a look at this. Ideas are welcomed, though. Maybe there is an alternative, more intuitive may for handling this.

radekg avatar Mar 15 '19 21:03 radekg