summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2026-02-13 13:52:44 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2026-02-13 13:52:44 +0000
commitb9e102953564b0e7d1ae0fbed9ae35b600d5ec1b (patch)
tree50c1cb86bcb8ad82d0315e0088ddd2a3431d7cad
parent3b6422f08dff4dc50fe5397c9fede781bd3288c5 (diff)
downloadvyos-build-b9e102953564b0e7d1ae0fbed9ae35b600d5ec1b.tar.gz
vyos-build-b9e102953564b0e7d1ae0fbed9ae35b600d5ec1b.zip
T8267: Extend the vyos-build repo to include Ansible install phony
Extend the vyos-build repo to include Ansible install PHONY Add the ability to install Ansible and VyOS compatible modules. It could be used for the further "topology tests". It also could be helpful with environment questions where a bug was reproduced. Use virtual environment to install Ansible + VyOS modules New options: - make ansible-install - make ansible-check - make ansible-clean
-rw-r--r--.gitignore1
-rw-r--r--Makefile23
-rwxr-xr-xscripts/ansible-install20
3 files changed, 44 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index de9b67f9..39e926ce 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@ packages/*
/*.tar
.DS_Store
._.DS_Store
+.venv
diff --git a/Makefile b/Makefile
index da82e378..2cac72e2 100644
--- a/Makefile
+++ b/Makefile
@@ -113,3 +113,26 @@ clean:
.PHONY: purge
purge:
rm -rf build packer_build packer_cache testinstall-*.raw ci_data ci_seed.iso
+
+.PHONY: ansible-install ansible-check ansible-clean
+.ONESHELL:
+
+ANSIBLE_SCRIPT := ./scripts/ansible-install
+VENV_DIR := .venv
+
+ansible-install:
+ @test -x $(ANSIBLE_SCRIPT) || chmod +x $(ANSIBLE_SCRIPT)
+ $(ANSIBLE_SCRIPT)
+
+ansible-check:
+ @if [ -d $(VENV_DIR) ]; then
+ . $(VENV_DIR)/bin/activate
+ ansible --version
+ else
+ echo "Virtual environment not found. Run 'make ansible-install' first."
+ fi
+
+ansible-clean:
+ @echo "Cleaning Ansible installation..."
+ @rm -rf $(VENV_DIR)
+ @echo "Done."
diff --git a/scripts/ansible-install b/scripts/ansible-install
new file mode 100755
index 00000000..22f467ff
--- /dev/null
+++ b/scripts/ansible-install
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+VENV_DIR=${1:-.venv}
+
+echo "==> Creating Python venv at $VENV_DIR"
+python3 -m venv "$VENV_DIR"
+. "$VENV_DIR/bin/activate"
+
+echo "==> Upgrading pip, setuptools, wheel"
+pip install --upgrade pip setuptools wheel
+
+echo "==> Installing Ansible and dependencies"
+pip install ansible-core==2.18.2 ansible-pylibssh
+
+echo "==> Installing VyOS Ansible collection"
+ansible-galaxy collection install git+https://github.com/vyos/vyos.vyos.git,main
+
+echo "Ansible setup complete. Activate with: source $VENV_DIR/bin/activate"