Skip to content

Instantly share code, notes, and snippets.

@phips
Created February 20, 2014 16:57
Show Gist options
  • Save phips/9118380 to your computer and use it in GitHub Desktop.
Save phips/9118380 to your computer and use it in GitHub Desktop.
Ansible: Check command output, react in next task
- name: Red Hat - Check subscription status
shell: /usr/sbin/subscription-manager list
register: subs
when: ansible_distribution == 'RedHat'
- name: Red Hat - Ensure registered to RHN (1/2)
shell: /usr/sbin/subscription-manager register --username USER --password PASS
when: ansible_distribution == 'RedHat' and "Subscribed" not in subs.stdout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment