From e7169517987bc0bebcc1ac17eabef8a2a9da2eb7 Mon Sep 17 00:00:00 2001 From: Timo Makinen Date: Wed, 18 Jun 2025 10:03:57 +0000 Subject: [PATCH] More robust way to install python to hosts --- group_vars/openbsd.yml | 6 +++++- playbooks/include/deploy-kvm-guest.yml | 10 ++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/group_vars/openbsd.yml b/group_vars/openbsd.yml index 107ec1e..6fdbdb1 100644 --- a/group_vars/openbsd.yml +++ b/group_vars/openbsd.yml @@ -15,4 +15,8 @@ num_cpus: 2 # extra args for virt-install virt_install_os_args: --cdrom {{ boot_url }}/openbsd/openbsd.iso virt_install_os_variant: openbsd7.6 -virt_install_python_cmd: pkg_add -I -x python%3 +virt_install_python_cmd: + - pkg_add + - -I + - -x + - python%3 diff --git a/playbooks/include/deploy-kvm-guest.yml b/playbooks/include/deploy-kvm-guest.yml index 5464cd5..e7c0262 100644 --- a/playbooks/include/deploy-kvm-guest.yml +++ b/playbooks/include/deploy-kvm-guest.yml @@ -170,12 +170,10 @@ when: inventory_hostname not in result.list_vms - name: Install python if required - ansible.builtin.command: - argv: - - ssh - - "{{ inventory_hostname }}" - - "{{ virt_install_python_cmd }}" - delegate_to: localhost + ansible.builtin.raw: >- + {{ virt_install_python_cmd | map('quote') | join(' ') }} + args: + executable: /bin/sh when: - inventory_hostname not in result.list_vms - virt_install_python_cmd is defined