--- # role currently only works with opentofu # Either manually extend to both or just leave out test? - name: Check if tofu is installed vars: terraform_bin: tofu ansible.builtin.command: argv: - which - "{{ terraform_bin|quote }}" check_mode: false # run even in check mode tags: debug register: tofu_installed failed_when: false changed_when: false - name: Run terraform community.general.terraform: binary_path: "{{ (tofu_installed.rc in [ 0 ]) | ternary('tofu', 'terraform') }}" project_path: "tofu/" state: present register: output - name: Debug output debug: var: output