ceuser@deyu:~/ansible_pb$ vi rmparted.yml
---
- hosts: balancers
tasks:
- name: unMount device
ansible.posix.mount:
path: /newpart
state: absent
- name: Remove a directory
ansible.builtin.file:
path: /newpart
state: absent
- name: Remove a primary partition
community.general.parted:
device: /dev/vdb
number: 1
state: absent
ceuser@deyu:~/ansible_pb$ ansible-playbook rmparted.yml PLAY [balancers] *************************************************************** TASK [Gathering Facts] ********************************************************* ok: [kvm15] TASK [unMount device] ********************************************************** changed: [kvm15] TASK [Remove a directory] ****************************************************** ok: [kvm15] TASK [Remove a primary partition] ********************************************** changed: [kvm15] PLAY RECAP ********************************************************************* kvm15 : ok=4 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
ceuser@deyu:~/ansible_pb$ ansible balancers -m shell -a "df -Th /dev/vdb1" kvm15 | FAILED | rc=1 >> df: /dev/vdb1: No such file or directorynon-zero return code
ceuser@deyu:~/ansible_pb$ ansible balancers -m shell -a "grep vdb1 /etc/fstab" kvm15 | FAILED | rc=1 >> non-zero return code