From 19b49a92244af681deb0ec2c013deb2d55934634 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Evrard <evrardjp@users.noreply.github.com> Date: Fri, 3 Mar 2017 18:33:41 +0000 Subject: [PATCH] [cloud][lxc] Prevent hostname to be set (#22246) If the host .bashrc holds a var named HOSTNAME, the container where the lxc_container module will attach to will inherit from this var, potentially breaking some applications (like rabbitmqctl) due to an incorrect $HOSTNAME reported in the container. --- lib/ansible/modules/cloud/lxc/lxc_container.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/ansible/modules/cloud/lxc/lxc_container.py b/lib/ansible/modules/cloud/lxc/lxc_container.py index d3b6804ce50..8163d74f816 100644 --- a/lib/ansible/modules/cloud/lxc/lxc_container.py +++ b/lib/ansible/modules/cloud/lxc/lxc_container.py @@ -541,6 +541,7 @@ ATTACH_TEMPLATE = """#!/usr/bin/env bash pushd "$(getent passwd $(whoami)|cut -f6 -d':')" if [[ -f ".bashrc" ]];then source .bashrc + unset HOSTNAME fi popd