Skip to content

Instantly share code, notes, and snippets.

@obourdon
Created July 4, 2018 11:50
Show Gist options
  • Save obourdon/cce2b874845b1c922e50a653afb2fa77 to your computer and use it in GitHub Desktop.
Save obourdon/cce2b874845b1c922e50a653afb2fa77 to your computer and use it in GitHub Desktop.
Ansible command check
- name: "Check command"
command: |
my-cmd
my-params
...
register: test_command
failed_when: "test_command.rc == 2 and test_command.msg is match('.* No such file or directory')"
ignore_errors: true
environment: "{{ my_venv if enable_venv else {} }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment