diff options
| author | Daniil Baturin <daniil@vyos.io> | 2026-02-19 15:32:19 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-19 15:32:19 +0000 |
| commit | 3061c79be208cd57f973673c0184d26fe9da0d07 (patch) | |
| tree | 1b5254dd11582574f37533420dc4bbacb03ed795 | |
| parent | dc1168285247b88db07d7ab0a19d82398d619207 (diff) | |
| parent | b9e102953564b0e7d1ae0fbed9ae35b600d5ec1b (diff) | |
| download | vyos-build-3061c79be208cd57f973673c0184d26fe9da0d07.tar.gz vyos-build-3061c79be208cd57f973673c0184d26fe9da0d07.zip | |
Merge pull request #1118 from sever-sever/T8267
T8267: Extend the vyos-build repo to include Ansible install phony target
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Makefile | 23 | ||||
| -rwxr-xr-x | scripts/ansible-install | 20 |
3 files changed, 44 insertions, 0 deletions
@@ -15,3 +15,4 @@ packages/* /*.tar .DS_Store ._.DS_Store +.venv @@ -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" |
