Metasploit is a framework to develop exploits and payloads; and launch them on vulnerable targets. When you think about it, Metasploit is just a collection of modules (written in Ruby). The great news is Metasploit is modular enabling one to mix and match various payloads with the exploit to achieve the needed results.
Everything (script, program, executable) in Metasploit is a module. There are six types of modules.
1. auxiliary : Modules that help in various tasks such as port scanning, fuzzing, packet sniffing etc.
2. exploit : Collection of modules organised os-wise that are designed to take advantage of specific vulnerabilities.
3. payload : Modules that are to be run right after the successful exploit.
4. encoder : The encryption units that can make the payload be undetected by the anti-virus.
5. post : Various programs that can be run after successful exploitation and remote connection, like collecting passwords, setting up keyloggers or downloading files.
6. nop : NOP generators. NOP is an assembly language instruction which simply does nothing. The machine code of this instruction is different on each hardware architecture. NOP instructions are useful for filling the void in executables.
The metasploit directory in Kali Linux is /usr/share/metasploit-framework/ which has the modules directory beneath which you can find the aforementioned modules in their respective directories.