I’m not really an expert either. I googled “discourse rake task” and got this discussion, in which @zogstrip says this is how to run a rake task:
# ssh into server
cd /var/discourse
./launcher enter app
rake uploads:migrate_to_new_pattern
I presume that you would simply change that last line to rake avatars:refresh
.