From 1bd5fd0b752dea8bd7fd7615a134a4a1743a6ed7 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Sun, 1 Oct 2017 06:44:36 -0700 Subject: [PATCH] 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 --- playbooks/legacy/nodepool-provider/pre.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/playbooks/legacy/nodepool-provider/pre.yaml b/playbooks/legacy/nodepool-provider/pre.yaml index 2c1eda4c..767980f6 100644 --- a/playbooks/legacy/nodepool-provider/pre.yaml +++ b/playbooks/legacy/nodepool-provider/pre.yaml @@ -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