autocmd FileType yaml setlocal expandtab shiftwidth=2 softtabstop=2
NOTE: tabstop can also be set (or instead of softtabstop).