From b206db4a2edf0cac79bd757774107eefb7cd0ac9 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Fri, 8 Dec 2017 16:04:22 -0600 Subject: [PATCH] Grab package_ver from remote host Ansible set_fact sets variables into the hostvars of the host they are running on. We need to consume the remote hostvar for package_ver in the context of localhost. So reach in to hostvars. Set the host to ubuntu-xenial rather than all to be explicit. Change-Id: I5a5c593cdf80d721a36187e1c552db21f4794b37 --- playbooks/javascript/post.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/playbooks/javascript/post.yaml b/playbooks/javascript/post.yaml index 7a74675915..9ac8f32d27 100644 --- a/playbooks/javascript/post.yaml +++ b/playbooks/javascript/post.yaml @@ -1,4 +1,4 @@ -- hosts: all +- hosts: ubuntu-xenial roles: - fetch-javascript-output - version-from-git @@ -6,4 +6,9 @@ - hosts: localhost roles: - - upload-npm + # project_ver is set by set_fact in version-from-git, but that runs on + # the remote host, which puts the fact into the hostvars of that host. + # Now that we're running on localhost, we need to reach in to the remote + # hosts vars to get the value. + - role: upload-npm + project_ver: "{{ hostvars['ubuntu-xenial']['project_ver'] }}"