More robust way to install python to hosts

This commit is contained in:
Timo Makinen 2025-06-18 10:03:57 +00:00
parent 78ac8fc6f4
commit e716951798
2 changed files with 9 additions and 7 deletions

View file

@ -15,4 +15,8 @@ num_cpus: 2
# extra args for virt-install # extra args for virt-install
virt_install_os_args: --cdrom {{ boot_url }}/openbsd/openbsd.iso virt_install_os_args: --cdrom {{ boot_url }}/openbsd/openbsd.iso
virt_install_os_variant: openbsd7.6 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

View file

@ -170,12 +170,10 @@
when: inventory_hostname not in result.list_vms when: inventory_hostname not in result.list_vms
- name: Install python if required - name: Install python if required
ansible.builtin.command: ansible.builtin.raw: >-
argv: {{ virt_install_python_cmd | map('quote') | join(' ') }}
- ssh args:
- "{{ inventory_hostname }}" executable: /bin/sh
- "{{ virt_install_python_cmd }}"
delegate_to: localhost
when: when:
- inventory_hostname not in result.list_vms - inventory_hostname not in result.list_vms
- virt_install_python_cmd is defined - virt_install_python_cmd is defined