From 691179281336dcd56d17b70cdf4067a142238b83 Mon Sep 17 00:00:00 2001 From: Tomas Sedovic Date: Wed, 29 Nov 2017 11:33:10 +0100 Subject: Fix the env lookup fallback in rhel_subscribe The role is looking for the usernames, passwords, etc. first in the shell environment and then in the Ansible vars. When the environment is empty, however, the lookup returns an empty string not an undefined variable, so the `default` fallback is never used and the ansible variables end up being ignored. By adding `True` to the end of the filter, it will work with any falsey value (including an empty string) not just undefined variables. --- roles/rhel_subscribe/tasks/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'roles/rhel_subscribe/tasks') diff --git a/roles/rhel_subscribe/tasks/main.yml b/roles/rhel_subscribe/tasks/main.yml index b06f51908..5867f0207 100644 --- a/roles/rhel_subscribe/tasks/main.yml +++ b/roles/rhel_subscribe/tasks/main.yml @@ -4,10 +4,10 @@ # to make it able to enable repositories - set_fact: - rhel_subscription_pool: "{{ lookup('env', 'rhel_subscription_pool') | default(rhsub_pool | default('Red Hat OpenShift Container Platform, Premium*')) }}" - rhel_subscription_user: "{{ lookup('env', 'rhel_subscription_user') | default(rhsub_user | default(omit, True)) }}" - rhel_subscription_pass: "{{ lookup('env', 'rhel_subscription_pass') | default(rhsub_pass | default(omit, True)) }}" - rhel_subscription_server: "{{ lookup('env', 'rhel_subscription_server') | default(rhsub_server | default(omit, True)) }}" + rhel_subscription_pool: "{{ lookup('env', 'rhel_subscription_pool') | default(rhsub_pool | default('Red Hat OpenShift Container Platform, Premium*'), True) }}" + rhel_subscription_user: "{{ lookup('env', 'rhel_subscription_user') | default(rhsub_user | default(omit, True), True) }}" + rhel_subscription_pass: "{{ lookup('env', 'rhel_subscription_pass') | default(rhsub_pass | default(omit, True), True) }}" + rhel_subscription_server: "{{ lookup('env', 'rhel_subscription_server') | default(rhsub_server | default(omit, True), True) }}" - fail: msg: "This role is only supported for Red Hat hosts" -- cgit v1.2.3