From 599e016315bd08a7abd11952343825bae90dfe14 Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Fri, 2 Dec 2016 10:08:10 -0500 Subject: [PATCH] For container enabled role, display warning only when not ANSIBLE_CONTAINER (#18717) --- lib/ansible/galaxy/role.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/galaxy/role.py b/lib/ansible/galaxy/role.py index a3752101729..a3498c5e645 100644 --- a/lib/ansible/galaxy/role.py +++ b/lib/ansible/galaxy/role.py @@ -212,8 +212,8 @@ class GalaxyRole(object): if not role_data: raise AnsibleError("- sorry, %s was not found on %s." % (self.src, api.api_server)) - if role_data.get('role_type') == 'CON': - # Container Enabled + if role_data.get('role_type') == 'CON' and not os.environ.get('ANSIBLE_CONTAINER'): + # Container Enabled, running outside of a container display.warning("%s is a Container Enabled role and should only be installed using " "Ansible Container" % self.name)