Looks like you are using your own Custom Local Repository which is not configured properly hence the Yum is not able to locate the repodata.xml file.
Can you please check if you are able to access the public repo? From the ambari server host.
# wget http://public-repo-1.hortonworks.com/ambari/centos7/2.x/updates/18.104.22.168/repodata/repomd.xml
Also please check the "baseurl" that you are using inside the following file if it is correct and accessible?
# cat /etc/yum.repos.d/ambari.repo
If above works then you will need to check if you have configured your local offline repo correctly or not? And if you are able to access the following URL using wget / curl or using browser?
Also please login to your webserver host where you have configured the local repository and then please check if the path exists?
# ls -l /PATH/TO/AMBARI-22.214.171.124/centos7/126.96.36.199-22/repodata/repomd.xml
# ls -l /PATH/TO/AMBARI-188.8.131.52/centos7/184.108.40.206/repodata/repomd.xml
Please refer to the following doc to know more about offline local repo configuration.