From 6b5877bb547303f7c8c75721ad09d44093a9154e Mon Sep 17 00:00:00 2001 From: Colin Wilk Date: Fri, 26 Jun 2026 22:14:34 +0200 Subject: shell.nix: add fix for molecule docker driver Currently molecule is incompatible with Ansible 14 / ansible-core 2.21 so we need to inject invocation variables via env var to make it work. Should be fixed when this gets closed: https://github.com/ansible-community/molecule-plugins/issues/363 --- shell.nix | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/shell.nix b/shell.nix index b07495a..b15061e 100644 --- a/shell.nix +++ b/shell.nix @@ -3,38 +3,42 @@ }: let - python = pkgs.python3.withPackages (ps: [ - ps.ansible + pythonPackages = ps: [ + ps.ansible-core ps.docker ps.molecule ps.molecule-plugins ps.pytest ps.pytest-testinfra - ps.requests - ]); + ]; + python = pkgs.python3.withPackages pythonPackages; + in + pkgs.mkShell { - packages = [ + packages = with pkgs; [ python - pkgs.docker - pkgs.rsync - pkgs.python311Packages.requests + python311Packages.requests + docker + rsync + zsh ]; shellHook = '' + export PYTHONDONTWRITEBYTECODE=1 export ANSIBLE_ALLOW_BROKEN_CONDITIONALS=True - export PYTHONDONTWRITEBYTECODE=1 # Keep Python from writing .pyc files - + # TODO: remove ANSIBLE_INJECT_INVOCATION workaround when + # https://github.com/ansible-community/molecule-plugins/issues/363 is resolved + export ANSIBLE_INJECT_INVOCATION=true - echo "==========================================================" - echo "🚀 Ansible Molecule Development Environment is ready" - echo "==========================================================" + echo "============================================" + echo "*** Ansible Molecule Development Environment" + echo "============================================" echo "Installed Versions:" python --version ansible --version | head -n 1 molecule --version | head -n 1 - echo "==========================================================" - echo "Using ANSIBLE_ALLOW_BROKEN_CONDITIONALS=True for molecule-plugins/docker" + echo "============================================" echo "Run: molecule test -s default" ''; } -- cgit v1.2.3