mirror of
https://github.com/kubernetes-sigs/kubespray.git
synced 2026-10-31 14:36:20 -02:30
ci: run the Ansible controller as an unprivileged user (#13527)
* ci: run the Ansible controller as an unprivileged user * ci: clarify non-root controller check * ci: make the sudo privilege check fail when sudo succeeds Bash does not apply errexit to the negated sudo command. The old check could not fail the job even when passwordless sudo worked. Exit explicitly when sudo succeeds. Remove --break-system-packages from both upgrade pip installs because they run inside the controller virtual environment.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
- name: Provision Packet VMs
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
become: true
|
||||
become: false
|
||||
tasks:
|
||||
- name: Create Kubevirt VMs
|
||||
import_role:
|
||||
|
||||
@@ -3,6 +3,6 @@ set -euxo pipefail
|
||||
|
||||
curl --proto '=https' --tlsv1.2 -fsSL https://get.opentofu.org/install-opentofu.sh -o install-opentofu.sh
|
||||
chmod +x install-opentofu.sh
|
||||
./install-opentofu.sh --install-method standalone
|
||||
./install-opentofu.sh --install-method standalone --install-path "${HOME}/.local/bin" --symlink-path - --root-method none
|
||||
rm -f install-opentofu.sh
|
||||
tofu --version
|
||||
|
||||
@@ -18,7 +18,7 @@ if [ "${UPGRADE_TEST}" != "false" ]; then
|
||||
# Checkout the current tests/ directory ; even when testing old version,
|
||||
# we want the up-to-date test setup/provisionning
|
||||
git checkout "${CI_COMMIT_SHA}" -- tests/
|
||||
pip install --break-system-packages --no-compile --no-cache-dir -r requirements.txt
|
||||
pip install --no-compile --no-cache-dir -r requirements.txt
|
||||
fi
|
||||
|
||||
export ANSIBLE_BECOME=true
|
||||
@@ -58,7 +58,7 @@ fi
|
||||
if [ "${UPGRADE_TEST}" != "false" ]; then
|
||||
git checkout "${CI_COMMIT_SHA}"
|
||||
|
||||
pip install --break-system-packages --no-compile --no-cache-dir -r requirements.txt
|
||||
pip install --no-compile --no-cache-dir -r requirements.txt
|
||||
|
||||
case "${UPGRADE_TEST}" in
|
||||
"basic")
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
|
||||
curl -sL "https://releases.hashicorp.com/vagrant/${VAGRANT_VERSION}/vagrant_${VAGRANT_VERSION}-1_amd64.deb" -o "/tmp/vagrant_${VAGRANT_VERSION}-1_amd64.deb"
|
||||
dpkg -i "/tmp/vagrant_${VAGRANT_VERSION}-1_amd64.deb"
|
||||
vagrant validate --ignore-provider
|
||||
|
||||
Reference in New Issue
Block a user