Skip to content

Commit

Permalink
[CE-393]Ansible agent container does not allow sudo
Browse files Browse the repository at this point in the history
ansible agent container does not have sudo installed, when
playbooks try to switch to sudo, it fails. This patch set
fixed that issue and also removed an unused package from
the container to reduce the size of the container.

Change-Id: I2250a165c1f675a9a6ca10e20781d89263ee6cc6
Signed-off-by: Tong Li <litong01@us.ibm.com>
  • Loading branch information
Tong Li committed Jun 22, 2018
1 parent 5162a2b commit 589ea4c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions docker/ansible-agent/Dockerfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ ARG uid=1000
ARG gid=1000

RUN apt-get update && \
apt-get install -y bash curl python-dev sshpass \
apt-get install -y bash curl python-dev sshpass sudo \
python-pip build-essential openssh-client libffi-dev \
libssl-dev && \
libssl-dev && \
pip install --upgrade pip ansible boto boto3 shade \
pyyaml openshift && \
pyyaml && \
groupadd -g ${gid} ${user} && \
useradd -d /opt/agent -u ${uid} -g ${user} ${user} && \
usermod -a -G root ${user} && \
echo "${user} ALL=(ALL) NOPASSWD: ALL"|tee /etc/sudoers.d/${user} && \
mkdir -p /opt/agent/.ssh && \
cd /opt/agent/.ssh && \
echo "host *" > config && \
Expand Down
5 changes: 3 additions & 2 deletions dockerhub/latest/ansible-agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ ARG uid=1000
ARG gid=1000

RUN apt-get update && \
apt-get install -y bash sshpass python-pip openssh-client && \
apt-get install -y bash sshpass python-pip openssh-client sudo && \
pip install --upgrade pip ansible boto boto3 shade \
pyyaml openshift && \
pyyaml && \
groupadd -g ${gid} ${user} && \
useradd -d /opt/agent -u ${uid} -g ${user} ${user} && \
usermod -a -G root ${user} && \
echo "${user} ALL=(ALL) NOPASSWD: ALL"|tee /etc/sudoers.d/${user} && \
mkdir -p /opt/agent/.ssh && \
cd /opt/agent/.ssh && \
echo "host *" > config && \
Expand Down

0 comments on commit 589ea4c

Please sign in to comment.