Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [ansible@control rhce8-book]$ cat listing79.yaml
- ---
- - name: check for existence of devices
- hosts: all
- tasks:
- - name: check if primary disk exists
- debug:
- msg: a primary disk exists
- when: ansible_facts['devices']['sda'] is defined or ansible_facts['devices']['nvme0n1'] is defined
- - name: check if econdary disk exists
- debug:
- msg: a secondary disk exists
- when: ansible_facts['devices']['sdb'] is defined or ansible_facts['devices']['nvme0n2'] is defined
- - name: dummy test, intended to fail
- debug:
- msg: failing
- when: dummy is defined
- - name: check if /dev/sdc does not exist
- debug:
- msg: there is no /dev/sdc device
- when: ansible_facts['devices']['sdc'] is not defined
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement