- hosts: all gather_facts: false tasks: - name: clear facts meta: clear_facts - hosts: all gather_facts: true vars: remount_state: rw remount_fs: - / - /usr - /opt tasks: - name: remount filesystems command: mount -oremount,{{ remount_state }} {{ item.mount }} warn=false with_items: >- {{ ansible_mounts | selectattr('mount', 'in', remount_fs) | list }} when: not item.options.startswith(remount_state) tags: - always