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 Jun 25, 2024
1 parent e1d1bdf commit d9ac18d
Show file tree
Hide file tree
Showing 15 changed files with 0 additions and 154 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.

11 changes: 0 additions & 11 deletions linux/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ RUN tdnf update -y --refresh && \
gpgme \
gnupg2 \
autoconf \
ansible \
bash-completion \
build-essential \
binutils \
Expand Down Expand Up @@ -154,16 +153,6 @@ ENV LANG="en_US.utf8"
RUN pip3 install --upgrade sfctl \
&& rm -rf ~/.cache/pip/

# # BEGIN: Install Ansible in isolated Virtual Environment
COPY ./linux/ansible/ansible* /usr/local/bin/
RUN chmod 755 /usr/local/bin/ansible* \
&& cd /opt \
&& virtualenv -p python3 ansible \
&& /bin/bash -c "source ansible/bin/activate && pip3 list --outdated --format=freeze | cut -d '=' -f1 | xargs -n1 pip3 install -U && pip3 install ansible && pip3 install pywinrm\>\=0\.2\.2 && deactivate" \
&& rm -rf ~/.local/share/virtualenv/ \
&& rm -rf ~/.cache/pip/ \
&& 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
Original file line number Diff line number Diff line change
Expand Up @@ -1803,7 +1803,6 @@ function Get-PackageVersion() {
$packageVersionDetections = @(
@{displayname = "Node.JS"; command = "node"; args = "--version"; match = "v(.*)"},
@{displayname = "Cloud Foundry CLI"; command = "cf"; args = "-v"; match = "cf version (.*)"},
@{displayname = "Ansible"; command = "ansible"; args = "--version"; match = "ansible \[core ([\d\.]+)\]"},
@{displayname = "Istio"; command = "istioctl"; args = "version -s --remote=false"; match = "(.+)"},
@{displayname = "Go"; command = "go"; args = "version"; match = "go version go(\S+) .*"},
@{displayname = "Packer"; command = "packer"; args = "version"; match = "Packer v(.+)"},
Expand Down
5 changes: 0 additions & 5 deletions linux/tools.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ RUN curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/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.txt https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements.txt \
&& /opt/ansible/bin/python -m pip install -r /usr/share/ansible/collections/ansible_collections/azure/azcollection/requirements.txt

# Copy and run script to Install powershell modules and setup Powershell machine profile
COPY ./linux/powershell/PSCloudShellUtility/ /usr/local/share/powershell/Modules/PSCloudShellUtility/
COPY ./linux/powershell/ powershell
Expand Down
6 changes: 0 additions & 6 deletions tests/PSinLinuxCloudShellImage.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ Describe "Various programs installed with expected versions" {
$paths | Should -Contain "~/.local/bin"
}

It "Ansible pwsh has modules" {
Test-Path -Path "/usr/share/ansible/collections/ansible_collections/azure/azcollection/" | Should -Be $true
$process = Start-Process -FilePath /opt/ansible/bin/python -ArgumentList "-c `"import msrest`"" -Wait -PassThru
$process.ExitCode | Should -Be 0
}

It "Has various environment vars" {
$env:AZUREPS_HOST_ENVIRONMENT | Should -Be "cloud-shell/1.0"
}
Expand Down
11 changes: 0 additions & 11 deletions tests/command_list
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,6 @@ agetty
alias
alternatives
anacron
ansible
ansible-config
ansible-connection
ansible-console
ansible-doc
ansible-galaxy
ansible-inventory
ansible-playbook
ansible-pull
ansible-test
ansible-vault
apparmor_parser
apparmor_status
applygnupgdefaults
Expand Down

0 comments on commit d9ac18d

Please sign in to comment.