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
This commit is contained in:
Clark Boylan 2017-10-01 06:44:36 -07:00
parent bce1964ca8
commit 1bd5fd0b75

View File

@ -7,13 +7,13 @@
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['nodepool'].
file are now available through Ansible under hostvars[$HOST]['nodepool'].
- name: Create /etc/nodepool/provider file
copy:
content: |
NODEPOOL_PROVIDER={{ hostvars['nodepool']['provider'] }}
NODEPOOL_CLOUD={{ hostvars['nodepool']['cloud'] }}
NODEPOOL_REGION={{ hostvars['nodepool']['region'] }}
NODEPOOL_AZ={{ hostvars['nodepool']['az'] }}
NODEPOOL_PROVIDER={{ nodepool.provider }}
NODEPOOL_CLOUD={{ nodepool.cloud }}
NODEPOOL_REGION={{ nodepool.region }}
NODEPOOL_AZ={{ nodepool.az }}
dest: /etc/nodepool/provider