If you are getting the Error

curl: (51) Unable to communicate securely with peer: requested domain name does not match the server’s certificate.

and installation fails and in the /var/log/cloud-init.log you get he below error

2021-04-16 05:31:19,476 – util.py[DEBUG]: Running command [‘/var/lib/cloud/instance/scripts/part-004’] with allowed return codes [0] (shell=False, capture=False)
2021-04-16 05:31:20,364 – util.py[DEBUG]: Running command [‘/var/lib/cloud/instance/scripts/part-005’] with allowed return codes [0] (shell=False, capture=False)
2021-04-16 05:37:54,692 – util.py[WARNING]: Failed running /var/lib/cloud/instance/scripts/part-005 [51]
2021-04-16 05:37:54,693 – util.py[DEBUG]: Failed running /var/lib/cloud/instance/scripts/part-005 [51]
Traceback (most recent call last):
File “/usr/lib/python2.7/site-packages/cloudinit/util.py”, line 876, in runparts
subp(prefix + [exe_path], capture=False)
File “/usr/lib/python2.7/site-packages/cloudinit/util.py”, line 2091, in subp
cmd=args)
ProcessExecutionError: Unexpected error while running command.
Command: [‘/var/lib/cloud/instance/scripts/part-005’]
Exit code: 51
Reason: –
Stdout: –
Stderr: –
2021-04-16 05:37:54,698 – util.py[DEBUG]: Running command [‘/var/lib/cloud/instance/scripts/runcmd’] with allowed return codes [0] (shell=False, capture=False)
2021-04-16 05:37:55,219 – cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts)

If you get the above error then reason for this error is that there is fqdn missing in heat.conf file and in the certificate it expects the FQDN. Go to below directory in Openstack cloud

/etc/heat/heat.conf

and check the heat.conf file if instead of FQDN IP is mentioned in url then replace the IP with FQDN

url =https://<FQDN>:<PORT>/

and restart the heat services with below commands

# service heat-api restart

# service heat-api-cfn restart

# service heat-engine restart