tasks:
- name: mkdir spark local_dir
file: path={{ item.mount }}/spark/data/local_dir mode=0777 state=directory
with_items: '{{ ansible_mounts }}'
when: item.mount | match("/hdd")
ignore_errors: yes
循环ansible_mouts里的数组,条件是item.mount匹配/hdd目录的,就创建/spark/data/local_dir目录。
网友评论