In inventory:
[centos] centos1 ansible_port=2222 # main variant by using ansible_port variable centos2:2222 # alternative variant by adding :2222 to the host