From 436d9baa951c231d688ad1dc258dd966fc2347b3 Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov <47745270+al-cheb@users.noreply.github.com> Date: Thu, 25 Mar 2021 12:40:36 +0300 Subject: [PATCH] [Ubuntu] use pipx to install ansible (#3015) * use pipx to install ansible * update info --- images/linux/scripts/installers/ansible.sh | 13 ++++--------- images/linux/scripts/tests/Common.Tests.ps1 | 2 +- images/linux/toolsets/toolset-1804.json | 4 ++++ images/linux/toolsets/toolset-2004.json | 4 ++++ images/linux/ubuntu1804.json | 1 - images/linux/ubuntu2004.json | 1 - 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/images/linux/scripts/installers/ansible.sh b/images/linux/scripts/installers/ansible.sh index d566e5b7..cf63f507 100644 --- a/images/linux/scripts/installers/ansible.sh +++ b/images/linux/scripts/installers/ansible.sh @@ -4,16 +4,11 @@ ## Desc: Installs Ansible ################################################################################ -# Source the helpers for use with the script -source $HELPER_SCRIPTS/os.sh - -# ppa:ansible/ansible doesn't contain packages for Ubuntu20.04 -if isUbuntu16 || isUbuntu18 ; then - add-apt-repository ppa:ansible/ansible - apt-get update -fi - +# this script is used only on Ubuntu 16.04 +# for Ubuntu 18.04 and 20.04 we use pipx ansible-base package # Install latest Ansible +add-apt-repository ppa:ansible/ansible +apt-get update apt-get install -y --no-install-recommends ansible invoke_tests "Tools" "Ansible" diff --git a/images/linux/scripts/tests/Common.Tests.ps1 b/images/linux/scripts/tests/Common.Tests.ps1 index b65a18c3..4a0c16f8 100644 --- a/images/linux/scripts/tests/Common.Tests.ps1 +++ b/images/linux/scripts/tests/Common.Tests.ps1 @@ -43,6 +43,6 @@ Describe "PipxPackages" -Skip:(Test-IsUbuntu16) { [array]$testCases = (Get-ToolsetContent).pipx | ForEach-Object { @{cmd = $_.cmd} } It "" -TestCases $testCases { - "$cmd --version" | Should -ReturnZeroExitCode + "$cmd --version" | Should -ReturnZeroExitCode } } diff --git a/images/linux/toolsets/toolset-1804.json b/images/linux/toolsets/toolset-1804.json index 0e82254c..cc65f1cf 100644 --- a/images/linux/toolsets/toolset-1804.json +++ b/images/linux/toolsets/toolset-1804.json @@ -218,6 +218,10 @@ { "package": "aws-sam-cli", "cmd": "sam" + }, + { + "package": "ansible-base", + "cmd": "ansible" } ], "dotnet": { diff --git a/images/linux/toolsets/toolset-2004.json b/images/linux/toolsets/toolset-2004.json index 2e644c1f..125c00f1 100644 --- a/images/linux/toolsets/toolset-2004.json +++ b/images/linux/toolsets/toolset-2004.json @@ -219,6 +219,10 @@ { "package": "aws-sam-cli", "cmd": "sam" + }, + { + "package": "ansible-base", + "cmd": "ansible" } ], "dotnet": { diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index faa2fe3b..b4a54f47 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -188,7 +188,6 @@ { "type": "shell", "scripts": [ - "{{template_dir}}/scripts/installers/ansible.sh", "{{template_dir}}/scripts/installers/azcopy.sh", "{{template_dir}}/scripts/installers/azure-cli.sh", "{{template_dir}}/scripts/installers/azure-devops-cli.sh", diff --git a/images/linux/ubuntu2004.json b/images/linux/ubuntu2004.json index 2b52f1c1..7c0ca2b5 100644 --- a/images/linux/ubuntu2004.json +++ b/images/linux/ubuntu2004.json @@ -188,7 +188,6 @@ { "type": "shell", "scripts": [ - "{{template_dir}}/scripts/installers/ansible.sh", "{{template_dir}}/scripts/installers/azcopy.sh", "{{template_dir}}/scripts/installers/azure-cli.sh", "{{template_dir}}/scripts/installers/azure-devops-cli.sh",