# End the play if we're not on Linux and a raw 'sudo' command isn't available. # Expects connection:local - shell: uname -s register: out - meta: end_play when: out.stdout != 'Linux' - command: sudo -n whoami args: warn: "{{ False if ansible_version.full is version('2.10', '<=', strict=True) else omit }}" ignore_errors: true register: sudo_available - meta: end_play when: sudo_available.rc != 0