---
- hosts: myhost.example.com
remote_user: user1
sudo: yes
tasks:
- name: remove select files in root
command: /bin/rm /root/{{ item }}
with_items:
- testing
- testing2
tasks:
- name: remove files
command: /bin/rm {{ dir/files }}
dirs_files:
dir: '/root'
files:
- testing
- testing2
dir: '/home/user'
files:
- testfile
- testfile2
Obviously that's not going to work but hopefully it illustrates what I'd like to do. I just don't want to have to write different tasks for different directories.
Any help appreciated.
Thanks,
Kent