Skip to content

Commit

Permalink
Remove ansible from the base and tools images
Browse files Browse the repository at this point in the history
A user can still install ansible, ansible-galaxy
as they need using pip3. This will reduce the size
of the image.

```
pip3 install ansible
ansible-galaxy collection install \
    azure.azcollection --force -p ./collections
```

Signed-off-by: Suraj Deshmukh <[email protected]>
  • Loading branch information
surajssd committed Apr 24, 2024
1 parent 14218b1 commit 3c5ed63
Show file tree
Hide file tree
Showing 12 changed files with 7 additions and 142 deletions.
12 changes: 0 additions & 12 deletions linux/ansible/ansible

This file was deleted.

12 changes: 0 additions & 12 deletions linux/ansible/ansible-config

This file was deleted.

12 changes: 0 additions & 12 deletions linux/ansible/ansible-connection

This file was deleted.

12 changes: 0 additions & 12 deletions linux/ansible/ansible-console

This file was deleted.

12 changes: 0 additions & 12 deletions linux/ansible/ansible-doc

This file was deleted.

12 changes: 0 additions & 12 deletions linux/ansible/ansible-galaxy

This file was deleted.

12 changes: 0 additions & 12 deletions linux/ansible/ansible-inventory

This file was deleted.

12 changes: 0 additions & 12 deletions linux/ansible/ansible-playbook

This file was deleted.

12 changes: 0 additions & 12 deletions linux/ansible/ansible-pull

This file was deleted.

12 changes: 0 additions & 12 deletions linux/ansible/ansible-vault

This file was deleted.

14 changes: 2 additions & 12 deletions linux/base.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# base.Dockerfile contains components which are large and change less frequently.
# tools.Dockerfile contains the smaller, more frequently-updated components.
# base.Dockerfile contains components which are large and change less frequently.
# tools.Dockerfile contains the smaller, more frequently-updated components.

# Within Azure, the image layers
# built from this file are cached in a number of locations to speed up container startup time. A manual
Expand Down Expand Up @@ -38,7 +38,6 @@ RUN bash ./tdnfinstall.sh \
gpgme \
gnupg2 \
autoconf \
ansible \
bash-completion \
build-essential \
binutils \
Expand Down Expand Up @@ -193,15 +192,6 @@ RUN curl -fSsL `curl -fSsL https://api.github.com/repos/Azure/batch-shipyard/rel
&& /bin/bash -c "source cloudshell/bin/activate && python3 -m compileall -f /opt/batch-shipyard/shipyard.py /opt/batch-shipyard/convoy && deactivate" \
&& ln -sf /opt/batch-shipyard/shipyard /usr/local/bin/shipyard

# # BEGIN: Install Ansible in isolated Virtual Environment
COPY ./linux/ansible/ansible* /usr/local/bin/
RUN chmod 755 /usr/local/bin/ansible* \
&& pip3 install virtualenv \
&& cd /opt \
&& virtualenv -p python3 ansible \
&& /bin/bash -c "source ansible/bin/activate && pip3 install ansible && pip3 install pywinrm\>\=0\.2\.2 && deactivate" \
&& ansible-galaxy collection install azure.azcollection --force -p /usr/share/ansible/collections

# Install latest version of Istio
ENV ISTIO_ROOT /usr/local/istio-latest
RUN curl -sSL https://git.io/getLatestIstio | sh - \
Expand Down
15 changes: 5 additions & 10 deletions linux/tools.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ RUN wget https://azurecliprod.blob.core.windows.net/cloudshell-release/azure-cli

# Install any Azure CLI extensions that should be included by default.
RUN az extension add --system --name ai-examples -y \
&& az extension add --system --name ssh -y \
&& az extension add --system --name ml -y
&& az extension add --system --name ssh -y \
&& az extension add --system --name ml -y

# Install kubectl
RUN az aks install-cli \
Expand All @@ -48,14 +48,9 @@ RUN npm install -q -g @pnp/cli-microsoft365

# Install Bicep CLI
RUN curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64 \
&& chmod +x ./bicep \
&& mv ./bicep /usr/local/bin/bicep \
&& bicep --help

# Temp: fix ansible modules. Proper fix is to update base layer to use regular python for Ansible.
RUN mkdir -p /usr/share/ansible/collections/ansible_collections/azure/azcollection/ \
&& wget -nv -q -O /usr/share/ansible/collections/ansible_collections/azure/azcollection/requirements-azure.txt https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements-azure.txt \
&& /opt/ansible/bin/python -m pip install -r /usr/share/ansible/collections/ansible_collections/azure/azcollection/requirements-azure.txt
&& chmod +x ./bicep \
&& mv ./bicep /usr/local/bin/bicep \
&& bicep --help

# Copy and run script to Install powershell modules and setup Powershell machine profile
COPY ./linux/powershell/PSCloudShellUtility/ /usr/local/share/powershell/Modules/PSCloudShellUtility/
Expand Down

0 comments on commit 3c5ed63

Please sign in to comment.