From 585cd88762b4d4c44b0288a9be425fb1a7294aec Mon Sep 17 00:00:00 2001 From: Martin Schurz Date: Sun, 4 Feb 2024 13:38:24 +0100 Subject: [PATCH] Use Python3 for OpenBSD tests Signed-off-by: Martin Schurz --- molecule/ssh_hardening_bsd/converge.yml | 11 +++++++++++ molecule/ssh_hardening_bsd/prepare.yml | 6 ++++++ molecule/ssh_hardening_bsd/verify.yml | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/molecule/ssh_hardening_bsd/converge.yml b/molecule/ssh_hardening_bsd/converge.yml index 315b47c1..a8de0650 100644 --- a/molecule/ssh_hardening_bsd/converge.yml +++ b/molecule/ssh_hardening_bsd/converge.yml @@ -1,4 +1,15 @@ --- +- name: Prepare OpenBSD host + hosts: all + become: true + gather_facts: false + tasks: + - name: Use Python 3 on OpenBSD + ansible.builtin.set_fact: + ansible_python_interpreter: /usr/bin/python3 + changed_when: false + when: lookup('env', 'MOLECULE_DISTRO') == 'openbsd7' + - name: Wrapper playbook for kitchen testing "ansible-ssh-hardening" with default settings hosts: all environment: diff --git a/molecule/ssh_hardening_bsd/prepare.yml b/molecule/ssh_hardening_bsd/prepare.yml index ce69adf5..b982911c 100644 --- a/molecule/ssh_hardening_bsd/prepare.yml +++ b/molecule/ssh_hardening_bsd/prepare.yml @@ -9,6 +9,12 @@ ansible.builtin.raw: pkg_add python%3.10 changed_when: false when: lookup('env', 'MOLECULE_DISTRO') == 'openbsd7' + + - name: Use Python 3 on OpenBSD + ansible.builtin.set_fact: + ansible_python_interpreter: /usr/bin/python3 + changed_when: false + when: lookup('env', 'MOLECULE_DISTRO') == 'openbsd7' - name: Wrapper playbook for kitchen testing "ansible-ssh-hardening" with default settings hosts: all diff --git a/molecule/ssh_hardening_bsd/verify.yml b/molecule/ssh_hardening_bsd/verify.yml index 6566f684..d51a6e34 100644 --- a/molecule/ssh_hardening_bsd/verify.yml +++ b/molecule/ssh_hardening_bsd/verify.yml @@ -3,6 +3,12 @@ hosts: all become: true tasks: + - name: Use Python 3 on OpenBSD + ansible.builtin.set_fact: + ansible_python_interpreter: /usr/bin/python3 + changed_when: false + when: lookup('env', 'MOLECULE_DISTRO') == 'openbsd7' + - name: Use the type command instead of which to detect existing commands ansible.builtin.file: src: /usr/bin/which