Clark Boylan 1bd5fd0b75 Fix use of hostvars for writing provider file
The ansible hostvars variable is a dict of ansible host entries so we
need to first key off of the hostname when accessing nodepool info from
hostvars. Except that since we just want the current node's variables we
can access them directly without going through hostvars.

Change-Id: Ie6a25c8487d20189cb43c2d60afbdfd00cb5aafd
2017-10-01 07:36:49 -07:00

20 lines
742 B
YAML

- name: Configure /etc/nodepool/provider for backwards compatibility
hosts: all
gather_facts: no
tasks:
- name: Warn that /etc/nodepool/provider is deprecated
debug:
msg: |
The /etc/nodepool/provider file no longer exists and is being created
for backwards compatibility purposes. The variables provided by this
file are now available through Ansible under hostvars[$HOST]['nodepool'].
- name: Create /etc/nodepool/provider file
copy:
content: |
NODEPOOL_PROVIDER={{ nodepool.provider }}
NODEPOOL_CLOUD={{ nodepool.cloud }}
NODEPOOL_REGION={{ nodepool.region }}
NODEPOOL_AZ={{ nodepool.az }}
dest: /etc/nodepool/provider