From f60fb7f88c9f20f0db6884fce4eff337bd539dc3 Mon Sep 17 00:00:00 2001 From: Timo Makinen Date: Tue, 1 Sep 2020 20:15:15 +0000 Subject: [PATCH] Force python3 install when provisioning OpenBSD --- group_vars/openbsd.yml | 3 ++- playbooks/include/vm-create.yml | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/group_vars/openbsd.yml b/group_vars/openbsd.yml index a538de7..ee53b91 100644 --- a/group_vars/openbsd.yml +++ b/group_vars/openbsd.yml @@ -1,6 +1,6 @@ --- # fix python path errors -ansible_python_interpreter: "/usr/bin/env python" +ansible_python_interpreter: "/usr/local/bin/python3" # we have real wheel group ansible_wheel: wheel @@ -17,3 +17,4 @@ num_cpus: 1 # extra args for virt-install virt_install_os_args: --cdrom https://www.foo.sh/ks/openbsd/openbsd.iso +virt_install_python_cmd: pkg_add python3 -I -x diff --git a/playbooks/include/vm-create.yml b/playbooks/include/vm-create.yml index 54b0100..a8fda29 100644 --- a/playbooks/include/vm-create.yml +++ b/playbooks/include/vm-create.yml @@ -137,3 +137,10 @@ with_items: "{{ hostkeys.stdout.splitlines() }}" delegate_to: localhost when: inventory_hostname not in result.list_vms + + - name: install python if required + command: "ssh {{ inventory_hostname }} '{{ virt_install_python_cmd }}'" + delegate_to: localhost + when: + - inventory_hostname not in result.list_vms + - virt_install_python_cmd is defined